From ff123cfa33f9d89cac37b372c2fccec7e07663b2 Mon Sep 17 00:00:00 2001 From: Tim McMackin Date: Fri, 16 Feb 2024 12:49:54 -0500 Subject: [PATCH] Topic about sources of information available to developers and dApps (#313) * Topic about sources of information available to developers and dApps * Can get current balance --- docs/developing/information.md | 48 ++++++++++++++++++++++++++++++++++ sidebars.js | 8 +++--- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 docs/developing/information.md diff --git a/docs/developing/information.md b/docs/developing/information.md new file mode 100644 index 000000000..03ad803f1 --- /dev/null +++ b/docs/developing/information.md @@ -0,0 +1,48 @@ +--- +title: Getting information about the blockchain +authors: Tim McMackin +last_update: + date: 8 February 2024 +--- + +Developers and dApps can get information about the Tezos blockchain, such as account balances, from these sources: + +## The Octez client + +The [The Octez client](./octez-client) provides information about accounts, addresses, and many other things. +For example, you can get the balance of an account with this command: + +```bash +octez-client get balance for tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx +``` + +## The RPC protocol + +The [RPC](../architecture/rpc) protocol provides information about the blockchain that nodes use to communicate with each other. +This data is not always in the format that developers and dApps need. +For example, the RPC interface does not provide a way to get information about a specific operation by its hash. + +You can get some information about accounts, contracts, and other things from RPC requests. +For example, this RPC request gets the current balance of an account: + +```bash +curl -X GET https://rpc.ghostnet.teztnets.com/chains/main/blocks/head/context/contracts/tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx/balance +``` + +## Indexers + +Indexers are off-chain applications that retrieve blockchain data, process it, and store it in a way that makes it easier to search and use. +For example, you can use the [TZKT API](https://api.tzkt.io/) to get the recent operations an account made with this request: + +```bash +curl -X GET https://api.ghostnet.tzkt.io/v1/accounts/tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx/operations +``` + +For more information, see [Indexers](./information/indexers). + +## Block explorers + +Block explorers use data from indexers to show information in a human-friendly interface. +For example, this link shows information about a contract, including its current storage, entrypoints, and transaction history: https://better-call.dev/ghostnet/KT1R4i4qEaxF7v3zg1M8nTeyrqk8JFmdGLuu/operations + +For more information about block explorers, see [Block explorers](./information/block-explorers). diff --git a/sidebars.js b/sidebars.js index ea244c79c..790e5f373 100644 --- a/sidebars.js +++ b/sidebars.js @@ -88,10 +88,10 @@ const sidebars = { { type: 'category', label: 'Getting information about the blockchain', - // link: { // TODO - // id: 'developing/information', - // type: 'doc', - // }, + link: { + id: 'developing/information', + type: 'doc', + }, items: [ { type: 'category',