The contract does not run, it cannot get enough gas.

Here is the txn -

> > eth.getTransactionReceipt("0x069fdab662d9bb69f0af6a526c60289cb3d2cfa4cba1345fdd53e517cef136aa")
> {   blockHash:
> "0x1b5d679bb6ea82bf8f4ab54bdb8adf30d7b7d30a1158cc8ff9c71868bf675120", 
> blockNumber: 4904,   contractAddress: null,   cumulativeGasUsed:
> 4712388,   from: "0x0c12901e1ec7f80763cd433e8eca0c837d11a0c1",  
> gasUsed: 4712388,   logs: [],   logsBloom:
> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
> root:
> "0xc7e148d032b30b43c13cf3b219f17f6f405ab10e21e65bdca0c3cabfa60afeca", 
> to: "0x82ab361a9ca7359d7719f2f1aa6f1a95604c3ffd",   transactionHash:
> "0x069fdab662d9bb69f0af6a526c60289cb3d2cfa4cba1345fdd53e517cef136aa", 
> transactionIndex: 0 }

The gas used us 4712388 which is my gaslimit-1. The contract is simple so we have an issue with genesis I guess. I have two nodes in total and I attached them via addPeer.

~/blockchain$ cat genesis.json { "config": { "chainId": 33, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "nonce": "0x0000000000000033", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x47e7c5", "difficulty": "0x100", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": {} }

Contract -

pragma solidity ^0.4.18;

contract RegisterContract {

    uint public contractWeight;
    mapping(bytes32=>string) public contracts;

    function addContract ( string jsonInput, bytes32 hashKey) public {

        contracts[hashKey] = jsonInput;

    }

    function addWeight (uint weight) public {
        contractWeight = weight;

    }

}
  • I found out it is the string that is causing the problem. – Trevor Oakley Mar 31 at 5:48
  • 2
    Create an answer for your own question, explaining clearly the problem and mark it as the correct answer. This is both allowed and encouraged when you solve your own problem. – norganna Mar 31 at 5:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.