How to use the chain proxy
When you register a new chain, Orchestrate automatically creates a proxy to the Blockchain node, through which all the node's JSON-RPC methods are available.
See the API Methods Reference of Hyperledger Besu for details of all RPC methods.
Execute a JSON-RPC request through the Chain proxy
Prerequisites
Query the node using the Orchestrate Gateway API by sending a POST
request to the proxy/chains/{CHAIN_UUID}
, where {CHAIN_UUID}
is the uuid
of the registered chain.
- curl HTTP request
- JSON-RPC response
curl --location --request POST 'http://chain-registry:8081/{chain-UUID}' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1", false],"id":1}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x1",
"hash": "0xa2e37d81e60c2dec4b37cd2669257bf713f83d95869a0f961c095a045bb02369",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"parentHash": "0x154417f9675a4d7b3c14376b89fbd3b1c938b795d1d422d982ca9e5e0af8e88f",
"nonce": "0x0000000000000000",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot": "0xf412434fb37f1aaa68cc3c9ef0185e342e8afd805630ffedcc65f6257eeda1a7",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0xa46f0935de4176ffeccdeecaf3c6e3ca03e31b22",
"difficulty": "0x1",
"totalDifficulty": "0x2",
"extraData": "0xf8f0a00000000000000000000000000000000000000000000000000000000000000000f83f94866b0df7138daf807300ed9204de733c1eb6d600949c2106cca920c09cfeca24d4dd5323f0a97ba00c94a46f0935de4176ffeccdeecaf3c6e3ca03e31b22808400000002f886b841700eb6e6b8263326393917c328e3f29fde5e46e2c1845d27d96fbbb3bbf3dfaa68d9f3a98c801c2be635720a6880d19f52228d792f8577f6aac25bfa8192874d00b841b76a150ba7eb23f66a194fa6a5effb5023848f732a30ca4fbc801cd9655dac3073cf1f307b34de2973897f18afaf9f0a880467c927505ce8c230a1380312fd4801",
"size": "0x2f3",
"gasLimit": "0x1fffffffffffff",
"gasUsed": "0x0",
"timestamp": "0x6019cbad",
"uncles": [],
"transactions": []
}
}
How to use the chain proxy cache
Use the chain proxy cache to reduce the amount of calls to the same RPC endpoints. The cache is useful if you have multiple tenants and chains pointing to the same RPC endpoints. Read more on how to configure it here.
The cache covers calls to the following RPC methods:
eth_getBlockByNumber
eth_getTransactionReceipt
To skip the cache when making requests to the chain proxy, append the X-Cache-Control=no-cache
header as follows:
curl -X POST -H "Content-Type: application/json" -H "X-Cache-Control=no-cache" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ....}' {{ORCHESTRATE_GATEWAY_API_URL}}/{{CHAIN_UUID}}