I'm trying to access data inside a smart contract. The contract is visible here for example.

The documentation for the smart contract is accessible here

An example of an instance of the contract (one of the converter in my specific example) can be found here.

My goal is to access the data that are contained inside that instance (bnt2eoscnvrt in my case) and more specifically I would like to access the field uint64_t ratio; which is in the public definition of the Main Smart Contract.

I'm mostly using NodeJs and the EOSIO JS driver but any example would do it... I'm quite lost to be honest, I'm sure that's not so complex but I'm failing to understand the logic and when one spends too much time on an issue, one loose track of propre judgment I guess ;-)

Many thanks in advance for any assistance

1 Answer 1


You need to fetch the table where the data is stored and then access the field.

First, you need to setup eosjs:

const { Api, JsonRpc, RpcError, JsSignatureProvider } = require('eosjs');
const fetch = require('node-fetch');
const { TextDecoder, TextEncoder } = require('text-encoding');

// Use your private (only for test enviroment!!!)
const signatureProvider = new JsSignatureProvider(ACCOUNT_ACTIVE_PRIVATE_KEY);

// http://localhost:8888 - the endpoint where the contract is deployed. 
// It can be a local node, JungleTestnet, Mainnet
const rpc = new JsonRpc("http://localhost:8888", { fetch });
const EOS = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });

async function getTableData(request, response) {
  const result = await rpc.get_table_rows({
    'table': TABLE_NAME


I hope this helps :)

  • What if I have large number of records in the table, could I filter/search by index?
    – Kristian
    Jan 7, 2019 at 12:20

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.