转账

要指定交易的发送者、接收者、转币的数量。

web3.eth.sendTransaction({
    from: "from address",
    to: "to address Recipient",
    value: 10000000000000000
});

创建合约

to字段要留空不填,在data字段中指定合约的二进制代码,from字段是交易的发送者也是合约的创建者。

web3.eth.sendTransaction({
    from: "contract creator's address",
    data: "contract binary code"
});

执行合约

将交易的to字段指定为要调用的合约的地址,通过data字段指定要调用的方法以及向该方法传递的参数。

web3.eth.sendTransaction({
    from: "sender's address",
    to: "contract address",
    data: "hash of the invoked method signature and encoded parameters"
});

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code