【发布时间】:2018-08-29 02:40:18
【问题描述】:
为了将智能合约部署到网络中,我们需要以下三个信息:
来自 web3 规范:
// deploy new contract
var contractInstance = MyContract.new([constructorParam1] [, constructorParam2], {data: '0x12345...', from: myAccount, gas: 1000000});
如果我错了,请纠正我:
constructorParams - 传递给智能合约构造函数的所有数据,
from - 确定部署此合约的地址
gas - 此交易可以消耗多少气体限制
data 是什么,它是合约的编译后的solidity 代码,如果是,那么如果我们已经指定了该合约的ABI,为什么还需要它?
我如何获得这个data 参数?当我尝试在未指定 data 参数的情况下将合约部署到网络时,我的控制台中也会出现错误:
Error: "invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go struct field SendTxArgs.data of type hexutil.Bytes"
【问题讨论】:
标签: blockchain ethereum solidity smartcontracts web3