diff --git a/docs/build/clients/_category_.json b/docs/build/clients/_category_.json new file mode 100644 index 0000000..8f30b91 --- /dev/null +++ b/docs/build/clients/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Clients", + "position": 3 +} diff --git a/docs/build/clients/daemon-rpc-api/_category_.json b/docs/build/clients/daemon-rpc-api/_category_.json new file mode 100644 index 0000000..f02f0e3 --- /dev/null +++ b/docs/build/clients/daemon-rpc-api/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Dameon RPC API", + "position": 1 +} diff --git a/docs/build/clients/daemon-rpc-api/how-to-call-api.md b/docs/build/clients/daemon-rpc-api/how-to-call-api.md new file mode 100644 index 0000000..97bdecd --- /dev/null +++ b/docs/build/clients/daemon-rpc-api/how-to-call-api.md @@ -0,0 +1,52 @@ +--- +sidebar_position: 2 +--- + +# How to call API + +Making API calls to the Zano Daemon and Wallet is easy, below we'll give you an example to help you get started building on Zano. + +### Using Insomnia + +[Insomnia](https://insomnia.rest/) is a program (similar to [postman](https://www.postman.com/)) that helps you design, debug, and test APIs, heres an example API call to the Zano Daemon using Insomnia. + +![](https://files.readme.io/d5fd42e-insomnia_call.png) + +--- + +### Using NodeJS + +Below is an example of the same API call using NodeJS: + +```javascript +const axios = require("axios"); + +async function callAPI() { + try { + const url = "http://127.0.0.1:11211/json_rpc"; + const requestData = { + jsonrpc: "2.0", + id: 0, + method: "getbalance", + }; + + const response = await axios.post(url, requestData); + console.log(response.data); + // Process the response data as needed + } catch (error) { + console.error("Error:", error.message); + } +} + +callAPI(); +``` + +### Summary + +When running the Daemon and Wallet in RPC mode locally, the following URL, whether using something like Insomnia or NodeJS or some other language, you access the daemon with the following URL: + +``` +http://127.0.0.1:11211/json_rpc +``` + +Have fun building on Zano! diff --git a/docs/build/clients/daemon-rpc-api/methods/_category_.json b/docs/build/clients/daemon-rpc-api/methods/_category_.json new file mode 100644 index 0000000..fcab66e --- /dev/null +++ b/docs/build/clients/daemon-rpc-api/methods/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "HTTP Methods", + "position": 3 +} diff --git a/docs/build/clients/daemon-rpc-api/methods/getblockcount.md b/docs/build/clients/daemon-rpc-api/methods/getblockcount.md new file mode 100644 index 0000000..04fb4eb --- /dev/null +++ b/docs/build/clients/daemon-rpc-api/methods/getblockcount.md @@ -0,0 +1,28 @@ +### Request + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "method": "getblockcount" +} +``` + +--- + +### Response + +```json +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "count": 2114936, + "status": "OK" + } +} +``` + +### Response information + +- count - unsigned integer; total number of blocks in the blockchain, including genesis block at height zero. diff --git a/docs/build/clients/daemon-rpc-api/overview.md b/docs/build/clients/daemon-rpc-api/overview.md new file mode 100644 index 0000000..13546b5 --- /dev/null +++ b/docs/build/clients/daemon-rpc-api/overview.md @@ -0,0 +1,76 @@ +--- +sidebar_position: 1 +--- + +# Overview + +Welcome to the Zano API documentation! As a digital currency enthusiast, developer, or end user, we know how important it is for you to have a clear, comprehensive guide to our API. That's why we've designed our documentation to be as accessible and easy to understand as possible. + +Our aim with this documentation is to help you harness the full potential of Zano's feature-rich platform, allowing you to integrate, innovate, and build on top of Zano's powerful privacy-oriented blockchain. + +Read more on the JSON-RPC 2.0 Specification [HERE](https://www.jsonrpc.org/specification) + +## Formatting example + +Each API endpoint will have an example of the required JSON body to be sent with the POST request, an example response and additional information such as types and additional information regarding the parameters sent and received when necessary. + +Additionally, endpoints will be grouped according to whether they call the Daemon or the wallet as well as the scope in which they function such as Marketplace, confidential assets, contracts etc. + +### Request + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "method": "getbalance" +} +``` + +### Response + +```json +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "balance": 50000000033, + "unlocked_balance": 50000000033 + } +} +``` + +--- + +## Running Daemon and Wallet in RPC mode + +In order to send JSON requests, both the Zano Daemon and Wallet must be ran in RPC mode, for additional info on how to do this, for wallet visit [Here](https://docs.zano.org/docs/json-rpc-busy-response-2), and for the Daemon visit [Here](https://docs.zano.org/docs/how-to-connect-daemon-rpc-api). But we'll give a quick HOWTO below: + +> 🚧 All examples below are based on the assumption that the daemon is listening for RPC at 127.0.0.1:11211 + +### How to run Daemon in RPC mode + +> 📘 In order to interact with the Marketplace API, you must include the following flag: '--enable-offers-service' + +```Text console +./zanod --rpc-bind-ip 127.0.0.1 --rpc-bind-port 11211 --enable-offers-service +``` + +### Daemon flags + +- rpc-bind-ip — IP address to bind RPC server to (127.0.0.1 will be used if not specified); +- rpc-bind-port — TCP port for RPC server (11211 is default); + +--- + +### How to run Wallet in RPC mode + +```Text console +./simplewallet --wallet-file example.wallet --password password --rpc-bind-ip 127.0.0.1 --rpc-bind-port 11212 --daemon-address 127.0.0.1:11211 +``` + +### Daemon flags + +- wallet-file - name of wallet file to use +- password - wallets password +- rpc-bind-port - TCP port for wallet RPC server +- rpc-bind-ip - IP and PORT of the daemon diff --git a/docs/build/get-started/_category_.json b/docs/build/get-started/_category_.json new file mode 100644 index 0000000..47a62bb --- /dev/null +++ b/docs/build/get-started/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Get Started", + "position": 2 +} diff --git a/docs/build/get-started/overview.md b/docs/build/get-started/overview.md new file mode 100644 index 0000000..07dd0c5 --- /dev/null +++ b/docs/build/get-started/overview.md @@ -0,0 +1 @@ +# Overview diff --git a/docs/build/overview.md b/docs/build/overview.md new file mode 100644 index 0000000..5bc6931 --- /dev/null +++ b/docs/build/overview.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 1 +--- + +# Overview diff --git a/docs/learn/introduction/what-is-zano.md b/docs/learn/get-started/what-is-zano.md similarity index 100% rename from docs/learn/introduction/what-is-zano.md rename to docs/learn/get-started/what-is-zano.md diff --git a/docs/mine/overview.md b/docs/mine/overview.md new file mode 100644 index 0000000..726d31e --- /dev/null +++ b/docs/mine/overview.md @@ -0,0 +1 @@ +# Mine overview diff --git a/docs/stake/overview.md b/docs/stake/overview.md new file mode 100644 index 0000000..0461365 --- /dev/null +++ b/docs/stake/overview.md @@ -0,0 +1 @@ +# Stake overview diff --git a/docs/use/getting-started/wallet-setup.md b/docs/use/get-started/wallet-setup.md similarity index 100% rename from docs/use/getting-started/wallet-setup.md rename to docs/use/get-started/wallet-setup.md diff --git a/sidebars.js b/sidebars.js index 0821960..944e3ec 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,42 +1,33 @@ const sidebars = { learnSidebar: [ - "learn/intro", { - type: "category", - label: "Introduction", - items: ["learn/introduction/what-is-zano"], + type: "autogenerated", + dirName: "learn", }, ], useSidebar: [ - "use/intro", { - type: "category", - label: "Getting Started", - items: ["use/getting-started/wallet-setup"], + type: "autogenerated", + dirName: "use", }, ], buildSidebar: [ - "learn/intro", { - type: "category", - label: "Introduction", - items: ["learn/introduction/what-is-zano"], + type: "autogenerated", + dirName: "build", }, ], + mineSidebar: [ - "learn/intro", { - type: "category", - label: "Introduction", - items: ["learn/introduction/what-is-zano"], + type: "autogenerated", + dirName: "mine", }, ], stakeSidebar: [ - "learn/intro", { - type: "category", - label: "Introduction", - items: ["learn/introduction/what-is-zano"], + type: "autogenerated", + dirName: "stake", }, ], };