区块链学习之-发布合约

链客,专为开发者而生,有问必答!

此文章来自链客区块链技术问答社区,未经允许拒绝转载。
区块链学习之-发布合约

命令行编译,发布合约1. 编译合约,编译不了curl --data ‘{“jsonrpc”:“2.0”,“method”: “eth_compileSolidity”, “params”: [“替换为你的合约文件”]}’ localhost:8545

  1. 通过bytecode 计算 gas, data 参数填写 合约编译后的bytecodecurl --data ‘{“jsonrpc”:“2.0”,“method”: “eth_estimateGas”, “params”: [{“from”: “替换为挖矿钱包地址”, “data”: “替换为编译后的合约二进制码”}], “id”: 5}’ localhost:8545

  2. 发布合约 gas 为上面获取到的数据,data 参数填写 合约编译后的bytecodecurl --data ‘{“jsonrpc”:“2.0”,“method”: “eth_sendTransaction”, “params”: [{“from”: “替换为挖矿钱包地址”, “gas”: “替换为上面eth_estimateGas获取到的值”, “data”: “替换为编译后的合约二进制码”}], “id”: 6}’ localhost:8545

  3. 获取合约地址, params 参数填写 上面的交易 hashcurl --data ‘{“jsonrpc”:“2.0”,“method”: “eth_getTransactionReceipt”, “params”: [“替换为上面eth_sendTransaction的交易hash值”], “id”: 7}’ localhost:8545

5.在线编译合约http://remix.ethereum.org

上一篇:JS类小功能


下一篇:easyui datagrid 批量编辑和提交数据