Contract Address

kvhnukekvhnuke Member Posts: 15
I was able to successfully submit a contract using
contractaddress = eth.sendTransaction({from: primary, data: compiled.code});
and it did return contractaddress 0xXXXXXX...
but then when I tried eth.getCode(contractaddress) it always returned '0x' it didnt include the code, how can I get the code?

after I played around for a bit I believe I created 3 contracts and you can see them here

unfortunatly I didnt save the contractAddress for those contracts, is there anyway I can get the contractAddresses for those?
Thanks in advance


  • tomgalvintomgalvin Member Posts: 10
    I have also been having issues with creating contracts. I have found that most of the time increasing the gas limit makes it work.

    As for finding the contract addresses, I would like to know this as well, but it seems that there is no way to get the return value for a transaction submitted to the network. :/
  • veoxveox Member Posts: 3
    @kvhnuke - eth.getCode('0xc6d9d2cd449a754c494264e1809c50e34d64562b') seems to work, that's the Name_Registrar address hash. Notice the quotes - that may be one reason why you get '0x' returned.

    You can also use a callback to print the address during contract creation, something like:
        {from: eth.coinbase,
         to: "a9c21f6c6841b15ee416178c4b3d23b8b1091404",
         value: web3.toWei(42, "finney"),
         gas: 50000,
         gasPrice: web3.toWei(1, "szabo")
        function(err, address) { // <---------- callback
    	if (!err) {
    	    console.log("address:", address)
    	} else {
    	    console.log("error: ", err)
Sign In or Register to comment.