contract lost

czhangczhang Hong KongMember Posts: 12
Hi, am new to ethereum and just followed the instruction here to create a contract and send the transaction out using geth console, but eth.getCode(tokenAddress) always returns '0x', same result even after I waited for a while. No errors in the log. I had 2 ethers in my account. Any help would be much appreciated.


Best Answers


  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    Play with the amount and price of gas you're sending. Since it's just test ether at the moment, I'm using eth.gasPrice*3 to make sure for my contracts to be included almost immediately.
  • czhangczhang Hong KongMember Posts: 12
    So I used 30 szabo for the gas price and 100000 for the gas limit, then the transaction deducted 2 ethers from my account, but still got nowhere:

    > lastToken
    > eth.getCode(lastToken)

    Here was the console tansaction command I ran:

    > var lastToken = eth.sendTransaction({data:tokenCompiled.token.code, from:primaryAccount, gas:"0x186a0", gasPrice:"0x1b48eb57e000"})

    And here are the log lines (account code was removed):

    I0526 22:42:15.712481 3971 api.go:38] eth_sendTransaction [{"data":"0x5b612710600060005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050819055505b61017d806100466000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063412664ae1461003a578063f8b2cb4f1461005b57005b610051600480359060200180359060200150610076565b8060005260206000f35b61006c60048035906020015061013f565b8060005260206000f35b600081600060005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505410156100b85760009050610139565b81600060005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282825054039250508190555081600060005060008573ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282825054019250508190555060019050610139565b92915050565b6000600060005060008373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050549050610178565b91905056","from":"0xblahblahblah","gas":"0x186a0","gasPrice":"0x1b48eb57e000"}]

    I0526 22:42:15.713931 3971 transaction_pool.go:176] (t) 3631363563396239 => [NEW_CONTRACT] (0x6c83e0) 6bccf3e2c7e57933be698b05f83383247176b2d014e8e3eb29d396bbcefbfc81

    I0526 22:42:15.714206 3971 xeth.go:960] Tx(6bccf3e2c7e57933be698b05f83383247176b2d014e8e3eb29d396bbcefbfc81) created: 42a1ca48f518a6d0030fda979511e40792a4d3d8

    Any ideas?

  • kvhnukekvhnuke Member Posts: 15
    Im having the same issue, using latest geth. Followed three different tutorials and but every time getCode returns '0x'

    here is one contract address 0xd331fc2fd1b6495647661ea73094540b21b84f79 and it was successfully mined

  • czhangczhang Hong KongMember Posts: 12
    Thanks kvhnuke. So it takes 10 ethers to add the contract? Which contract tutorial you used?

  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    @all - note that there is a known issue where we're seeing contracts taking longer than expected to be 'saved' on the network despite appropriate gas amount and price being passed upon creation.

    The devs are on it of course - in the meantime the workaround is to keep trying with large gas amount and price. I find that passing a 3M gas argument at eth.gasPrice*3 works (relatively) well.
  • czhangczhang Hong KongMember Posts: 12
    @StephanTual - Thanks. I know it's been asked many times, but is there no other easy way to obtain ethers apart from asking someone to spare? Took me several days of mining to be just awarded 10 ethers, and just enough to create one contract :(
  • tomgalvintomgalvin Member Posts: 10
    You may want to start a private chain for testing, as then you have a lot more control, but if you really want to test on the testnet, you can always grab some free ether from
  • czhangczhang Hong KongMember Posts: 12
    @eupraxic thanks. the post is really helpful and got the faucet working now :)
Sign In or Register to comment.