I am getting this error, when I deploy contract by using web3.
TypeError: Cannot create property 'from' on string '0xf901b08083022591808080b90160608060405234801561001057600080fd5b506040516020806101408339810180604052602081101561003057600080fd5b8101908080519060200190929190505050806000819055505060e9806100576000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c8063822a634a146041578063c412eaba14606c578063ca6158cb146088575b600080fd5b606a60048036036020811015605557600080fd5b810190808035906020019092919050505060a4565b005b607260ae565b6040518082815260200191505060405180910390f35b608e60b7565b6040518082815260200191505060405180910390f35b8060008190555050565b60008054905090565b6000548156fea165627a7a723058207942a879e753640985945a1fc5ac2fb685daaae7c7dec98582b4a34a960ab0b200290000000000000000000000000000000000000000000000000000000000000001820bfaa037ab41699c31e6408133701bf0890d8c50ece7f811572150d21baba78d99ce79a049c7e9372c52625b39736e01448754474debaef93150fb555339bace9c9099d5'
This is my code
await web3.eth.accounts.wallet.add({
privateKey: privateKey,
address: address
});
defaultAccount = await address;
const gasPrice = await web3.eth.getGasPrice();
console.log(gasPrice)
const gasEstimate = await itemContract.deploy({ data: bytecode, arguments:[1] }).estimateGas();
await itemContract.deploy({
data: bytecode,
arguments:[1]
})
.send({
from: decryptEtherAccount.address,
gas: gasPrice,
gasPrice: gasEstimate,
}).on('error', (error) => {
console.log("Error: ", error);
}).on('transactionHash', (transactionHash) => {
console.log("TxHash: ", transactionHash);
}).on('receipt', (receipt) => {
console.log("Address: ", receipt.contractAddress)
}).then((newContractInstance) => {
console.log(newContractInstance);
}).catch(function(error) {
console.log(error);
});
Are there any problem in my code ?
console.log(decryptEtherAccount.address)
and tell us what you get. – goodvibration Oct 28 '19 at 5:12