For the complete documentation index, see llms.txt. This page is also available as Markdown.

Creating an Oracle Request

In order for the DSP to know what information it is that you want to receive, there is a format to creating an oracle request.

Each of the following oracle request types comes equipped with its own syntax that gets encoded with Buffer.from("<URI HERE>", 'utf8'). The following guide will explain the syntax to generate your URI. Each URI should be passed through the buffer as plaintext is not accepted.

NodeJS example:

const body = Buffer.from('{"block_num_or_id":"36568000"}').toString('base64')
const res = await testcontract.testrnd({
  uri: Buffer.from(`https+post+json://timestamp/${body}/mainnet.eosn.io:443/v1/chain/get_block`, 'utf8')
}, {
  authorization: `${code}@active`,
  broadcast: true,
  sign: true
});

Smart contract example (from here):

[[eosio::action]] void testrnd(std::vector<char> uri) {
  getURI(uri, [&]( auto& results ) { 
    return results[0].result;
  });
}

Explore the different APIs in the following categories.

Last updated

Was this helpful?