0

The following contract runs successfully in Ropsten but not on a private blockchain. I assumed it could be a gas issue. So I increased the gaslimit and started a new blockchain but I get the same issue.

The txn runs but the array called contracts is not updated.

It is not the contract code but the private blockchain. How should I check this to find the error?

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;
    }
}

Txns -

eth.pendingTransactions [{ blockHash: null, blockNumber: null, from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305", gas: 4700388, gasPrice: 100000000000, hash: "0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06", input: "0x4c228d4400000000000000000000000000000000000000000000000000000000000000403966383664303831383834633764363539613266656161306335356164303135613362663466316232623062383232636431356436633135623066303061303800000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000", nonce: 788, r: "0xd9243d6f2c4610a67510083a74f3ed70a1b7a3e576d7da0722c4336b2f40070b", s: "0x5f0de0653daf4a74f04eb8854dd46847466e133a01f5ff559c2e629c0ffa2291", to: "0xfb63afbe6798270daaa61ba19122c346fb57affb", transactionIndex: 0, v: "0x2b693", value: 0 }] eth.pendingTransactions [] con.contracts("9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08")

""

eth.getTransactionReceipt("0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06") { blockHash: "0x0a62b865d8b6887fa0760779443b0584161ae9320b2073ef403ee13c02516a2b", blockNumber: 263081, contractAddress: null, cumulativeGasUsed: 4700388, from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
gasUsed: 4700388, logs: [], logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", root: "0xbf67affe7553839628f283b8436fbba2f1c39b8aff8d270c767cfa8ac4054bde", to: "0xfb63afbe6798270daaa61ba19122c346fb57affb", transactionHash: "0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06", transactionIndex: 0 }

  • Is your private blockchain testrpc (ganache-cli) based? – norganna Apr 1 '18 at 8:57
  • No, I just started a geth node in private. It is not testrpc. I think must be some kind of gas issue. – Trevor Lee Oakley Apr 1 '18 at 9:03
  • I've tried your contract with a private blockchain with geth v1.8.3 and solc v0.4.21 and it works as expected. What is your genesis file? Any extra details that helps reproduce the problem will be helpful. – Ismael Apr 2 '18 at 7:21
  • I finally sorted this out. It was related to bytes32 not being accurate. It was related to 0x. I had no error msg and I had before gas issues so I thought it was a gas issue. – Trevor Lee Oakley Apr 2 '18 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.