1Open the playground
Go to services.divi.domains/rpc/. The page needs no account and no wallet. It sends your questions to the public Divi RPC service, the same one Explorer 2.0 uses.
The landing page says Divi 3.0.0 RPC Documentation and shows three badges: 41 Methods, Interactive Testing and Code Examples. Along the top you will see:
- a red MAINNET badge, which tells you which network you are asking;
- a testnet button, which opens the testnet version of the page;
- a Resources menu with links to the other Divi services.
At the bottom of the left-hand list is the address every request goes to:
Endpoint: https://services.divi.domains/api/rpc/
On a phone held upright, the method list fills the screen. Tap a method to open its page, and tap ← All methods at the top to go back to the list.
2Find a method
The left-hand list groups the 41 methods by what they do:
- AddressIndex, 5 methods: balances and history of an address.
- Blockchain, 15: blocks, heights and the chain itself.
- General, 2: node-wide information. The public service turns both away; see section 7.
- Masternode, 5: masternode lists and counts.
- Mining, 1: staking and mining figures.
- Network, 5: peers and traffic.
- RawTransactions, 3: reading and decoding transactions.
- Sync, 2: masternode sync state. The public service turns both away too.
- Utility, 3: checking addresses and messages.
Click a group to open it, or type part of a name into Search methods... at the top of the list. Search matches method names only, so type block rather than a description such as "height".
3Read the method page
Click getblockhash under Blockchain. The right side of the page now shows, from top to bottom:
- The group and name, with a one-line description of what the method does.
- Parameters: a table of what you must or may send, with each one's name, type, whether it is required and what it means. Methods that take nothing say No parameters required.
- Returns: what the answer will look like.
- Try It: the box where you send a real request.
For getblockhash, the one parameter is a block height, and the answer is that block's hash.
4Send your first request
Try It has four tabs: Playground, cURL, Python and Javascript. Stay on Playground.
- Under Parameters, replace the example
4270000in the height box with4263840. The Form view gives you one box per parameter. The JSON view shows the same thing as a list, such as[4263840], which you can edit directly. - Press Send Request. It reads Sending... for a moment.
- The answer appears under Response.
{
"error": null,
"id": 1792666420461,
"result": "33bee78b…b3b3"
}
The result is the hash of block 4,263,840. It is shortened here; yours is 64 characters long. The id is a timestamp the page adds, and you can ignore it. Press Copy Result to copy the answer.
Now try a method with no parameters. Open getblockcount and press Send Request. The result is the current height of mainnet, which grows by about one every minute.
Paste the hash you got into Explorer 2.0. It should open block 4,263,840. To learn what that page shows, see read a block.
5Replace the example values
Methods that take parameters open with an example already filled in. The examples are real values from the chain, such as block 4,270,000 and one of its transactions, so you can press Send Request straight away and get a real answer. The testnet page fills in testnet values instead.
- The address methods, such as getaddressbalance, take one JSON object holding a list of addresses, such as
{"addresses": ["D7p3b1P4HPZsi9buYWMC2DJTEPtJWR5zf6"]}. - verifymessage answers
true: its example message was signed for this page with a throwaway key. - getmasternodestatus answers
This is not a masternode. That is correct: the node behind the public service is not a masternode.
Then put in values of your own. Some you can use:
- A height:
4263840. - A block hash: the one
getblockhashjust gave you. - A transaction ID: open any block in Explorer 2.0 and copy one from its list. See read a transaction.
- An address: your own. The playground only reads public information, so this is safe.
6Copy the request as code
Once a request works, click the cURL, Python or Javascript tab. Each one shows the same request, with the parameters you typed, ready to run outside the browser. Press Copy to take it. The cURL tab for the request above looks like this:
curl -X POST https://services.divi.domains/api/rpc/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "curltest",
"method": "getblockhash",
"params": [
4263840
]
}'
The Python version needs the requests library. The JavaScript version uses fetch and runs in a browser console or in Node 18 and later. To go further with scripts, read query the chain yourself and talk to a Divi node from Python and JavaScript.
7What the playground will not answer
The public RPC service only answers methods that are safe for anyone to call. Nine methods listed in the playground are turned away, including everything under General and Sync:
getinfo,help,getpeerinfo,getnettotalsgettxoutsetinfo,verifychain,reverseblocktransactionsmnsync,spork
In the list they are marked not on public service. Their pages have no Send Request button and say why instead. If you send one from your own code, the answer is:
{"result":null,"error":{"code":-32601,"message":"Method not allowed: getinfo"},"id":null}
That is not a fault in your request. These methods are either heavy on the node or describe the node itself rather than the chain. To use them, run your own node and ask it with divi-cli.
One more method, getchaintips, is marked the same way on mainnet only. The mainnet node knows thousands of old side branches, and listing them takes longer than the service's 30-second limit. It works on the testnet page. The other 31 methods answer on mainnet, and 32 on testnet.
The playground never touches a wallet. It has no methods for sending coins, reading a balance from a wallet, or unlocking anything, and it never asks for a password or recovery phrase. If a page that claims to be the playground asks for one, close it.
8Switch to testnet
Press the testnet button at the top. It opens services.divi.domains/testnet/rpc/, the same playground pointed at testnet. The endpoint at the bottom of the list changes to:
Endpoint: https://services.divi.domains/api/testnet/rpc/
Testnet coins have no value, so it is the place to practise. The examples on this page are testnet values, such as block 360,000 and a testnet address starting with y. To get testnet coins of your own, see the testnet faucet.
Heights, hashes and transactions on one network do not exist on the other. A hash copied from mainnet gives Block not found on testnet.
If something goes wrong
| You see | What it means |
|---|---|
Method not allowed: … | The public service does not answer that method. See section 7. |
Block not found | The hash has a typo or belongs to the other network. |
Invalid address | A testnet address sent to mainnet, or the other way round. Mainnet addresses start with D. |
value is type str, expected int | A number was sent in quotes in the JSON view. Write [4263840], not ["4263840"]. |
| Only the method list is visible | On a phone, tap a method name to open it. ← All methods brings the list back. |
| Send Request stays on Sending... | Your connection or the service is slow. Wait, then reload the page and try again. |
Still stuck? Ask the Divi chatbot, or see all tutorials.