A fast, flexible and simple development environment framework for Ethereum smart contract, testing and deployment on Ethereum virtual machine(EVM). https://cobraframework.github.io
Project description
A fast, flexible and simple development environment framework for Ethereum smart contract, testing and deployment on Ethereum virtual machine(EVM).
With cobra you can get built-in smart contract compilation, linking, deployment, binary management, automated contract testing with Unittest and PyTest frameworks, scriptable deployment & migrations framework and network management for deploying to many public & private networks like INFURA or Ganache CLI.
Dependency
This library requires the solc
executable to be present.
Only versions >=0.4.2
are supported and tested though this library may work
with other versions.
- solc: Ethereum solidity compiler.
- ganache-cli: A command-line version of Ethereum blockchain server.
- pip: To install packages from the Python Package Index and other indexes.
- python3: version 3.6 or greater.
Installation
PIP to install cobra globally. For Linux sudo may be required.
$ pip install eth-cobra
Development
We welcome pull requests. To get started, just fork this repo, clone it locally, and run:
$ pip install -e . -r requirements.txt
Quick Usage
Initialize project structure
A default set of contract and tests, run the following command:
$ cobra init
Get help:
$ cobra --help
From there, you can run cobra compile
, cobra deploy/migrate
and cobra test --unittest/--pytest
to compile your contracts, deploy those contracts to the network, and run their associated unit tests.
advanced cobra.yaml
compile:
solidity_path: "./contracts" # global
artifact_path: "./build/contracts"
contracts: [
contract: {
solidity: "Contract.sol",
solidity_path: "./contracts/libs", # detail
import_remappings: [
"=/path/folder/contracts/"
],
allow_paths: [
"/path/folder/contracts/"
]
}
]
deploy:
artifact_path: "./build/contracts/"
contracts: [
contract: {
artifact: "Contract.json",
links: ["Contract.json"]
}
]
test:
artifact_path: "./build/contracts/"
test_paths: ["./tests"]
contracts: [
contract: {
artifact: "Contract.json",
links: ["Contract.json"]
}
]
network:
development: {
url: "https://ropsten.infura.io/...",
host: "localhost",
port: 8545,
hdwallet: {
mnemonic: "decide adjust legend nation type same task aim rigid lucky guilt close", # or
seed: "decide adjust legend nation type same task aim rigid lucky guilt close",
password: "meherett",
private: "5f8935bb3b61b312ba1114cbf6f1ea30102383f2b043a1b213aa482132d25049",
gas: 3000000,
gas_price: 1000000
},
protocol: "HTTP", # HTTP, HTTPS, WS(WebSocket) and ICP
account: {
address: "0x6a373a75c388ac2d160f1d2b6d9ada34f29831cd",
gas: 3000000,
gas_price: 1000000
}
}
Testing
Tests are still under development.
You can run the tests with:
$ pytest tests
Or use tox
to run the complete suite against the full set of build targets, or pytest to run specific
tests against a specific version of Python.
Meta
Meheret Tesfaye – @meherett – meherett@zoho.com
Distributed under the MIT license. See LICENSE
for more information.
License
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file eth-cobra-0.1.1.tar.gz
.
File metadata
- Download URL: eth-cobra-0.1.1.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acd2f15971f2c028a95e775f328a29e13ce0b7e8afc0ebfe3779fbda68b478da |
|
MD5 | be75e809c6dec30d7ad28117c23e6fda |
|
BLAKE2b-256 | f362f7d8b223026b314997a82cd65b27fd570996dfd149f1bf9dbec4aef56c1e |
File details
Details for the file eth_cobra-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: eth_cobra-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e832f502b0b2a3afaf06988737a26f91bd2d94afeb307b4467c877fc014685e7 |
|
MD5 | 87d4ea11fef70a7f344e87e6a26c9103 |
|
BLAKE2b-256 | e527a2886d0626f61460ccd8baca54416166d7597a05c1e1e680c4c3103bcad2 |