Send Requests
Flashbots has a hosted set of RPC nodes you can use:
- RPC Endpoint:
https://rpc.rigil.suave.flashbots.net
Or if you followed the previous guide, you can use your locally running SUAVE.
- RPC Endpoint:
http://localhost:8545
Test RPC
The easiest way to test your connection to an RPC endpoint is via a simple curl command.
Remote curl request
curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
https://rpc.rigil.suave.flashbots.net
Local curl request
curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545
Expected Response
If your connection is working properly you should get a response such as:
{"jsonrpc":"2.0","result":"0x30870","id":1}
Note that the only difference between these two is the URL at the end of the curl request.
RPC Differences
The SUAVE JSON-RPC extends the usual Ethereum JSOPN-RPC methods. Some methods in the eth
namespace are overloaded to support confidential compute requests.
Example
The example above follows the exact same API interface as the original go-ethereum client. However, if we grab a random transaction hash from the Rigil Explorer, we can see the core difference with the SUAVE Rigil RPC: a new SUAVE transaction type.
Remote curl request
curl -X POST \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": [
"0x5aa009b8a3fdbb5b58943085692600fca19f0d4fe81dc7dc24bec350b9d5be1f"
],
"id": 1
}' \
https://rpc.rigil.suave.flashbots.net
Response
{
"jsonrpc": "2.0",
"result": {
"blockHash": "0x24571071ce398006e378bbb42b19d5090fcaf28dc5154cf6d8872e2ca11268b3",
"blockNumber": "0x30925",
"chainId": "0x1008c45",
"confidentialComputeResult": "0xbe84ce3800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000028076c547f4b19e59b2874cfbdf1b641fd000000000000000000000000000000000ccc2fae18677495396c62244e70f18c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009845ee00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000929b5a520d04a27cce80c5adc80cd8e4fae75f370000000000000000000000000000000000000000000000000000000043200001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000003493869959c866713c33669ca118e774a30a0e500000000000000000000000000000000000000000000000000000000000000156d657673686172653a76303a6d6174636842696473000000000000000000000000000000000000000000000000000000000000000000000000000000000000457b22546f223a22307861613563333331646634373863323665363930393138316663333036656135333566306534636365222c2244617461223a22333074516c673d3d227d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002637b2276657273696f6e223a2276302e31222c22696e636c7573696f6e223a7b22626c6f636b223a223078393834356565227d2c22626f6479223a5b7b227478223a22307866383663383038323031393038323739313839346161356333333164663437386332366536393039313831666333303665613533356630653463636538376231613262633265633530303030383464663462353039363264613039636265326163666338363733326635663038383863323631373163366438343838353833343164376330393663616363303762323463366234316165623862613037326532326162376535666637396466323964393862396236653636386161626463366437363765383734616430303435313163646634363538663630643261222c2263616e526576657274223a66616c73657d2c7b227478223a22307866383663383038323031393038323761626339346161356333333164663437386332366536393039313831666333303665613533356630653463636538376231613262633265633530303030383464663462353039363265613031616134646365653134666462383739353731356465306130636665613738616335663135353931623737643932666439383165666664303434393462663564613031313466653864353033313366626162643064626439366637353763633430383066376131353161633365346266313265623563366337633631323061346435222c2263616e526576657274223a66616c73657d5d2c2276616c6964697479223a7b22726566756e64223a5b7b22626f6479496478223a302c2270657263656e74223a31307d5d7d7d0000000000000000000000000000000000000000000000000000000000",
"executionNode": "0x03493869959c866713c33669ca118e774a30a0e5",
"from": "0x8768cc1edcbc034e92adef905d82da570fcf6c5d",
"gas": "0xf4240",
"gasPrice": "0x3b9aca00",
"hash": "0x5aa009b8a3fdbb5b58943085692600fca19f0d4fe81dc7dc24bec350b9d5be1f",
"input": "0xbe84ce3800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000028076c547f4b19e59b2874cfbdf1b641fd000000000000000000000000000000000ccc2fae18677495396c62244e70f18c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009845ee00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000929b5a520d04a27cce80c5adc80cd8e4fae75f370000000000000000000000000000000000000000000000000000000043200001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000003493869959c866713c33669ca118e774a30a0e500000000000000000000000000000000000000000000000000000000000000156d657673686172653a76303a6d6174636842696473000000000000000000000000000000000000000000000000000000000000000000000000000000000000457b22546f223a22307861613563333331646634373863323665363930393138316663333036656135333566306534636365222c2244617461223a22333074516c673d3d227d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002637b2276657273696f6e223a2276302e31222c22696e636c7573696f6e223a7b22626c6f636b223a223078393834356565227d2c22626f6479223a5b7b227478223a22307866383663383038323031393038323739313839346161356333333164663437386332366536393039313831666333303665613533356630653463636538376231613262633265633530303030383464663462353039363264613039636265326163666338363733326635663038383863323631373163366438343838353833343164376330393663616363303762323463366234316165623862613037326532326162376535666637396466323964393862396236653636386161626463366437363765383734616430303435313163646634363538663630643261222c2263616e526576657274223a66616c73657d2c7b227478223a22307866383663383038323031393038323761626339346161356333333164663437386332366536393039313831666333303665613533356630653463636538376231613262633265633530303030383464663462353039363265613031616134646365653134666462383739353731356465306130636665613738616335663135353931623737643932666439383165666664303434393462663564613031313466653864353033313366626162643064626439366637353763633430383066376131353161633365346266313265623563366337633631323061346435222c2263616e526576657274223a66616c73657d5d2c2276616c6964697479223a7b22726566756e64223a5b7b22626f6479496478223a302c2270657263656e74223a31307d5d7d7d0000000000000000000000000000000000000000000000000000000000",
"nonce": "0x69",
"r": "0x8729f1d09f2316d9b256fa54ae2aca95f98d4af43bb8e6939fe455721e9484e6",
"requestRecord": {
...
},
"s": "0x694d7aa901d795ba22edb5f2ac625adee0043bc20c2d24c6f7d9518195f2bf7a",
"to": "0x929b5a520d04a27cce80c5adc80cd8e4fae75f37",
"transactionIndex": "0x0",
"type": "0x50",
"v": "0x1",
"value": "0x0"
},
"id": 1
}
This response has a couple fields that aren't in your traditional Ethereum transaction type, namely:
confidentialComputeResult
executionNode
requestRecord
To dive deeper into these differences checkout the SUAVE chain specs.
eth
Namespace
Below are the main differences to the eth
namespace
- eth_sendRawTransaction
Creates a new message call transaction or a contract creation for any signed ConfidentialComputeRequest
.
- eth_call
Executes a new message call immediately without creating a transaction on the block chain. It follows the same format as the default eth_call
with two extra parameters:
IsConfidential
: Set to true to execute as a confidential request and access theMEVM
methods.ExecutionAddress
:address
- (optional) The address of the Kettle that performs the execution.
- eth_executionAddress
Returns the list of available addresses in the Kettle to execute the confidential compute request.
The SUAVE SDK makes it easy to interact with the extended RPC and we will be using it in this guide.