I am running the following code in web3 the backend is a node running parity --testnet -j -w --jsonrpc-interface all
.
My web3 code
// data.contracts.TestContract is the results of
// solc test-contract.sol --json-combine abi,asm, etc...
var abi = data.contracts.TestContract.abi;
var TestContract = eth.contract(JSON.parse(abi));
var myTest = TestContract.new({
data: "0x" + data.contracts.TestContract.bin, // binary data for contract
gas: 300000,
from: someAddressWithEther,
}, function (err, myContract) {
// from offical docs at https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract
if(!err) {
// e.g. check tx hash on the first call (transaction send)
if(!myContract.address) {
console.info("transactionHash", myContract.transactionHash) // The hash of the transaction, which deploys the contract
// check address on the second call (contract deployed)
} else {
console.info("theAddress", myContract.address) // the contract address
}
}
}
The results
The console.info
with the transaction hash returns
transactionHash 0x0000000000000000000000000000000000000000000000000000000000000000
Which doesn't seem like a valid transactionHash. The theAddress line never seems to run.
My questions
I am not sure why I would get the 0x0...0 hash? Is there some error in this code that i am not seeing? How long should i wait for the address?
Also wouldn't mind comment pointing to a full description, ideally with full source examples on how to properly deploy from the web3?
--unlock {address} --password {passwordfile}
– The Officious BokkyPooBah Jun 28 '16 at 23:55