本文环境:
区块链版本:以太坊POA联盟链
节点版本: geth 1.9.19
nodejs版本:v10.14.0
操作系统:windows 64
本文测试用私钥部署智能合约的代码(web3.js)。
1.官方文档给出的部署合约代码
在官方文档中(https://web3js.readthedocs.io/en/v1.2.9/web3-eth-contract.html),给出了部署智能合约的代码:
myContract.deploy({
data: '0x12345...',
arguments: [123, 'My String']
})
.send({
from: '0x1234567890123456789012345678901234567891',
gas: 1500000,
gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
console.log(receipt.contractAddress) // contains the new contract address
})
.on('confirmation',