I am trying to run a function with Remix web compiler on a contract in my private chain. Here is my contract and I am trying to run the function changeVaccinHistory:

contract PatientObjects {

    struct patientDetails{
        bytes32 firstName;
        bytes32 lastName;
        bytes32 dob;
        uint height;
        uint weight;

    patientDetails details;
    address lastMSSeen;
    address vaccinsHistory;

    function PatientObjects (bytes32 firstName, bytes32 lastName, uint height, uint weight, bytes32 dob ,address lastMSseen, address vaccinHistory){
        details.firstName = firstName;
        details.lastName = lastName;
        details.height = height;
        details.weight = weight;
        details.dob = dob;
        lastMSSeen = lastMSseen;
        vaccinsHistory = vaccinHistory;

    function changeVaccinHistory(address newAddress) returns(address){
        vaccinsHistory = newAddress;
        return vaccinsHistory;

    function changeHeight(uint newHeight) returns (uint){
        details.height = newHeight;
        return details.height;

    function changeWeight(uint newWeight) returns (uint){
        details.weight = newWeight;
        return details.weight;

    function getDetails() public constant returns (bytes32, bytes32, uint, uint, bytes32, address, address){
        return (details.firstName, details.lastName, details.height, details.weight, details.dob, lastMSSeen, vaccinsHistory);

Unforutnaly i get the error: callback contain no result Gas required exceeds limit: 4707786

I don't understand what this error means and what can i do to avoid it.

2 Answers 2


Answering your question:

  • First you need to understand gas, see below:

I don't understand what this error means and what can i do to avoid it.

  • Next you need to know how to handle the implications of gas:

The basics is that you are trying to run a computationally heavy transaction and the network currently won't accept it. When you are writing Ethereum contracts you need to think very very carefully about what you are trying to do and use as little resources as possible. It isn't the same as writing a traditional server script that can be as wasteful as you like.

Ethereum and Gas

In Ethereum there is a concept known as "gas", gas is a very important and integral part of the Ethereum network. Gas is a measure of computational power, and since computational power is expensive, excessive consumption of gas is by design discouraged.

This means that gas used in transactions needs to be paid for using Ether by the sender of the transaction that initially triggered the computation.

Gas on the Transaction Level:

Consider the ethereum wiki : https://github.com/ethereum/wiki/wiki/Design-Rationale#gas-and-fees

It is very difficult to know in advance how much gas a transaction will need. Therefore, transactions have a gas limit field to specify the maximum amount of gas the sender is willing to buy. If the gas used exceeds this limit during execution, the process stops. The sender still has to pay for the performed computation, but they are protected from exhausting all their funds.

The transaction gas limit also protects full nodes from attackers, who could without a gas limit, execute infinity loops.

Gas on the Block Level:

Ethereum blocks also have a field called gas limit. It defines the maximum amount of gas all transactions combined in the whole block are allowed to use. The purpose is to keep block propagation and processing time low, allowing for a decentralized network. In contrast to Bitcoin's block size ;) , it isn't a constant. Instead, miners have the option to increase or decrease it every block by a certain factor.

You can view the changing gas limit on https://ethstats.net/ .

  • 1
    So how should i go around this, should i simply rethink the design of my contracts ? What could be done to sovle this ? Btw thank you for your complete answer !
    – 0xtuytuy
    Commented Mar 5, 2017 at 17:03

Considering this:

...in my private chain

...then a pragmatic option - that would allow you to continue with your testing - would be to alter the gasLimit value in your genesis.json file. That doesn't change the fact that you should be very aware of the computation involved in your contract, as a previous answer has said.

Aside #1

In Browser Solidity I'm getting a much lower set of costs for changeVaccinHistory()... (Are you sure it's not the contract deployment that's costing so much?)

Aside #2

The data you're storing - i.e. medical records - will be visible to anyone with access to your chain.

  • Good points. Particularly Aside #2 Commented Mar 6, 2017 at 16:35
  • I'm also getting this error testing contracts on Ropsten network, is this something that I am unable to change in this case? Commented Sep 8, 2017 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.