一个快速、灵活和简单的以太坊智能合约开发环境框架,测试和部署在以太坊虚拟机(evm)上。https://cobraframework.github.io网站
py-cobra的Python项目详细描述
一个快速、灵活、简单的开发环境框架。 在以太坊虚拟机(EVM)上部署。
使用cobra,您可以获得内置的智能合约编译、链接、部署、二进制管理, 使用unittest和pytest框架、可编写脚本的部署和迁移框架进行自动合同测试 以及用于部署到许多公共和私有网络(如INFURA)或 Ganache CLI。
依赖性
此库要求存在solc
可执行文件。
尽管此库可以工作,但仅支持和测试版本>=0.4.2
其他版本。
- solc:以太坊固化编译器。
- ganache-cli:以太坊区块链服务器的命令行版本
- pip:从python包索引和其他索引安装包。
- python3:3.6版或更高版本。
安装
pip将在全球安装cobra。对于Linux,可能需要sudo。
$ pip install py-cobra
开发
我们欢迎拉取请求。要开始,只需分叉此repo,在本地克隆它,然后运行:
$ pip install -e . -r requirements.txt
快速使用
初始化项目结构
默认的协定和测试集,请运行以下命令:
$ cobra init
获取帮助:
$ cobra --help
从那里,您可以运行cobra compile
、cobra deploy/migrate
和cobra test --unittest/--pytest
。
要编译契约,请将这些契约部署到网络,并运行其关联的单元测试。
compile:solidity_path:"./contracts"# globalartifact_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:"decideadjustlegendnationtypesametaskaimrigidluckyguiltclose",# or seed:"decideadjustlegendnationtypesametaskaimrigidluckyguiltclose", 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}}详细信息>
测试
测试仍在开发中。
您可以使用以下命令运行测试:
$ pytest tests
或者使用tox
对完整的构建目标集运行完整的套件,或者使用pytest运行特定的
针对特定版本的python进行测试。
元
这里是特斯法耶–@meherett–meherett@zoho.com
根据麻省理工学院的许可证发行。有关详细信息,请参见LICENSE
许可证
这个项目是在麻省理工学院的许可下授权的-请参见LICENSE文件了解详细信息