Skip to content

Commit da38ccc

Browse files
authored
Merge pull request #797 from Chia-Network/add-curl-rpc-example
add curl rpc example
2 parents 9f59773 + 8aa485b commit da38ccc

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

docs/rpc-reference/rpc.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,22 @@ TLS certificates are used to secure the communication.
4545
The certificates must be used when calling the RPCs from the command line, make sure to use the correct certificates for the services you are calling.
4646
All endpoints are made with POST with JSON data. The response is a JSON dictionary with a success field, which can be true or false.
4747

48+
#### Curl
49+
50+
When using curl commands ensure that the `--insecure` (or `-k`) flag is used since the chia client relies on self-signed certificates defined with the `--cert` and `--key` flags:
51+
An example implementation can be found in the chia docker implementation [here](https://github.com/Chia-Network/chia-docker/blob/d00a988368adb2cc26b9ac24e79e0f109e54b5af/docker-healthcheck.sh#L116).
52+
53+
```
54+
curl --insecure --cert $config_root/config/ssl/full_node/private_full_node.crt \
55+
--key $config_root/config/ssl/full_node/private_full_node.key \
56+
-d '{ "header_hash": "'$hash'" }' -H "Content-Type: application/json" \
57+
-X POST https://localhost:$port/get_block
58+
```
59+
4860
### WebSockets
4961

5062
If you are using the Websockets API, you can go directly through the daemon, which routes requests. Each WebSocket message contains the following fields:
51-
Some examples can be found here: https://github.com/Chia-Mine/chia-agent.
63+
Some examples can be found [here](https://github.com/Chia-Mine/chia-agent).
5264

5365
```json
5466
{
@@ -157,7 +169,7 @@ There is also another client here: https://github.com/freddiecoleman/chia-client
157169

158170
#### C# Example (courtesy of [Kryptomine](https://www.nuget.org/profiles/Kryptomine.ch))
159171

160-
A C# Client can be found on Nuget/Github: https://www.nuget.org/packages/Chia-Client-API
172+
A C# Client can be found on [Nuget/Github](https://www.nuget.org/packages/Chia-Client-API).
161173

162174
```C#
163175
using System;

0 commit comments

Comments
 (0)