zoukankan      html  css  js  c++  java
  • 区块链学习之-发布合约

           最近慢慢开始接触区块链的项目,最近开始发布合约,记录一下。

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

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

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

    4. 获取合约地址, params 参数填写 上面的交易 hash
    curl --data '{"jsonrpc":"2.0","method": "eth_getTransactionReceipt", "params": ["替换为上面eth_sendTransaction的交易hash值"], "id": 7}' localhost:8545

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

    我不是一个技术狂人,但是我对技术有一种执着,我喜欢在键盘上噼噼啪啪的敲打,我喜欢项目完成那一刻的感觉。能力有限,如有不足之处,欢迎大家提出意见,一起成长!!!
  • 相关阅读:
    阿衣楚往事
    加速计算机启动
    此一生,与谁相逢v
    关于cmd代码
    关于POJO
    ERP,SOA与J2EE什么关系
    QoBean技术文档(1):QoBean的基础技术
    ed 1.7 支持60种编程语言的免费编辑器
    面试必问的16个经典问题的回答思路
    Java 多线程间的通讯
  • 原文地址:https://www.cnblogs.com/hayyah/p/9081816.html
Copyright © 2011-2022 走看看