How can I check the contract balance, like Augur (REP), on an address with JSON-RPC? There doesn't seem to be alot of documentation about this.

  • 3
    Not a duplicate of the Q&A above. This question is asking about the REP token balance for an address, not the ETH balance. Oct 5, 2016 at 11:30
  • 2
    @BokkyPooBah Indeed I'm asking for the REP token balance.
    – Julian
    Oct 5, 2016 at 12:27

1 Answer 1


To get the REP token balance via JSON-RPC, you will have to use the eth_call method. See How to call a contract method using the eth_call JSON-RPC API for more details on using eth_call.

And from augur-core/src/repContract.se , the balanceOf(...) function is defined as:

def balanceOf(address: address):
    return(self.reporting[address]: uint256)

And this matches the ERC: Token standard #20, where the balanceOf(...) function should have the signature:

function balanceOf(address _owner) constant returns (uint256 balance)

To find the function signature in geth, I run the following command:

> web3.sha3('balanceOf(address)').substring(0,10)

For an example, we will use the REP token balance for the address 0xab11204cfeaccffa63c2d23aef2ea9accdb0a0d5 with the following balance:

enter image description here

I now have to use the function signature from above with a left zero padded representation of the address to be passed to the balanceOf(...) function:


From etherscan.io/token/REP, the REP contract address is 0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5.

I ran the following JSON-RPC command against my Parity node (for geth, you can leave off the --header parameter):

curl localhost:8545 -X POST --header 'Content-type: application/json' --data '{"jsonrpc":"2.0", "method":"eth_call", "params":[{"to": "0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5", "data": "0x70a08231000000000000000000000000ab11204cfeaccffa63c2d23aef2ea9accdb0a0d5"}], "id":1}'

The result from the command above is:


And to confirm the results are correct, I ran the following command in geth:

> new BigNumber("000000000000000000000000000000000000000000010843f6b148a2ec22c604", 16)/1e18

You will have to convert the hex result into a number in your application.

Update Oct 18 2016

As documented in RPC error "invalid or missing value for params" when calling contract constant void functions, you may have to add a block parameter to the params list. Your command with the block parameter will be:

curl localhost:8545 -X POST --header 'Content-type: application/json' --data '{"jsonrpc":"2.0", "method":"eth_call", "params":[{"to": "0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5", "data": "0x70a08231000000000000000000000000ab11204cfeaccffa63c2d23aef2ea9accdb0a0d5"}, "latest"], "id":1}'

Reference The default block parameter and eth_call.

eth_call without the block parameter worked previously, but now seems to be mandatory.

  • 1
    Great reply! I'll check if this works tomorrow and when it does I"ll accept your answer.
    – Julian
    Oct 5, 2016 at 13:43
  • 1
    As usual, an excellent post from Bokky. The result returned as of today is different, but I guess that is because the owner of that account must have sold or transferred or bought more tokens. Jun 16, 2017 at 22:17

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.