environment: Web3 0.20.7,Infura,node.js(backend) Deploy contract with Web3 0.20.7
pragma solidity ^0.5.1;
contract Bang{
address holder;
address proxy;
constructor (address _holder, address _proxy) public {
holder=_holder;
proxy=_proxy;
}
function getholder() public view returns(address){
return holder;
}
}
var Tx = require('ethereumjs-tx');
var Web3 = require('web3');
const testnet = 'https://ropsten.infura.io/';
const web3 = new Web3(new Web3.providers.HttpProvider(testnet));
var wallet_address = "0x4b2194Fa5a.....";
var count = web3.eth.getTransactionCount(wallet_address);
var data = "0x608............"//from remix detail
var holder = "0xF2C44b7f10533....";
var proxy = "0xf21BF631C5382....";
var rawTransaction = {
"from": wallet_address,
"nonce": web3.toHex(count),
"gasPrice": web3.toHex(5000000000),
"gasLimit": web3.toHex(5000000),
"data": data
};
var privateKey = new Buffer('CEA8070A7EC5........', 'hex');
var tx = new Tx(rawTransaction);
tx.sign(privateKey);
var serializedTx = tx.serialize();
web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'),
function(err, hash) {
if (!err)
console.log(hash);
else
console.log(err);
});
These codes would deploy that contract,but the constructor argument cannot be into the contract. How to insert the constructor argument in web3 0.20.7 with infura?