What does "intrinsic gas too low" mean?

  • I'm running the Mist wallet, and I've deployed this contract to testnet (from https://ethereum.stackexchange.com/a/179/520) :

    contract Notary{
        struct Document {
            uint timestamp;
            bytes ipfs_hash;
            address[] signatures;
        }
        mapping(address => bytes[]) public users; //maps addresses to ipfs document hashes
        mapping(bytes32 => Document) public documents; //maps sha3(ipfs) hashes to documents
    
        function addDocument(bytes ipfs) public {
            users[msg.sender].push(ipfs); //Add document to users's "signed" list
            address[] memory sender;
            sender[0] = msg.sender;
            documents[sha3(ipfs)] = Document(block.timestamp, ipfs, sender);
        }
    
        function signDocument(bytes ipfs) public {
            users[msg.sender].push(ipfs);
            documents[sha3(ipfs)].signatures.push(msg.sender);
        }
    
    }
    

    When I try to execute the addDocument function though, I get "intrinsic gas too low". What does this mean? Also before confirming execution, it says: "Data can't be executed, so it will use all provided gas."

  • jimkberry

    jimkberry Correct answer

    5 years ago

    The intrinsic gas for a transaction is the amount of gas that the transaction uses before any code runs. It is a constant “transaction fee” (currently 21000 gas) plus a fee for every byte of data supplied with the transaction (4 gas for a zero byte, 68 gas for non-zeros). These constants are all currently defined for geth in params/protocol_params.go. Presumably they are also coded into the source for the other node/client implementations as well.

    I'm trying to send a tx with Metamask on Ropsten with `2204` bytes so I used: 2204 * 64 + 21000 gas but I still get `Intrinsic gas too low`. Shouldn't it even require less gas because of the zero bytes?

    @AndiGiga - I hope this doesn't sound like a dopey querstion, but: did you mean to say "2204 * 68 + 21000"?

    Thx, that's the point I was too blind to see the `8`.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM