diff --git a/.gitbook/assets/63f8d9a63907e9f382701bd1_BITCOIN.png b/.gitbook/assets/63f8d9a63907e9f382701bd1_BITCOIN.png new file mode 100644 index 0000000..761d54a Binary files /dev/null and b/.gitbook/assets/63f8d9a63907e9f382701bd1_BITCOIN.png differ diff --git a/.gitbook/assets/Bitcoin.svg.png b/.gitbook/assets/Bitcoin.svg.png new file mode 100644 index 0000000..8eea6bf Binary files /dev/null and b/.gitbook/assets/Bitcoin.svg.png differ diff --git a/.gitbook/assets/Btc2.png b/.gitbook/assets/Btc2.png new file mode 100644 index 0000000..c8b7455 Binary files /dev/null and b/.gitbook/assets/Btc2.png differ diff --git a/.gitbook/assets/Screenshot 2023-05-09 at 16.21.52.png b/.gitbook/assets/Screenshot 2023-05-09 at 16.21.52.png new file mode 100644 index 0000000..03fbdb9 Binary files /dev/null and b/.gitbook/assets/Screenshot 2023-05-09 at 16.21.52.png differ diff --git a/.gitbook/assets/Screenshot 2023-05-09 at 16.24.41.png b/.gitbook/assets/Screenshot 2023-05-09 at 16.24.41.png new file mode 100644 index 0000000..4826f80 Binary files /dev/null and b/.gitbook/assets/Screenshot 2023-05-09 at 16.24.41.png differ diff --git a/.gitbook/assets/image.png b/.gitbook/assets/image.png new file mode 100644 index 0000000..ca3e171 Binary files /dev/null and b/.gitbook/assets/image.png differ diff --git a/.gitbook/assets/logo.png b/.gitbook/assets/logo.png new file mode 100644 index 0000000..45b7424 Binary files /dev/null and b/.gitbook/assets/logo.png differ diff --git a/.gitbook/assets/openapi (1).yaml b/.gitbook/assets/openapi (1).yaml new file mode 100644 index 0000000..1a0bb63 --- /dev/null +++ b/.gitbook/assets/openapi (1).yaml @@ -0,0 +1,221 @@ +openapi: 3.1.0 +servers: + - url: 'https://api.tatum.io' +info: + version: 1.1.1 + title: Data API +tags: + - description: | +

Tatum Data API is a comprehensive solution designed for developers to easily access on-chain data such as token balances, NFT owners, and metadata, all through a suite of user-friendly APIs.

+

With Tatum Data API, developers can seamlessly integrate blockchain functionality into their applications, enabling them to deliver innovative, web3 solutions. This powerful indexing solution supports multiple blockchains, ensuring developers have access to the latest data across different networks.

+

Tatum Data API offers a reliable, scalable, and cost-effective way for developers to access on-chain data, making it an essential tool for any blockchain project.

+ name: Data API +paths: + /v3/data/collections: + get: + description: | +

10 credits per API call

+

Get all NFTs (ERC-721 and ERC-1155) and multitokens (ERC-1155 only) of your favorite collections! Our API lets you search for all tokens on:

+ +

To get started:

+ + operationId: GetCollections + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: | + The blockchain addresses of the collections. + It is possible to enter list of up to 10 addresses as a comma separated string. + in: query + name: collectionAddresses + required: true + schema: + type: string + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2' + - description: | + The option to select only specific token types. + It is possible to enter list of multiple types as a comma separated string. + Use nft (includes ERC-721 and ERC-1155) or multitoken (ERC-1155 only). + in: query + name: tokenTypes + schema: + type: string + example: 'nft' + enum: + - nft + - multitoken + - description: The option to exclude metadata from the response. + in: query + name: excludeMetadata + schema: + $ref: '#/components/schemas/ExcludeMetadata' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: array + items: + type: object + properties: + chain: + $ref: '#/components/schemas/Chain' + tokenId: + $ref: '#/components/schemas/TokenId' + tokenAddress: + $ref: '#/components/schemas/TokenAddress' + tokenType: + $ref: '#/components/schemas/TokenType' + metadataURI: + $ref: '#/components/schemas/NftMetadataURI' + metadata: + $ref: '#/components/schemas/NftMetadata' + description: OK + 400: &API400 + content: + application/json: + schema: + $ref: '#/components/schemas/Error400' + description: Bad Request. Validation failed for the given object in the HTTP Body or Request parameters. + 401: &API401 + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Error401NotActive' + - $ref: '#/components/schemas/Error401Invalid' + description: Unauthorized. Not valid or inactive subscription key present in the HTTP Header. + 403: &API403 + description: Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions. + content: + application/json: + schema: + $ref: '#/components/schemas/Error403' + 500: &API500 + content: + application/json: + schema: + $ref: '#/components/schemas/Error500' + description: Internal server error. There was an error on the server during the processing of the request. + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get tokens from a collection + tags: + - Data API +components: + securitySchemes: + X-Api-Key: + description: | + To maintain the highest security level, Tatum requires X-API-Key HTTP header. + This X-API-Key represents identification of the plan and can be used by 1 developer or per environment. + Each X-API-Key is bound to the testnet or mainnet version of blockchains. + in: header + name: x-api-key + type: apiKey + schemas: + Chain: + type: string + description: Name of the chain. + example: 'ethereum-sepolia' + ChainEnum: + type: string + example: ethereum + enum: + - ethereum + - ethereum-sepolia + - celo + - celo-testnet + - bsc + - bsc-testnet + - polygon + - polygon-mumbai + ChainUtxoEnum: + type: string + example: bitcoin + enum: + - bitcoin + - bitcoin-testnet + - litecoin + - litecoin-testnet + - doge + - doge-testnet + - cardano + - cardano-preprod + TokenId: + type: string + description: ID of the token. + maxLength: 78 + example: '123' + format: uint256 + TokenAddress: + type: string + description: Contract address of the token. + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2' + TokenType: + type: string + description: Type of the token + example: 'nft' + ExcludeMetadata: + type: boolean + example: true + NftMetadataURI: + type: string + description: | + Metadata URL of the token. This data doesn't have to be present. + The safest way to obtain them in that case is from the NFT Contract.tokenURI() method call. + example: 'ipfs://QmXFpaS3S7CkLZvihLFA9JbawKdqhjg8dJeDkPntmkD2Pc' + NftMetadata: + type: object + description: | + Metadata scheme obtained from the url. This data don't have to be present. + The safest way to obtain them in that case is from the NFT Contract.tokenURI() method call. + example: + { + 'name': 'Example NFT name', + 'description': 'Example NFT description', + 'image': 'https://s3-us-east-1.amazonaws.com/example-image.jpg', + } + BlockNumber: + type: number + example: 16641547 + minimum: 0 + PageSize: + type: number + example: 10 + minimum: 1 + maximum: 50 + Offset: + type: number + example: 1 + PrevPage: + type: string + description: Cursor pagination, used to get previous page of results. + example: TBD + NextPage: + type: string + description: Cursor pagination, used to get next page of results. + example: TBD diff --git a/.gitbook/assets/openapi (2).yaml b/.gitbook/assets/openapi (2).yaml new file mode 100644 index 0000000..a680c91 --- /dev/null +++ b/.gitbook/assets/openapi (2).yaml @@ -0,0 +1,1523 @@ +openapi: 3.1.0 +servers: + - url: 'https://api.tatum.io' +info: + version: 1.1.1 + title: Data API +tags: + - description: | +

Tatum Data API is a comprehensive solution designed for developers to easily access on-chain data such as token balances, NFT owners, and metadata, all through a suite of user-friendly APIs.

+

With Tatum Data API, developers can seamlessly integrate blockchain functionality into their applications, enabling them to deliver innovative, web3 solutions. This powerful indexing solution supports multiple blockchains, ensuring developers have access to the latest data across different networks.

+

Tatum Data API offers a reliable, scalable, and cost-effective way for developers to access on-chain data, making it an essential tool for any blockchain project.

+ name: Data API +paths: + /v3/data/collections: + get: + description: | +

10 credits per API call

+

Get all NFTs (ERC-721 and ERC-1155) and multitokens (ERC-1155 only) of your favorite collections! Our API lets you search for all tokens on:

+ +

To get started:

+ + operationId: GetCollections + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: | + The blockchain addresses of the collections. + It is possible to enter list of up to 10 addresses as a comma separated string. + in: query + name: collectionAddresses + required: true + schema: + type: string + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2' + - description: | + The option to select only specific token types. + It is possible to enter list of multiple types as a comma separated string. + Use nft (includes ERC-721 and ERC-1155) or multitoken (ERC-1155 only). + in: query + name: tokenTypes + schema: + type: string + example: 'nft' + enum: + - nft + - multitoken + - description: The option to exclude metadata from the response. + in: query + name: excludeMetadata + schema: + $ref: '#/components/schemas/ExcludeMetadata' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: array + items: + type: object + properties: + chain: + $ref: '#/components/schemas/Chain' + tokenId: + $ref: '#/components/schemas/TokenId' + tokenAddress: + $ref: '#/components/schemas/TokenAddress' + tokenType: + $ref: '#/components/schemas/TokenType' + metadataURI: + $ref: '#/components/schemas/NftMetadataURI' + metadata: + $ref: '#/components/schemas/NftMetadata' + description: OK + 400: &API400 + content: + application/json: + schema: + $ref: '#/components/schemas/Error400' + description: Bad Request. Validation failed for the given object in the HTTP Body or Request parameters. + 401: &API401 + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Error401NotActive' + - $ref: '#/components/schemas/Error401Invalid' + description: Unauthorized. Not valid or inactive subscription key present in the HTTP Header. + 403: &API403 + description: Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions. + content: + application/json: + schema: + $ref: '#/components/schemas/Error403' + 500: &API500 + content: + application/json: + schema: + $ref: '#/components/schemas/Error500' + description: Internal server error. There was an error on the server during the processing of the request. + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get tokens from a collection + tags: + - Data API + /v3/data/metadata: + get: + description: | +

5 credits per API call

+

Get metadata of NFTs (ERC-721 and ERC-1155) or multitokens (ERC-1155 only) by IDs for a given token address! Our API lets you search for all tokens on:

+ +

To get started:

+ + operationId: GetMetadata + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: The blockchain address of the NFT to get metadata for. + in: query + name: tokenAddress + required: true + schema: + $ref: '#/components/schemas/TokenAddress' + - description: | + The IDs of the tokens to get metadata for. + It is possible to enter list of multiple IDs as a comma separated string. + in: query + name: tokenIds + required: true + schema: + type: string + example: '90,123' + responses: + 200: + content: + application/json: + schema: + type: array + items: + type: object + properties: + chain: + $ref: '#/components/schemas/Chain' + tokenId: + $ref: '#/components/schemas/TokenId' + tokenAddress: + $ref: '#/components/schemas/TokenAddress' + tokenType: + $ref: '#/components/schemas/TokenType' + metadataURI: + $ref: '#/components/schemas/NftMetadataURI' + metadata: + $ref: '#/components/schemas/NftMetadata' + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get token metadata + tags: + - Data API + /v3/data/balances: + get: + description: | +

50 credits per API call

+

Get balances of fungible tokens (ERC-20), NFTs (ERC-721 and ERC-1155) or multitokens (ERC-1155 only) for a specific wallet address on the following blockchains:

+ +

To get started:

+ + operationId: GetBalances + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: | + The blockchain public wallet addresses. + It is possible to enter list of up to 10 addresses as a comma separated string. + in: query + name: addresses + required: true + schema: + type: string + description: Wallet address + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2,0xAe680Ed83baF08a8028118Bd19859F8a0E744cc6' + - description: | + The option to select only specific token types. + It is possible to enter list of multiple types as a comma separated string. + Use fungible (ERC-20), nft (includes ERC-721 and ERC-1155) or multitoken (ERC-1155 only). + in: query + name: tokenTypes + schema: + type: string + example: nft,multitoken + enum: + - nft + - multitoken + - fungible + - description: The option to exclude metadata from the response. + in: query + name: excludeMetadata + schema: + $ref: '#/components/schemas/ExcludeMetadata' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: object + properties: + result: + type: array + description: List of all balances for all selected tokens. + example: + [ + { + 'chain': 'ethereum-mainnet', + 'address': '0xae680ed83baf08a8028118bd19859f8a0e744cc6', + 'balance': '283333333333333333333', + 'tokenAddress': '0x45dd18c5e0fa701abff449f6542aa53e258710b4', + 'lastUpdatedBlockNumber': 14792747, + 'type': 'fungible', + }, + { + 'chain': 'ethereum-mainnet', + 'address': '0xae680ed83baf08a8028118bd19859f8a0e744cc6', + 'balance': '8690000000000000000', + 'tokenAddress': '0x090f21a84a0e9674c1828aca1db69ec8ae1454e8', + 'lastUpdatedBlockNumber': 15204015, + 'type': 'fungible', + }, + { + 'chain': 'ethereum-mainnet', + 'address': '0xae680ed83baf08a8028118bd19859f8a0e744cc6', + 'balance': '1', + 'tokenAddress': '0xa58b5224e2fd94020cb2837231b2b0e4247301a6', + 'lastUpdatedBlockNumber': 15326272, + 'type': 'multitoken', + 'tokenId': '2605', + 'metadataURI': 'https://www.cryptovoxels.com/c/1/2605', + 'metadata': + { + 'url': 'https://www.cryptovoxels.com/c/1/2605', + 'name': 'Link Marine Helmet', + 'description': 'Chainlink Marine Helmet, give Sergey Nazarov your love.', + }, + }, + ] + prevPage: + $ref: '#/components/schemas/PrevPage' + nextPage: + $ref: '#/components/schemas/NextPage' + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get balances of addresses + tags: + - Data API + /v3/data/owners: + get: + description: | +

20 credits per API call

+

Get all addresses that own your favorite token (ERC-20, ERC-721 or ERC-1155)! Our API lets you search for all token owners on:

+ +

To get started:

+ + operationId: GetOwners + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: The blockchain address of the token (NFT collection or any fungible token). + in: query + name: tokenAddress + required: true + schema: + $ref: '#/components/schemas/TokenAddress' + - description: The ID of a specific NFT token. + in: query + name: tokenId + schema: + $ref: '#/components/schemas/TokenId' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: array + description: List of all addresses that own a token in a specified collection. + example: + [ + "0x0bbf9f25c863fdf19e645c96280004d24f43cb38", + "0x0bd1b3b12db943f2310a4e53481ae97f8b6c2a75", + "0x281f4727081ab4a066f321fd6fc8dd0dc063e9fd", + "0x681cbae1c41e5eec8411dd8e009fa71f81d03f7f", + "0x7b49a05c15702bbe1db534058ebcc9e950c474ca", + ] + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get owners of a token + tags: + - Data API + /v3/data/owners/address: + get: + description: | +

1 credit per API call

+

Check if wallet address owns any specified token (ERC-20, ERC-721 or ERC-1155) on the following blockchains:

+ +

To get started:

+ + operationId: CheckOwner + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: The blockchain address of the wallet. + in: query + name: address + required: true + schema: + type: string + example: '0x10d8bac9a6901698b3749fe336bbd1385c1f98f2' + - description: The blockchain address of the token (NFT collection or any fungible token). + in: query + name: tokenAddress + required: true + schema: + $ref: '#/components/schemas/TokenAddress' + - description: The ID of a specific NFT token. + in: query + name: tokenId + schema: + $ref: '#/components/schemas/TokenId' + responses: + 200: + content: + application/json: + schema: + type: boolean + example: true + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Check owner of token + tags: + - Data API + /v3/data/transactions: + get: + description: | +

20 credits per API call

+

Get transactions on the following blockchains:

+ +

To get started:

+ + operationId: GetTransactions + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: | + The blockchain public wallet addresses. + It is possible to enter list of up to 10 addresses as a comma separated string. + in: query + name: addresses + required: false + schema: + type: string + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2,0xAe680Ed83baF08a8028118Bd19859F8a0E744cc6' + - description: | + The option to filter transaction based on types. + It is possible to enter list of multiple types as a comma separated string. + Use fungible (ERC-20), nft (ERC-721 and ERC-1155), multitoken (ERC-1155), native or internal. + in: query + name: transactionTypes + schema: + type: string + example: fungible,nft + enum: + - fungible + - nft + - multitoken + - native + - internal + - description: The option to filter transaction based on subtype. + in: query + name: transactionSubtype + schema: + type: string + example: incoming + enum: + - incoming + - outgoing + - zero-transfer + - description: Address of a token (smart contract). + in: query + name: tokenAddress + schema: + $ref: '#/components/schemas/TokenAddress' + - description: ID of a token. + in: query + name: tokenId + required: false + schema: + $ref: '#/components/schemas/TokenId' + - description: Transactions from this block onwards will be included. + in: query + name: blockFrom + required: false + schema: + $ref: '#/components/schemas/BlockNumber' + - description: Transactions up to this block will be included. + in: query + name: blockTo + required: false + schema: + $ref: '#/components/schemas/BlockNumber' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: object + properties: + result: + type: array + description: List of all selected transactions. + example: + [ + { + "chain": "ethereum-mainnet", + "hash": "0x549447710026cef714da21fb29cbfae1f689bd3246f2fa0a5081149c4aeb3bb3", + "address": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "blockNumber": 16819465, + "transactionIndex": 84, + "transactionType": "fungible", + "transactionSubtype": "incoming", + "amount": "0.990923706372082143", + "timestamp": 1678715303000, + "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "counterAddress": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852" + }, + { + "chain": "ethereum-mainnet", + "hash": "0x549447710026cef714da21fb29cbfae1f689bd3246f2fa0a5081149c4aeb3bb3", + "address": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "blockNumber": 16819465, + "transactionIndex": 84, + "transactionType": "native", + "transactionSubtype": "zero-transfer", + "amount": "0", + "timestamp": 1678715303000, + "counterAddress": "0xd841e3d110cbe4aedb04c9dcc3572ec306bda2f9" + }, + { + "chain": "ethereum-mainnet", + "hash": "0x4e0268c1e67575fd09047e006dd5ad26df402d85fa159e10639e9ea7c2d428f7", + "address": "0x0000000000000000000000000000000000000000", + "blockNumber": 16819465, + "transactionIndex": 119, + "transactionType": "nft", + "transactionSubtype": "outgoing", + "amount": "-1", + "timestamp": 1678715303000, + "tokenId": "33", + "tokenAddress": "0x3bcad8a734e923133d2c8c3fd4747d47e12d4f79", + "counterAddress": "0x84300dcc7ca9cf447e886fa17c11fa22557d1af0" + } + ] + prevPage: + $ref: '#/components/schemas/PrevPage' + nextPage: + $ref: '#/components/schemas/NextPage' + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get transactions + tags: + - Data API + /v3/data/transactions/hash: + get: + description: | +

5 credits per API call

+

Get transactions by hash on the following blockchains:

+ +

To get started:

+ + operationId: GetTransactionsByHash + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: Hash of the transaction. + in: query + name: hash + required: true + schema: + type: string + example: '0xd49f8d6544f2822522886a02f4787a56ea93bbd636bfdf81d6795a10553d7118' + responses: + 200: + content: + application/json: + schema: + type: array + description: List of all transaction data. + example: + [ + { + "chain": "ethereum-mainnet", + "hash": "0xd49f8d6544f2822522886a02f4787a56ea93bbd636bfdf81d6795a10553d7118", + "address": "0x9757f2d2b135150bbeb65308d4a91804107cd8d6", + "blockNumber": 16410533, + "transactionIndex": 139, + "transactionType": "native", + "transactionSubtype": "incoming", + "amount": "0.000000000000000039", + "timestamp": 1673765531000, + "counterAddress": "0x47405b78a7f381842c4f3d6b2d630dc390f3de9f" + }, + { + "chain": "ethereum-mainnet", + "hash": "0xd49f8d6544f2822522886a02f4787a56ea93bbd636bfdf81d6795a10553d7118", + "address": "0x47405b78a7f381842c4f3d6b2d630dc390f3de9f", + "blockNumber": 16410533, + "transactionIndex": 139, + "transactionType": "native", + "transactionSubtype": "outgoing", + "amount": "-0.000000000000000039", + "timestamp": 1673765531000, + "counterAddress": "0x9757f2d2b135150bbeb65308d4a91804107cd8d6" + } + ] + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get transactions by hash + tags: + - Data API + /v3/data/events: + get: + description: | +

20 credits per API call

+

Get all events on given addresses and / or in the requested block range on the following blockchains:

+ +

To get started:

+ +

As noted above, aside from general info and hashed event data, the API also decodes them for you in case you filter by one of the following supported event types:

+ + operationId: GetEvents + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: | + The blockchain addresses of the contracts where requested events were emitted. + It is possible to enter list of up to 10 addresses as a comma separated string. + in: query + name: contractAddresses + required: true + schema: + type: string + example: '0xd4307e0acd12cf46fd6cf93bc264f5d5d1598792' + - description: First block to start from (including this one). + in: query + name: blockFrom + required: true + schema: + $ref: '#/components/schemas/BlockNumber' + - description: Last block to finish on (including this one). + in: query + name: blockTo + required: true + schema: + $ref: '#/components/schemas/BlockNumber' + - description: | + The type of events that should be returned, which comes with decoded data in the response + (cannot be used together with signatures). + in: query + name: eventType + required: true + schema: + type: string + example: tokenTransfer + enum: + - tokenTransfer + - multitokenTransfer + - stablecoinTransfer + - uniswapTrade + - description: | + The types of events that should be returned, specified by hashed signature + (cannot be used together with eventType). + It is possible to enter list of multiple signatures as a comma separated string. + in: query + name: signatures + schema: + type: string + example: '0x0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c371129' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: array + examples: + tokenTransfer: + value: + [ + { + "chain": "ethereum-mainnet", + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "blockNumber": 16719956, + "timestamp": 1677506087000, + "decoded": { + "label": "Transfer(address,address,uint256)", + "type": "fungible", + "subtype": "transfer", + "from": "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", + "to": "0xb3d994978d2bc50d2ce74c45fcd923e7c9c06730", + "decimals": 18, + "value": "0.030041143652018106" + }, + "raw": { + "topic_0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "topic_1": "0x000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc", + "topic_2": "0x000000000000000000000000b3d994978d2bc50d2ce74c45fcd923e7c9c06730", + "data": "0x000000000000000000000000000000000000000000000000006aba42d00667ba" + }, + "txHash": "0x0ca14958f40d348bef24cd259a185c16867479b5f506e329063c4bb0b195a643", + "txIndex": 144, + "logIndex": 231 + }, + { + "chain": "ethereum-mainnet", + "address": "0xd4307e0acd12cf46fd6cf93bc264f5d5d1598792", + "blockNumber": 16719955, + "timestamp": 1677506075000, + "decoded": { + "label": "Transfer(address,address,uint256)", + "type": "nft", + "subtype": "mint", + "from": "0x0000000000000000000000000000000000000000", + "to": "0x192038b97fc5a926367f84743533ad63250be09b", + "tokenId": "370349" + }, + "raw": { + "topic_0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "topic_1": "0x0000000000000000000000000000000000000000000000000000000000000000", + "topic_2": "0x000000000000000000000000192038b97fc5a926367f84743533ad63250be09b", + "topic_3": "0x000000000000000000000000000000000000000000000000000000000005a6ad" + }, + "txHash": "0x52249e144a905e4e84f185ce4895dbd1c7b53fb9068461869e2c6dc7e2487296", + "txIndex": 99, + "logIndex": 177 + } + ] + stablecoinTransfer: + value: + [ + { + "chain": "ethereum-mainnet", + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "blockNumber": 16719958, + "timestamp": 1677506111000, + "decoded": { + "label": "Transfer(address,address,uint256)", + "type": "stablecoin", + "subtype": "transfer", + "from": "0x99de7724196070b9ff266adbac8c7abf56890207", + "to": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "decimals": 6, + "stablecoin": "USDT", + "value": "699.981164" + }, + "raw": { + "topic_0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "topic_1": "0x00000000000000000000000099de7724196070b9ff266adbac8c7abf56890207", + "topic_2": "0x000000000000000000000000a9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "data": "0x0000000000000000000000000000000000000000000000000000000029b8dd6c" + }, + "txHash": "0xd77eaf324742498451aeafcfe4b2b9f07d817f6f6b0b1ae13fab5121b7bb32af", + "txIndex": 91, + "logIndex": 184 + }, + { + "chain": "ethereum-mainnet", + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "blockNumber": 16719947, + "timestamp": 1677505979000, + "decoded": { + "label": "Transfer(address,address,uint256)", + "type": "stablecoin", + "subtype": "transfer", + "from": "0x366cbca2412c2829fb80bfc844ed124938dd66c7", + "to": "0x28c6c06298d514db089934071355e5743bf21d60", + "decimals": 6, + "stablecoin": "USDT", + "value": "467727" + }, + "raw": { + "topic_0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "topic_1": "0x000000000000000000000000366cbca2412c2829fb80bfc844ed124938dd66c7", + "topic_2": "0x00000000000000000000000028c6c06298d514db089934071355e5743bf21d60", + "data": "0x0000000000000000000000000000000000000000000000000000006ce6b3a1c0" + }, + "txHash": "0xb3aa57159446049acb1878b285452deb7fdcd798191472a3bae026006fc41fc7", + "txIndex": 66, + "logIndex": 69 + } + ] + multitokenTransfer: + value: + [ + { + "chain": "ethereum-mainnet", + "address": "0xd955e7bd8ca9f2aad391760f849cfa4ee2d80d57", + "blockNumber": 16719956, + "timestamp": 1677506087000, + "decoded": { + "label": "TransferSingle(address,address,address,uint256,uint256)", + "type": "multitoken", + "subtype": "transfer", + "from": "0x3dacc060c993ae03a7f956a4f8ff81a33fa75ea4", + "to": "0x5f8e0020c3164fb7eb170d7345672f6948ca0ff4", + "operator": "0x1e0049783f008a0085193e00003d00cd54003c71", + "multitokenId": "15", + "multitokenValue": "1" + }, + "raw": { + "topic_0": "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62", + "topic_1": "0x0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71", + "topic_2": "0x0000000000000000000000003dacc060c993ae03a7f956a4f8ff81a33fa75ea4", + "topic_3": "0x0000000000000000000000005f8e0020c3164fb7eb170d7345672f6948ca0ff4", + "data": "0x000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001" + }, + "txHash": "0xd134d76b8a38a031bfad4bd7e1ee390ba610fa71cd66c338f1055260569ab643", + "txIndex": 180, + "logIndex": 349 + }, + { + "chain": "ethereum-mainnet", + "address": "0xd955e7bd8ca9f2aad391760f849cfa4ee2d80d57", + "blockNumber": 16719785, + "timestamp": 1677504011000, + "decoded": { + "label": "TransferBatch(address,address,address,uint256[],uint256[])", + "type": "multitoken", + "subtype": "mint", + "from": "0x0000000000000000000000000000000000000000", + "to": "0x1eb97e5c30c209e95913467fcc42c43274b0fe83", + "operator": "0x1eb97e5c30c209e95913467fcc42c43274b0fe83", + "multitokenIds": [ + "26", + "21" + ], + "multitokenValues": [ + "1", + "1" + ] + }, + "raw": { + "topic_0": "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb", + "topic_1": "0x0000000000000000000000001eb97e5c30c209e95913467fcc42c43274b0fe83", + "topic_2": "0x0000000000000000000000000000000000000000000000000000000000000000", + "topic_3": "0x0000000000000000000000001eb97e5c30c209e95913467fcc42c43274b0fe83", + "data": "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001" + }, + "txHash": "0x2c4d5fa08d0d78cd08e3b2df66031f157d47d09dc931f0a0c967a086bd7dc593", + "txIndex": 135, + "logIndex": 395 + } + ] + uniswapTrade: + value: + [ + { + "chain": "ethereum-mainnet", + "address": "0x939da43b6987a1012a19db7bb971c9d88d409e2e", + "blockNumber": 16716951, + "timestamp": 1677469631000, + "decoded": { + "label": "Swap(address,uint256,uint256,uint256,uint256,address)", + "type": "uniswap", + "subtype": "v2", + "from": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45", + "to": "0x29847b89f58cbf4749ab609c623cf4dadd703d68", + "token0": "0x80941467df667bfdad333d4dc3527713a620df3c", + "token1": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "amount0In": "0", + "amount1In": "0.02", + "amount0Out": "16.310991135231436277", + "amount1Out": "0" + }, + "raw": { + "topic_0": "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "topic_1": "0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45", + "topic_2": "0x00000000000000000000000029847b89f58cbf4749ab609c623cf4dadd703d68", + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000e25c4804a603e5f50000000000000000000000000000000000000000000000000000000000000000" + }, + "txHash": "0xd07727fa56151ed6813010859eaeaecb731a3da35b42583a720e60441e760dfb", + "txIndex": 105, + "logIndex": 316 + }, + { + "chain": "ethereum-mainnet", + "address": "0x939da43b6987a1012a19db7bb971c9d88d409e2e", + "blockNumber": 16716945, + "timestamp": 1677469520000, + "decoded": { + "label": "Swap(address,uint256,uint256,uint256,uint256,address)", + "type": "uniswap", + "subtype": "v2", + "from": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d", + "to": "0xb90dd95cc9a8b603fa5b1ebf1fc54de792d51e44", + "token1": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "partiallyRaw": true, + "amount0In": "0", + "amount1In": "38582795937639190", + "amount0Out": "19346934115717712", + "amount1Out": "0" + }, + "raw": { + "topic_0": "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", + "topic_1": "0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45", + "topic_2": "0x00000000000000000000000029847b89f58cbf4749ab609c623cf4dadd703d68", + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000e25c4804a603e5f50000000000000000000000000000000000000000000000000000000000000000" + }, + "txHash": "0xd07727fa56151ed6813010859eaeaecb731a3da35b42583a720e60441e760dfb", + "txIndex": 77, + "logIndex": 421 + }, + { + "chain": "ethereum-mainnet", + "address": "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8", + "blockNumber": 16715826, + "timestamp": 1677455963000, + "decoded": { + "label": "Swap(address,address,int256,int256,uint160,uint128,int24)", + "type": "uniswap", + "subtype": "v3", + "from": "0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b", + "to": "0x2e8daf55f212be91d3fa882cceab193a08fddeb2", + "token0": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "token1": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "amount0": "2539.314198", + "amount1": "-1.545466196980525897", + "sqrtPriceX96": "1957504157831843308092484471058274", + "liquidity": "16050202700964797693", + "tick": 202307 + }, + "raw": { + "topic_0": "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", + "topic_1": "0x000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b", + "topic_2": "0x0000000000000000000000002e8daf55f212be91d3fa882cceab193a08fddeb2", + "data": "0x00000000000000000000000000000000000000000000000000000000975adc16ffffffffffffffffffffffffffffffffffffffffffffffffea8d66ae9c9a14b700000000000000000000000000000000000060832d1059b69d1a2cc113896f62000000000000000000000000000000000000000000000000debdc651a4059cfd0000000000000000000000000000000000000000000000000000000000031643" + }, + "txHash": "0x3cb892c1f046f8467a7e081aedbbf90eeca93fa96a892ebf6f3c5db191dc29f5", + "txIndex": 4, + "logIndex": 32 + } + ] + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get specified events + tags: + - Data API + /v3/data/blocks: + get: + description: | +

10 credits per API call

+

Get information about blocks (when they were added, how many NFTs and events were ingested and list of transaction hashes that were processed within them) on the following blockchains:

+ +

To get started, provide a chain and specify one of the filters listed below (combination of these filters is not allowed):

+ + operationId: GetBlocks + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: List of block numbers, separated by comma. + in: query + name: blockIds + schema: + type: array + items: + type: integer + example: 1,2,4,400 + minimum: 0 + - description: Range of block numbers. Both blockFrom and blockTo need to be specified. + in: query + name: blockFrom + schema: + $ref: '#/components/schemas/BlockNumber' + - description: Range of block numbers. Both blockFrom and blockTo need to be specified. + in: query + name: blockTo + schema: + $ref: '#/components/schemas/BlockNumber' + - description: Date range when blocks were processed. Both timeFrom and timeTo need to be specified. + in: query + name: timeFrom + schema: + type: string + example: '2022-12-24T00:10' + - description: Date range when blocks were processed. Both timeFrom and timeTo need to be specified. + in: query + name: timeTo + schema: + type: string + example: '2022-12-24T00:20' + - description: The number of items per page (default is 50). + in: query + name: pageSize + schema: + $ref: '#/components/schemas/PageSize' + - description: The offset to obtain next page of the data. + in: query + name: offset + schema: + $ref: '#/components/schemas/Offset' + responses: + 200: + content: + application/json: + schema: + type: array + description: List of blocks added to a blockchain. + example: + [ + { + "blockNumber": 10, + "blockTimestamp": 1598671520000, + "hash": "0xec1a2d906f34e1981b2b1a15dbe5e10cf640e8b4b27dc056ebb65c0409b5a9af", + "eventIngestedSize": 0, + "nftIngestedSize": 0 + }, + { + "blockNumber": 11, + "blockTimestamp": 1598671540000, + "hash": "0xa78e7a9c6910fea66a981389735e0c652f1625905c6e0dca08d3f5c1694b7cc4", + "eventIngestedSize": 1, + "nftIngestedSize": 0, + "txHashes": [ + "0x19eaae1f7bdd28605f4175d7e87c9de68431bf76e85a262e268252a84bfc3984" + ] + } + ] + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get specified blocks + tags: + - Data API + /v3/data/blocks/latest: + get: + description: | +

1 credit per API call

+

Get information about latest added block on the following blockchains:

+ +

To get started, you can just provide a chain.

+ operationId: GetLatestBlock + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + responses: + 200: + content: + application/json: + schema: + type: object + description: Latest block added to a blockchain. + example: + { + "blockNumber": 25987956, + "blockTimestamp": 1677372871000, + "hash": "0x047a6ab09f86c760c145dc09b7a43b74d6ad957133ba4462a5530c642d4d9f17", + "eventIngestedSize": 351, + "nftIngestedSize": 7, + "txHashes": [ + "0x01a7983d1391b74305840e4960ba6c61417a9398cb938c3522d0a4a9cedf488f", + "0x0478fdae7e5e6f1eb522e6f43ba760c924b1f72d16e4dadc332f150829d09cbe", + "0x05d00f08ae523e445c3b1e7bbabec1896091234643d50e8bcdb76ddd3ff3827a", + "0x0b644c19257cf34ab98c509c7901af5a4ad8c6f537b625b46ee771a45f1940dc", + "0x0c1016bf317946d9997588ee3b932bc8ba6033cfcb83eca4b5ebcc4f5eaa076d" + ] + } + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get latest block + tags: + - Data API + /v3/data/tokens: + get: + description: | +

1 credit per API call

+

Get information about your favorite token! Our API lets you search for all tokens on:

+ +

To get started:

+ + operationId: GetTokens + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainEnum' + - description: The blockchain address of the token (NFT collection or any fungible token). + in: query + name: tokenAddress + required: true + schema: + $ref: '#/components/schemas/TokenAddress' + - description: The ID of a specific NFT token. + in: query + name: tokenId + schema: + $ref: '#/components/schemas/TokenId' + responses: + 200: + content: + application/json: + schema: + type: object + description: | + Information about specific collection or token + (not all fields are available for every token, e.g. some multitokens do not have name and symbol). + example: + { + "name": "BeefyCollectibles", + "symbol": "RareItem", + "tokenType": "nft", + "metadataURI": "QmYrUYv3kCXsrbs8YGguwZkyyMgGkgdQpbse8dZrDaruy5", + "metadata": { + "name": "Cowmmunity Ambassador", + "description": "Represents one of the most important roles in any civilization, as on him depends the molding of the community.", + "image": "QmbNsFNDCRYnswu5rtjTPNPkkn8y23DCXVkebrsx2b9fjg" + }, + "supply": "13" + } + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 404: + description: Collection or token not found. + content: + application/json: + schema: + properties: + errorCode: + description: data-api.token + example: data-api.token + type: string + message: + description: Collection or token not found on chain ${chain}. + example: Collection or token not found on chain bsc-mainnet. + type: string + statusCode: + description: '404' + example: 404 + type: number + required: + - errorCode + - message + - statusCode + type: object + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get information about collection or token + tags: + - Data API + /v3/data/utxos: + get: + description: | +

100 credits per API call

+

Get unspent UTXOs for a specific address up to a specific total amount. + If you want to prepare a transaction on UTXO-based chains like Bitcoin, you need to enter unspent UTXOs to be able to perform a transaction. By providing ```totalValue``` as a total, our API will return a list of UTXOs that will be enough to cover the transaction.

+ Our API lets you get the unpenst UTXOs for a specific address on:

+ +

To get started:

+ + operationId: GetUtxosByAddress + parameters: + - description: The blockchain to work with. + in: query + name: chain + required: true + schema: + $ref: '#/components/schemas/ChainUtxoEnum' + - description: The blockchain address. + in: query + name: address + required: true + schema: + type: string + example: bc1qmfp2r68cde646jv5ns7x2qvah8v5qtfw8gznj2 + - description: The total amount of transaction you want to send. Only UTXOs up to this amount will be returned, so you will not spend more than you need. + in: query + name: totalValue + schema: + type: number + example: 0.0001 + minimum: 0 + responses: + 200: + content: + application/json: + schema: + type: array + description: | + Information about specific collection or token + (not all fields are available for every token, e.g. some multitokens do not have name and symbol). + items: + type: object + required: + - chain + - address + - txHash + - index + - value + properties: + chain: + $ref: '#/components/schemas/ChainUtxoEnum' + address: + type: string + description: Address of the UTXO + example: bc1qmfp2r68cde646jv5ns7x2qvah8v5qtfw8gznj2 + txHash: + type: string + description: Hash of the transaction this UTXO is present in + example: '0x1b5b3e8a671434bf5d0d38e3e52dcafac484441a48bfae4a3f71e5b0b3093d8e' + index: + type: number + description: Index of the UTXO in the transaction + example: 0 + value: + type: number + description: Value of the UTXO, in BTC, LTC or DOGE. + example: 0.0001 + description: OK + 400: + <<: *API400 + 401: + <<: *API401 + 403: + <<: *API403 + 500: + <<: *API500 + security: + - X-API-Key: [] + x-codeSamples: [] + summary: Get unspent UTXOs for an address + tags: + - Data API + +components: + securitySchemes: + X-Api-Key: + description: | + To maintain the highest security level, Tatum requires X-API-Key HTTP header. + This X-API-Key represents identification of the plan and can be used by 1 developer or per environment. + Each X-API-Key is bound to the testnet or mainnet version of blockchains. + in: header + name: x-api-key + type: apiKey + schemas: + Chain: + type: string + description: Name of the chain. + example: 'ethereum-sepolia' + ChainEnum: + type: string + example: ethereum + enum: + - ethereum + - ethereum-sepolia + - celo + - celo-testnet + - bsc + - bsc-testnet + - polygon + - polygon-mumbai + ChainUtxoEnum: + type: string + example: bitcoin + enum: + - bitcoin + - bitcoin-testnet + - litecoin + - litecoin-testnet + - doge + - doge-testnet + - cardano + - cardano-preprod + TokenId: + type: string + description: ID of the token. + maxLength: 78 + example: '123' + format: uint256 + TokenAddress: + type: string + description: Contract address of the token. + example: '0x80d8bac9a6901698b3749fe336bbd1385c1f98f2' + TokenType: + type: string + description: Type of the token + example: 'nft' + ExcludeMetadata: + type: boolean + example: true + NftMetadataURI: + type: string + description: | + Metadata URL of the token. This data doesn't have to be present. + The safest way to obtain them in that case is from the NFT Contract.tokenURI() method call. + example: 'ipfs://QmXFpaS3S7CkLZvihLFA9JbawKdqhjg8dJeDkPntmkD2Pc' + NftMetadata: + type: object + description: | + Metadata scheme obtained from the url. This data don't have to be present. + The safest way to obtain them in that case is from the NFT Contract.tokenURI() method call. + example: + { + 'name': 'Example NFT name', + 'description': 'Example NFT description', + 'image': 'https://s3-us-east-1.amazonaws.com/example-image.jpg', + } + BlockNumber: + type: number + example: 16641547 + minimum: 0 + PageSize: + type: number + example: 10 + minimum: 1 + maximum: 50 + Offset: + type: number + example: 1 + PrevPage: + type: string + description: Cursor pagination, used to get previous page of results. + example: TBD + NextPage: + type: string + description: Cursor pagination, used to get next page of results. + example: TBD diff --git a/.gitbook/assets/openapi.yaml b/.gitbook/assets/openapi.yaml new file mode 100644 index 0000000..684012e --- /dev/null +++ b/.gitbook/assets/openapi.yaml @@ -0,0 +1,168 @@ +openapi: 3.0.0 +info: + title: Sample API + description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML. + version: 0.1.9 +servers: + - url: https://tatum.io/api/v3/gas-pump +paths: + /{owner}/{index}: + get: + summary: Get a Gas Pump address. + description: Returns a Gas Pump address. + parameters: + - name: index + in: path + description: Index of a address to get. + required: true + schema: + type: integer + format: int64 + - name: owner + in: path + description: Owner of Gas Pump address. + required: true + schema: + type: string + responses: + "200": # status code + description: Gas Pump address. + content: + application/json: + schema: + $ref: "#/components/schemas/Address" + /{owner}/{from}/{to}: + get: + summary: Get a Gas Pump address. + description: Returns a Gas Pump addresses. Maximum number of returned addresses is limited to 10 000. + parameters: + - name: owner + in: path + description: Owner of Gas Pump address. + required: true + schema: + type: string + - name: from + in: path + description: Start index of a Gas Pump addresses to get. + required: true + schema: + type: integer + format: int64 + minimum: 0 + - name: to + in: path + description: End index of a Gas Pump addresses to get. To must be greater or equal to from parameter. + required: true + schema: + type: integer + format: int64 + minimum: 0 + responses: + "200": # status code + description: Gas Pump addresses. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Address" + '400': + description: Exceeded maximum number of Gas Pump addresses to generate. Please use lower number. + /activate/{owner}/{address}: + post: + summary: Activate Gas Pump address. + description: Activates transfers from Gas Pump address which was created by Gas Pump Address API call + parameters: + - name: owner + in: path + description: Owner of Gas Pump address. + required: true + schema: + type: string + - name: address + in: path + description: Address to activate trasnfers. + required: true + schema: + type: string + responses: + "201": # status code + description: OK + /activate/{owner}/{from}/{to}: + post: + summary: Activate Gas Pump addresses. + description: Activates transfers from Gas Pump addresses which was created by Gas Pump Address API call. Maximum number of activated addresses is different for every chain and it is dynamically calculated. Normal limit of how many addresses can be activated is described in following table TODO TABLE. + parameters: + - name: owner + in: path + description: Owner of Gas Pump address. + required: true + schema: + type: string + - name: from + in: path + description: Start index of a Gas Pump addresses to activate. + required: true + schema: + type: integer + format: int64 + minimum: 0 + - name: to + in: path + description: End index of a Gas Pump addresses to activate. To must be greater or equal to from parameter. + required: true + schema: + type: integer + format: int64 + minimum: 0 + responses: + "201": # status code + description: OK + '400': + description: Exceeded maximum number of Gas Pump addresses activations. Please lower number of addresses to activate. + /activated/{owner}/{address}: + get: + summary: Check if address is activated. + description: Check if address is activated to be able to transfer funds via Gas Pump. + parameters: + - name: owner + in: path + description: Owner of Gas Pump address. + required: true + schema: + type: string + - name: address + in: path + description: Address to check if it is activated. + required: true + schema: + type: string + responses: + "200": # status code + description: Whether Gas Pump address is activated. + content: + application/json: + schema: + $ref: "#/components/schemas/Activated" + +components: + schemas: + Address: + type: object + properties: + address: + type: string + description: Gas Pump address. + Activated: + type: object + properties: + activated: + type: boolean + description: True if address was already activated for gas pump transfer, otherwise false. + ExceededMaxLimitActivation: + type: object + properties: + error: + type: string + description: Exceeded maximum number of activation. diff --git a/.gitbook/assets/wallet.png b/.gitbook/assets/wallet.png new file mode 100644 index 0000000..3a86eaf Binary files /dev/null and b/.gitbook/assets/wallet.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..71378ab --- /dev/null +++ b/README.md @@ -0,0 +1,141 @@ +# ๐Ÿฅณ Tatum Developer Documentation + +> We just released the new Tatum SDK which will make your web3 development flow super fun & you can read more about it here in docs.\ +> \ +> **Looking for our old documentation?** [**Click Here**](https://docs-v3.tatum.io) + +## Welcome to Tatum SDK! ๐Ÿš€ + +Tatum SDK is here to make your life easier when building blockchain applications! No more complicated setups, no need for previous blockchain experience. We've got you covered. + +### Why Tatum SDK? ๐Ÿ’ก + +1. **Super fast development:** Start building blockchain applications in no time. +2. **No previous blockchain experience required:** Perfect for beginners and experts alike. +3. **One line of code:** Perform complex tasks with minimal effort. + +### Key Features ๐Ÿ”‘ + +* Monitor activity on a blockchain address ๐Ÿ•ต๏ธโ€โ™‚๏ธ +* Perform RPC calls to various blockchains ๐Ÿ“ž +* Read information about NFTs such as balances, transactions, or ownerships ๐Ÿ–ผ๏ธ +* Get information about a specific wallet like balances or transaction history ๐Ÿ’ฐ + +### Get Started ๐ŸŒŸ + +To get started with Tatum SDK, simply run the following command based on the language of your choice: + +{% tabs %} +{% tab title="TypeScript / JavaScript SDK" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +npm install @tatumio/tatum +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Examples ๐Ÿ“š + +Here are some quick examples to show you how easy it is to use Tatum SDK: + +#### Perform RPC calls + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + const latestBlock = await tatum.rpc.blockNumber() + console.log(`Latest block is ${latestBlock}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +const { TatumSDK, Ethereum, Network } = require('@tatumio/tatum'); + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}); + const latestBlock = await tatum.rpc.blockNumber(); + console.log(`Latest block is ${latestBlock}`); +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +#### Monitor activity on a blockchain address + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + const subscription = await tatum.notification.subscribe.incomingNativeTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you are subscribed for all incoming ETH transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +const { TatumSDK, Ethereum, Network } = require('@tatumio/tatum'); + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}); + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d'; + const subscription = await tatum.notification.subscribe.incomingNativeTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }); + console.log(`Now you are subscribed for all incoming ETH transactions on ${monitoredAddress}`); +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl -i -X POST \ + https://api.tatum.io/v4/subscription?type=mainnet \ + -H 'Content-Type: application/json' \ + -d '{ + "type": "INCOMING_NATIVE_TX", + "attr": { + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "chain": "ETH", + "url": "https://" + } + }' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +Ready to build fantastic blockchain applications? Check out the official documentation for more information and examples! + +Happy coding! ๐ŸŽ‰ + +{% hint style="info" %} +### Join our Web3 Developer Community + +Get support with our products, meet other developers, and collaborate.\ +[Discord](https://discord.gg/tatum) ยท [Twitter](https://twitter.com/tatum\_io) ยท [Github](https://github.com/tatumio) +{% endhint %} diff --git a/SUMMARY.md b/SUMMARY.md new file mode 100644 index 0000000..80f4684 --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,729 @@ +# Table of contents + +* [๐Ÿฅณ Tatum Developer Documentation](README.md) +* [๐Ÿ’ต Pricing](pricing.md) + +## โš’ Available SDKs + +* [Get started with Tatum SDK](sdk/get-started-with-tatum-sdk.md) +* [JavaScript / TypeScript SDK](sdk/javascript-typescript-sdk/README.md) + * [Configuration options](sdk/javascript-typescript-sdk/configuration-options.md) + * [Submodules](sdk/javascript-typescript-sdk/submodules.md) +* [Selecting the best SDK](sdk/selecting-the-best-sdk/README.md) + * [Full Comparison](sdk/selecting-the-best-sdk/full-comparison.md) + * [Provider Agnostic](sdk/selecting-the-best-sdk/provider-agnostic.md) + * [Chain Agnostic Response](sdk/selecting-the-best-sdk/chain-agnostic-response.md) + +## ๐Ÿ“š Documentation + +* [๐Ÿ“ฉ Notifications](docs/notifications/README.md) + * [Supported types and blockchain networks](docs/notifications/supported-types-and-blockchain-networks.md) + * [Notification workflow](docs/notifications/notification-workflow/README.md) + * [Start monitoring of the address](docs/notifications/notification-workflow/start-monitoring-of-the-address.md) + * [Stop monitoring of the address](docs/notifications/notification-workflow/stop-monitoring-of-the-address.md) + * [Get all sent notifications](docs/notifications/notification-workflow/get-all-sent-notifications.md) + * [Get all existing monitoring subscriptions](docs/notifications/notification-workflow/get-all-existing-monitoring-subscriptions.md) + * [Notification types](docs/notifications/notification-types/README.md) + * [Address event](docs/notifications/notification-types/address-event.md) + * [Incoming native transactions](docs/notifications/notification-types/incoming-native-transactions.md) + * [Outgoing native transactions](docs/notifications/notification-types/outgoing-native-transactions.md) + * [Incoming internal transactions](docs/notifications/notification-types/incoming-internal-transactions.md) + * [Outgoing internal transactions](docs/notifications/notification-types/outgoing-internal-transactions.md) + * [Outgoing failed transactions](docs/notifications/notification-types/outgoing-failed-transactions.md) + * [Failed transactions in a block](docs/notifications/notification-types/failed-transactions-in-a-block.md) + * [Paid fee](docs/notifications/notification-types/paid-fee.md) + * [Incoming Tokens](docs/notifications/notification-types/incoming-tokens.md) + * [Outgoing Tokens](docs/notifications/notification-types/outgoing-tokens.md) + * [Incoming NFTs](docs/notifications/notification-types/incoming-nfts.md) + * [Outgoing NFTs](docs/notifications/notification-types/outgoing-nfts.md) + * [Incoming MultiTokens](docs/notifications/notification-types/incoming-multitokens.md) + * [Outgoing MultiTokens](docs/notifications/notification-types/outgoing-multitokens.md) + * [Contract Address Log Event](docs/notifications/notification-types/contract-address-log-event.md) +* [๐Ÿต NFTs](docs/nfts/README.md) + * [Get all NFTs the wallet holds](docs/nfts/get-all-nfts-the-wallet-holds.md) + * [Get all NFTs in the NFT collection](docs/nfts/get-all-nfts-in-the-nft-collection.md) + * [Trace the history of a specific NFT](docs/nfts/trace-the-history-of-a-specific-nft.md) + * [Show the NFT history of a wallet](docs/nfts/show-the-nft-history-of-a-wallet.md) + * [Create NFT Collection](docs/nfts/create-nft-collection.md) + * [Create MultiToken NFT Collection](docs/nfts/create-multitoken-nft-collection.md) + * [Retrieve the owner of the NFT](docs/nfts/retrieve-the-owner-of-the-nft.md) + * [Check if the wallet owns a specific NFT](docs/nfts/check-if-the-wallet-owns-a-specific-nft.md) + * [Get the metadata of a specific NFT](docs/nfts/get-the-metadata-of-a-specific-nft.md) +* [๐Ÿช™ Fungible tokens](docs/fungible-tokens/README.md) + * [Get all fungible tokens the wallet holds](docs/fungible-tokens/get-all-fungible-tokens-the-wallet-holds.md) + * [Show fungible token history of a wallet](docs/fungible-tokens/show-fungible-token-history-of-a-wallet.md) + * [Get metadata of a fungible token](docs/fungible-tokens/get-metadata-of-a-fungible-token.md) + * [Create a fungible token](docs/fungible-tokens/create-a-fungible-token.md) +* [โ›ฝ Fee Estimation](docs/fee-estimation/README.md) + * [getCurrentFee](docs/fee-estimation/getcurrentfee.md) +* [๐Ÿ’ฐ Wallet address operations](docs/wallet-address-operations/README.md) + * [Get all assets the wallet holds](docs/wallet-address-operations/get-all-assets-the-wallet-holds.md) + * [Get all transactions on the wallet](docs/wallet-address-operations/get-all-transactions-on-the-wallet.md) +* [๐Ÿ’ป Wallet Provider](docs/wallet-provider/README.md) + * [MetaMask](docs/wallet-provider/metamask/README.md) + * [Connect a wallet](docs/wallet-provider/metamask/connect-a-wallet.md) + * [Transfer native assets](docs/wallet-provider/metamask/transfer-native-assets.md) + * [Transfer your NFT](docs/wallet-provider/metamask/transfer-your-nft.md) + * [Create your NFT Collection](docs/wallet-provider/metamask/create-your-nft-collection.md) + * [Create your Fungible Token](docs/wallet-provider/metamask/create-your-fungible-token.md) + * [Create your NFT (ERC-1155 MultiToken) Collection](docs/wallet-provider/metamask/create-your-nft-erc-1155-multitoken-collection.md) + * [Transfer fungible tokens like USDT](docs/wallet-provider/metamask/transfer-fungible-tokens-like-usdt.md) + * [Approve the transfer of a fungible token like USDT](docs/wallet-provider/metamask/approve-the-transfer-of-a-fungible-token-like-usdt.md) + * [Build your own custom transaction](docs/wallet-provider/metamask/build-your-own-custom-transaction.md) +* [๐Ÿ’ฒ Exchange rates](docs/exchange-rates/README.md) + * [Get current exchange rate of the crypto asset](docs/exchange-rates/get-current-exchange-rate-of-the-crypto-asset.md) + * [Get current rates for multiple crypto assets at once](docs/exchange-rates/get-current-rates-for-multiple-crypto-assets-at-once.md) + * [Supported Crypto Currencies](docs/exchange-rates/supported-crypto-currencies.md) + * [Supported Fiats](docs/exchange-rates/supported-fiats.md) +* [โš™ RPC](docs/rpc/README.md) + * [EVM Blockchains](docs/rpc/evm-blockchains/README.md) + * [Arbitrum RPC documentation](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Mempool](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool\_status.md) + * [Archival information](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/README.md) + * [debug\_getBadBlocks](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug\_getbadblocks.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [Avalanche RPC documentation](docs/rpc/evm-blockchains/avalanche-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Mempool](docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool\_status.md) + * [Archival information](docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/README.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [BSC RPC documentation](docs/rpc/evm-blockchains/bsc-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_call](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_call.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Mempool](docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool\_status.md) + * [Archival information](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/README.md) + * [debug\_storageRangeAt](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug\_storagerangeat.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [Ethereum RPC documentation](docs/rpc/evm-blockchains/ethereum-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_call](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_call.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Mempool](docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool\_status.md) + * [Transaction](docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Archival information](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/README.md) + * [debug\_storageRangeAt](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug\_storagerangeat.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug\_tracecall.md) + * [eth\_getBlockReceipts](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/eth\_getblockreceipts.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [Flare RPC documentation](docs/rpc/evm-blockchains/flare-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Archival information](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/README.md) + * [debug\_storageRangeAt](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_storagerangeat.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [debug\_getBadBlocks](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_getbadblocks.md) + * [debug\_traceBlock](docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug\_traceblock.md) + * [Mempool](docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool\_status.md) + * [Haqq RPC documentation](docs/rpc/evm-blockchains/haqq-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Mempool](docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool\_status.md) + * [Transaction](docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Horizen EON RPC documentation](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Mempool](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool\_status.md) + * [Archival information](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/README.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [Optimism RPC documentation](docs/rpc/evm-blockchains/optimism-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Mempool](docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool\_status.md) + * [Transaction](docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Archival information](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/README.md) + * [debug\_storageRangeAt](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_storagerangeat.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_traceblockbynumber.md) + * [debug\_traceBlock](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_traceblock.md) + * [debug\_getBadBlocks](docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug\_getbadblocks.md) + * [Polygon RPC documentation](docs/rpc/evm-blockchains/polygon-rpc-documentation/README.md) + * [Network state](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/README.md) + * [eth\_blockNumber](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/README.md) + * [eth\_chainId](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/web3\_clientversion.md) + * [Mempool](docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/README.md) + * [txpool\_content](docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool\_status.md) + * [Transaction](docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/README.md) + * [eth\_estimateGas](docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth\_sendrawtransaction.md) + * [Archival information](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/README.md) + * [debug\_storageRangeAt](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug\_storagerangeat.md) + * [debug\_traceCall](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug\_traceblockbyhash.md) + * [eth\_getBlockReceipts](docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/eth\_getblockreceipts.md) + * [UTXO Blockchains](docs/rpc/utxo-blockchains/README.md) + * [Bitcoin RPC documentation](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/README.md) + * [Network state](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/README.md) + * [getbestblockhash](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getbestblockhash.md) + * [getblockhash](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockhash.md) + * [getblock](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblock.md) + * [getblockcount](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockcount.md) + * [getblockchaininfo](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockchaininfo.md) + * [getblockheader](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockheader.md) + * [getblockstats](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockstats.md) + * [getchaintips](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getchaintips.md) + * [getdifficulty](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getdifficulty.md) + * [gettxout](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxout.md) + * [gettxoutproof](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxoutproof.md) + * [verifytxoutproof](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/verifytxoutproof.md) + * [Transactions](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/README.md) + * [createrawtransaction](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/createrawtransaction.md) + * [sendrawtransaction](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/sendrawtransaction.md) + * [getrawtransaction](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/getrawtransaction.md) + * [estimatesmartfee](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/estimatesmartfee.md) + * [decoderawtransaction](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decoderawtransaction.md) + * [decodescript](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decodescript.md) + * [Mempool](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/README.md) + * [getmempoolancestors](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolancestors.md) + * [getmempooldescendants](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempooldescendants.md) + * [getmempoolentry](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolentry.md) + * [getmempoolinfo](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolinfo.md) + * [getrawmempool](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getrawmempool.md) + * [Helper Functions](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/README.md) + * [validateaddress](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/validateaddress.md) + * [verifymessage](docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/verifymessage.md) + * [Litecoin RPC documentation](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/README.md) + * [Network state](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/README.md) + * [getbestblockhash](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getbestblockhash.md) + * [getblockhash](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockhash.md) + * [getblock](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblock.md) + * [getblockcount](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockcount.md) + * [getblockchaininfo](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockchaininfo.md) + * [getblockheader](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockheader.md) + * [getblockstats](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockstats.md) + * [getchaintips](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getchaintips.md) + * [getdifficulty](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getdifficulty.md) + * [gettxout](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxout.md) + * [gettxoutproof](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxoutproof.md) + * [verifytxoutproof](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/verifytxoutproof.md) + * [Transactions](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/README.md) + * [createrawtransaction](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/createrawtransaction.md) + * [sendrawtransaction](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/sendrawtransaction.md) + * [getrawtransaction](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/getrawtransaction.md) + * [estimatesmartfee](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/estimatesmartfee.md) + * [decoderawtransaction](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decoderawtransaction.md) + * [decodescript](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decodescript.md) + * [Mempool](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/README.md) + * [getmempoolancestors](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolancestors.md) + * [getmempooldescendants](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempooldescendants.md) + * [getmempoolentry](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolentry.md) + * [getmempoolinfo](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolinfo.md) + * [getrawmempool](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getrawmempool.md) + * [Helper Functions](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/README.md) + * [validateaddress](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/validateaddress.md) + * [verifymessage](docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/verifymessage.md) + * [Dogecoin RPC documentation](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/README.md) + * [Network state](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/README.md) + * [getbestblockhash](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getbestblockhash.md) + * [getblockhash](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockhash.md) + * [getblock](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblock.md) + * [getblockcount](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockcount.md) + * [getblockchaininfo](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockchaininfo.md) + * [getblockheader](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockheader.md) + * [getchaintips](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getchaintips.md) + * [getdifficulty](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getdifficulty.md) + * [gettxout](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxout.md) + * [gettxoutproof](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxoutproof.md) + * [verifytxoutproof](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/verifytxoutproof.md) + * [Transactions](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/README.md) + * [createrawtransaction](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/createrawtransaction.md) + * [sendrawtransaction](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/sendrawtransaction.md) + * [getrawtransaction](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/getrawtransaction.md) + * [estimatesmartfee](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/estimatesmartfee.md) + * [decoderawtransaction](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decoderawtransaction.md) + * [decodescript](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decodescript.md) + * [Mempool](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/README.md) + * [getmempoolancestors](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolancestors.md) + * [getmempooldescendants](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempooldescendants.md) + * [getmempoolentry](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolentry.md) + * [getmempoolinfo](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolinfo.md) + * [getrawmempool](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getrawmempool.md) + * [Helper Functions](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/README.md) + * [validateaddress](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/validateaddress.md) + * [verifymessage](docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/verifymessage.md) + * [Solana RPC documentation](docs/rpc/solana-rpc-documentation/README.md) + * [Account information](docs/rpc/solana-rpc-documentation/account-information/README.md) + * [getAccountInfo](docs/rpc/solana-rpc-documentation/account-information/getaccountinfo.md) + * [getBalance](docs/rpc/solana-rpc-documentation/account-information/getbalance.md) + * [getLargestAccounts](docs/rpc/solana-rpc-documentation/account-information/getlargestaccounts.md) + * [getMultipleAccounts](docs/rpc/solana-rpc-documentation/account-information/getmultipleaccounts.md) + * [getProgramAccounts](docs/rpc/solana-rpc-documentation/account-information/getprogramaccounts.md) + * [getTokenAccountBalance](docs/rpc/solana-rpc-documentation/account-information/gettokenaccountbalance.md) + * [getTokenAccountsByDelegate](docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbydelegate.md) + * [getTokenAccountsByOwner](docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbyowner.md) + * [getVoteAccounts](docs/rpc/solana-rpc-documentation/account-information/getvoteaccounts.md) + * [Transactions](docs/rpc/solana-rpc-documentation/transactions/README.md) + * [getFeeForMessage](docs/rpc/solana-rpc-documentation/transactions/getfeeformessage.md) + * [getSignaturesForAddress](docs/rpc/solana-rpc-documentation/transactions/getsignaturesforaddress.md) + * [getSignatureStatuses](docs/rpc/solana-rpc-documentation/transactions/getsignaturestatuses.md) + * [getTransaction](docs/rpc/solana-rpc-documentation/transactions/gettransaction.md) + * [getTransactionCount](docs/rpc/solana-rpc-documentation/transactions/gettransactioncount.md) + * [isBlockhashValid](docs/rpc/solana-rpc-documentation/transactions/isblockhashvalid.md) + * [sendTransaction](docs/rpc/solana-rpc-documentation/transactions/sendtransaction.md) + * [simulateTransaction](docs/rpc/solana-rpc-documentation/transactions/simulatetransaction.md) + * [Token and Stake information](docs/rpc/solana-rpc-documentation/token-and-stake-information/README.md) + * [getInflationGovernor](docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationgovernor.md) + * [getInflationRate](docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationrate.md) + * [getInflationReward](docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationreward.md) + * [getStakeMinimumDelegation](docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeminimumdelegation.md) + * [getTokenLargestAccounts](docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokenlargestaccounts.md) + * [getTokenSupply](docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokensupply.md) + * [getStakeActivation](docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeactivation.md) + * [Ledger and block information](docs/rpc/solana-rpc-documentation/ledger-and-block-information/README.md) + * [getBlock](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblock.md) + * [getBlockCommitment](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockcommitment.md) + * [getBlockHeight](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockheight.md) + * [getBlockProduction](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockproduction.md) + * [getBlocks](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocks.md) + * [getBlocksWithLimit](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockswithlimit.md) + * [getBlockTime](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocktime.md) + * [getFirstAvailableBlock](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getfirstavailableblock.md) + * [getHighestSnapshotSlot](docs/rpc/solana-rpc-documentation/ledger-and-block-information/gethighestsnapshotslot.md) + * [getGenesisHash](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getgenesishash.md) + * [getLatestBlockhash](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getlatestblockhash.md) + * [getLeaderSchedule](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getleaderschedule.md) + * [getSlot](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslot.md) + * [getSlotLeader](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleader.md) + * [getSlotLeaders](docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleaders.md) + * [minimumLedgerSlot](docs/rpc/solana-rpc-documentation/ledger-and-block-information/minimumledgerslot.md) + * [Miscellaneous API calls](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/README.md) + * [getClusterNodes](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getclusternodes.md) + * [getHealth](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/gethealth.md) + * [getIdentity](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getidentity.md) + * [getVersion](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getversion.md) + * [getMaxRetransmitSlot](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxretransmitslot.md) + * [getMaxShredInsertSlot](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxshredinsertslot.md) + * [getMinimumBalanceForRentExemption](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getminimumbalanceforrentexemption.md) + * [getSupply](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getsupply.md) + * [getEpochInfo](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochinfo.md) + * [getEpochSchedule](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochschedule.md) + * [getRecentPerformanceSamples](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentperformancesamples.md) + * [getRecentPrioritizationFees](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentprioritizationfees.md) + * [requestAirdrop](docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/requestairdrop.md) + * [XRP RPC documentation](docs/rpc/xrp-rpc-documentation/README.md) + * [API calls for account methods](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/README.md) + * [account\_channels](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_channels.md) + * [account\_currencies](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_currencies.md) + * [account\_info](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_info.md) + * [account\_lines](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_lines.md) + * [account\_nfts](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_nfts.md) + * [account\_objects](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_objects.md) + * [account\_offers](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_offers.md) + * [account\_tx](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account\_tx.md) + * [gateway\_balances](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/gateway\_balances.md) + * [noripple\_check](docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/noripple\_check.md) + * [API calls for ledger methods](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/README.md) + * [ledger](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger.md) + * [ledger\_closed](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger\_closed.md) + * [ledger\_current](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger\_current.md) + * [ledger\_data](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger\_data.md) + * [ledger\_entry](docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger\_entry.md) + * [API calls for transaction methods](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/README.md) + * [submit](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit.md) + * [submit\_multisigned](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit\_multisigned.md) + * [transaction\_entry](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/transaction\_entry.md) + * [tx](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx.md) + * [tx\_history](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx\_history.md) + * [sign](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign.md) + * [sign\_for](docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign\_for.md) + * [API calls for path and order book methods](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/README.md) + * [book\_offers](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/book\_offers.md) + * [deposit\_authorized](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/deposit\_authorized.md) + * [nft\_buy\_offers](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft\_buy\_offers.md) + * [nft\_sell\_offers](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft\_sell\_offers.md) + * [ripple\_path\_find](docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/ripple\_path\_find.md) + * [API calls for payment channel methods](docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/README.md) + * [channel\_authorize](docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel\_authorize.md) + * [channel\_verify](docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel\_verify.md) + * [API calls for server info methods](docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/README.md) + * [fee](docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/fee.md) + * [server\_info](docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server\_info.md) + * [server\_state](docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server\_state.md) + * [manifest](docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/manifest.md) + * [API calls for utility methods](docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/README.md) + * [ping](docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/ping.md) + * [random](docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/random.md) + * [TRON RPC documentation](docs/rpc/tron-rpc-documentation/README.md) + * [API calls for address utility methods](docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/README.md) + * [validateaddress](docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/validateaddress.md) + * [API calls for transaction methods](docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/README.md) + * [broadcasttransaction](docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasttransaction.md) + * [broadcasthex](docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasthex.md) + * [createtransaction](docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/createtransaction.md) + * [API calls for account methods](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/README.md) + * [createaccount](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/createaccount.md) + * [getaccount](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccount.md) + * [updateaccount](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/updateaccount.md) + * [accountpermissionupdate](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/accountpermissionupdate.md) + * [getaccountbalance](docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccountbalance.md) + * [API calls for account resource methods](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/README.md) + * [getaccountresource](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountresource.md) + * [getaccountnet](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountnet.md) + * [freezebalance](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalance.md) + * [unfreezebalance](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalance.md) + * [getdelegatedresource](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresource.md) + * [getdelegatedresourceaccountindex](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindex.md) + * [freezebalancev2](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalancev2.md) + * [unfreezebalancev2](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalancev2.md) + * [delegateresource](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/delegateresource.md) + * [undelegateresource](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/undelegateresource.md) + * [withdrawexpireunfreeze](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/withdrawexpireunfreeze.md) + * [getavailableunfreezecount](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getavailableunfreezecount.md) + * [getcanwithdrawunfreezeamount](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcanwithdrawunfreezeamount.md) + * [getcandelegatedmaxsize](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcandelegatedmaxsize.md) + * [getdelegatedresourcev2](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourcev2.md) + * [getdelegatedresourceaccountindexv2](docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindexv2.md) + * [API calls for query the network methods](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/README.md) + * [getblock](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblock.md) + * [getblockbynum](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbynum.md) + * [getblockbyid](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbyid.md) + * [getblockbylatestnum](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylatestnum.md) + * [getblockbylimitnext](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylimitnext.md) + * [getnowblock](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnowblock.md) + * [gettransactionbyid](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactionbyid.md) + * [gettransactioninfobyid](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyid.md) + * [gettransactioninfobyblocknum](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyblocknum.md) + * [listnodes](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/listnodes.md) + * [getnodeinfo](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnodeinfo.md) + * [getchainparameters](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getchainparameters.md) + * [getblockbalance](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbalance.md) + * [getenergyprices](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getenergyprices.md) + * [getbandwidthprices](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getbandwidthprices.md) + * [getburntrx](docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getburntrx.md) + * [API calls for TRC10 token methods](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/README.md) + * [getassetissuebyaccount](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyaccount.md) + * [getassetissuebyid](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyid.md) + * [getassetissuebyname](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyname.md) + * [getassetissuelist](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelist.md) + * [getassetissuelistbyname](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelistbyname.md) + * [getpaginatedassetissuelist](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getpaginatedassetissuelist.md) + * [transferasset](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/transferasset.md) + * [createassetissue](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/createassetissue.md) + * [participateassetissue](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/participateassetissue.md) + * [unfreezeasset](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/unfreezeasset.md) + * [updateasset](docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/updateasset.md) + * [API calls for smart contract methods](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/README.md) + * [getcontract](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontract.md) + * [getcontractinfo](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontractinfo.md) + * [triggersmartcontract](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggersmartcontract.md) + * [triggerconstantcontract](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggerconstantcontract.md) + * [deploycontract](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/deploycontract.md) + * [updatesetting](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updatesetting.md) + * [updateenergylimit](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updateenergylimit.md) + * [clearabi](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/clearabi.md) + * [estimateenergy](docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/estimateenergy.md) + * [EVM methods](docs/rpc/tron-rpc-documentation/evm-methods/README.md) + * [Network state](docs/rpc/tron-rpc-documentation/evm-methods/network-state/README.md) + * [eth\_blockNumber](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_blocknumber.md) + * [eth\_getBlockByNumber](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getblockbynumber.md) + * [eth\_getBlockByHash](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getblockbyhash.md) + * [eth\_getTransactionByHash](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_gettransactionbyhash.md) + * [eth\_getTransactionReceipt](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_gettransactionreceipt.md) + * [eth\_getBalance](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getbalance.md) + * [eth\_getLogs](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getlogs.md) + * [eth\_getCode](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getcode.md) + * [eth\_getBlockTransactionCountByHash](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getblocktransactioncountbyhash.md) + * [eth\_getBlockTransactionCountByNumber](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getblocktransactioncountbynumber.md) + * [eth\_getStorageAt](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getstorageat.md) + * [eth\_getTransactionByBlockHashAndIndex](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_gettransactionbyblockhashandindex.md) + * [eth\_getTransactionByBlockNumberAndIndex](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_gettransactionbyblocknumberandindex.md) + * [eth\_getTransactionCount](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_gettransactioncount.md) + * [eth\_getProof](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getproof.md) + * [eth\_getUncleCountByBlockHash](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getunclecountbyblockhash.md) + * [eth\_getUncleCountByBlockNumber](docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth\_getunclecountbyblocknumber.md) + * [Network/Client information](docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/README.md) + * [eth\_chainId](docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/eth\_chainid.md) + * [web3\_clientVersion](docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/web3\_clientversion.md) + * [Transaction](docs/rpc/tron-rpc-documentation/evm-methods/transaction/README.md) + * [eth\_estimateGas](docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth\_estimategas.md) + * [eth\_gasPrice](docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth\_gasprice.md) + * [eth\_maxPriorityFeePerGas](docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth\_maxpriorityfeepergas.md) + * [eth\_sendRawTransaction](docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth\_sendrawtransaction.md) + * [Mempool](docs/rpc/tron-rpc-documentation/evm-methods/mempool/README.md) + * [txpool\_content](docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool\_content.md) + * [txpool\_inspect](docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool\_inspect.md) + * [txpool\_status](docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool\_status.md) + * [Archival information](docs/rpc/tron-rpc-documentation/evm-methods/archival-information/README.md) + * [debug\_traceCall](docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug\_tracecall.md) + * [debug\_traceTransaction](docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug\_tracetransaction.md) + * [debug\_traceBlockByHash](docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug\_traceblockbyhash.md) + * [debug\_traceBlockByNumber](docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug\_traceblockbynumber.md) + +*** + +* [๐Ÿ“– v3 Features](v3-features/README.md) + * [NFT Express](https://docs-v3.tatum.io/nft-express/mint-nfts-with-tatums-nft-express) + * [API Reference](https://apidoc.tatum.io/) + * [Virtual Accounts](https://docs-v3.tatum.io/guides/ledger-and-off-chain) + * [Gas Pump](https://docs-v3.tatum.io/gas-pump/pay-gas-fees-with-tatum-gas-pump) + * [KMS](https://docs-v3.tatum.io/private-key-management/tatum-key-management-system-kms) + +## โ›“ Learn Blockchain + +* [Basics](learn-blockchain/basics/README.md) + * [What is Blockchain?](learn-blockchain/basics/what-is-blockchain.md) + * [What is a Token on Blockchain?](learn-blockchain/basics/what-is-a-token-on-blockchain/README.md) + * [What are Native Tokens?](learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md) + * [What are Fungible Tokens](learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md) + * [What are Non Fungible Tokens?](learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md) + * [What are MultiTokens?](learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md) + * [What are Transactions?](learn-blockchain/basics/what-are-transactions/README.md) + * [What are the reasons a transaction fails?](learn-blockchain/basics/what-are-transactions/what-are-the-reasons-a-transaction-fails.md) + * [What are Internal Transactions](learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md) diff --git a/docs/exchange-rates/README.md b/docs/exchange-rates/README.md new file mode 100644 index 0000000..78d45d0 --- /dev/null +++ b/docs/exchange-rates/README.md @@ -0,0 +1,19 @@ +--- +description: >- + Exchange rate submodule helps any web3 app developer to quickly query exchange + rate of a crypto against more than 165 fiat currencies. +--- + +# ๐Ÿ’ฒ Exchange rates + +The exchange rate submodule offers a powerful feature that enables users to obtain real-time exchange rates for a wide range of cryptocurrencies against more than 165 fiat currencies (see the full list on [Supported Fiat](supported-fiats.md) page) & more than 90 cryptocurrencies which you can find listed on [Supported Crypto Currencies](supported-crypto-currencies.md) page. This functionality can added better onboarding experience to new crypto users to keep them up-to-date with the Transaction Value they are most comfortable to read in.\ +\ +With the exchange rate submodule, developers can easily integrate this capability into their applications without the need for extensive knowledge of individual exchange APIs or complex rate calculation algorithms. Tatum SDK simplifies the process by providing a streamlined interface to retrieve exchange rates, allowing developers to focus on building robust and innovative applications. + +As a developer, the exchange rate submodule within our SDK offers you powerful capabilities to enhance your cryptocurrency applications. Here are the top three use cases you can get started building on: + +1. Portfolio Integration: Easily integrate real-time portfolio tracking into your application. With the exchange rate submodule, you can fetch and display the current values of users' cryptocurrency holdings, providing them with a comprehensive view of their investments. +2. Seamless Currency Conversion: Simplify cryptocurrency-to-fiat conversions within your app. The exchange rate submodule allows you to retrieve accurate exchange rates, enabling users to convert cryptocurrencies seamlessly. Enhance the user experience by offering transparent and efficient currency conversion functionality. +3. Merchant Integration: Seamlessly integrate cryptocurrency payment solutions for merchants. With the exchange rate submodule, you can fetch real-time exchange rates and display prices in users' preferred fiat currencies. Empower merchants to accept cryptocurrency payments with confidence and streamline transactions for their customers. + +Explore the possibilities and enhance user experience across your web3 application today. diff --git a/docs/exchange-rates/get-current-exchange-rate-of-the-crypto-asset.md b/docs/exchange-rates/get-current-exchange-rate-of-the-crypto-asset.md new file mode 100644 index 0000000..b49428b --- /dev/null +++ b/docs/exchange-rates/get-current-exchange-rate-of-the-crypto-asset.md @@ -0,0 +1,68 @@ +--- +description: >- + This endpoint allows you to obtain current exchange rate between fiat/crypto + or fiat/fiat. +--- + +# Get current exchange rate of the crypto asset + +\ +The `getExchangeRate()` method offers a seamless way to retrieve up-to-date exchange rate information for cryptocurrencies. By invoking this method, you can effortlessly access the current exchange rate, along with the corresponding timestamp and the reliable source of the data. + +### How to use it + +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+const rate = await tatum.rates.getCurrentRate("BTC","EUR")
+
+ +{% embed url="https://codepen.io/tatum-devrel/pen/poQqQNB" %} + +### Request Interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export class RateBatchDto { + // fiat + basePair: Fiat + + // crypto currency/fiat + currency: Fiat | Currency +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export class Rate { + // crypto currency/fiat + _id: Fiat | Currency + + // the amount of basePair that can be exchanged for 1 _id (crypto currency/fiat) + value: string + + // fiat + basePair: Fiat + + // timestamp of rate information from source + timestamp: number + + // source of rate + source: string +} +``` +{% endcode %} + +### Supported FIAT + +See the full wide range of fiat currencies we support for the exchange submodule on this [page](get-current-exchange-rate-of-the-crypto-asset.md#supported-fiat). + +### Supported Crypto Currency + +See the full wide range of crypto currencies we support for the exchange submodule on this [page](get-current-exchange-rate-of-the-crypto-asset.md#supported-crypto-currency). diff --git a/docs/exchange-rates/get-current-rates-for-multiple-crypto-assets-at-once.md b/docs/exchange-rates/get-current-rates-for-multiple-crypto-assets-at-once.md new file mode 100644 index 0000000..5b9572e --- /dev/null +++ b/docs/exchange-rates/get-current-rates-for-multiple-crypto-assets-at-once.md @@ -0,0 +1,88 @@ +--- +description: >- + This endpoint allows you to obtain current exchange rates between fiat/crypto + or fiat/fiat. +--- + +# Get current rates for multiple crypto assets at once + +\ +The `getExchangeRates()` method in our API provides a powerful solution similar to the "Get current rate" method. It enables you to obtain current exchange rate information, along with timestamps and the source of the data. \ +\ +One notable feature of this method is the ability to request multiple exchange pairs simultaneously. This means you can retrieve exchange rates for various cryptocurrencies all in one API call, saving time and reducing complexity. + +### How to use it + +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+const rates = tatum.rates.getCurrentRateBatch(
+      [{
+        currency: "BTC",
+        basePair: "EUR",
+        batchId: "0"
+      }, {
+        currency: "ETH",
+        basePair: "EUR",
+        batchId: "1"
+      }])
+
+ +{% embed url="https://codepen.io/tatum-devrel/pen/xxQmQgV" %} + +### Request Interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// array of +export class RateBatchDto { + // fiat + basePair: Fiat + + // crypto currency/fiat + currency: Fiat | Currency + + // used to identify pair in batch calls + batchId?: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// array of +export class Rate { + // used to identify pair in batch calls + batchId?: string + + // crypto currency/fiat + _id: Fiat | Currency + + // the amount of basePair that can be exchanged for 1 _id (crypto currency/fiat) + value: string + + // fiat + basePair: Fiat + + // timestamp of rate information from source + timestamp: number + + // source of rate + source: string +} + +``` +{% endcode %} + +### Supported FIAT + +See the full wide range of fiat currencies we support for the exchange submodule on this [page](get-current-rates-for-multiple-crypto-assets-at-once.md#supported-fiat). + +### Supported Crypto Currency + +See the full wide range of crypto currencies we support for the exchange submodule on this [page](get-current-rates-for-multiple-crypto-assets-at-once.md#supported-crypto-currency). diff --git a/docs/exchange-rates/supported-crypto-currencies.md b/docs/exchange-rates/supported-crypto-currencies.md new file mode 100644 index 0000000..d0724d2 --- /dev/null +++ b/docs/exchange-rates/supported-crypto-currencies.md @@ -0,0 +1,108 @@ +--- +description: >- + This page lists all the cryptocurrencies Tatum supports for the Exchange rate + submodule. +--- + +# Supported Crypto Currencies + +Below is the list of Cryptocurrencies we supports for the Exchange Rate Submodule. + +```typescript +export enum Currency { + BTC = 'BTC', + AVAX = 'AVAX', + FTM = 'FTM', + REVV = 'REVV', + SAND = 'SAND', + ADA = 'ADA', + BCH = 'BCH', + BNB = 'BNB', + LTC = 'LTC', + ONE = 'ONE', + ETH = 'ETH', + EGLD = 'EGLD', + MATIC = 'MATIC', + GAMEE = 'GAMEE', + MATIC_ETH = 'MATIC_ETH', + USDC_MATIC = 'USDC_MATIC', + USDC_BSC = 'USDC_BSC', + USDC_SOL = 'USDC_SOL', + RMD = 'RMD', + GMC = 'GMC', + GMC_BSC = 'GMC_BSC', + CELO = 'CELO', + COIIN = 'COIIN', + COIIN_BSC = 'COIIN_BSC', + CUSD = 'CUSD', + CEUR = 'CEUR', + FLOW = 'FLOW', + FUSD = 'FUSD', + BSC = 'BSC', + XDC = 'XDC', + DOGE = 'DOGE', + XRP = 'XRP', + XLM = 'XLM', + USDT = 'USDT', + TRON = 'TRON', + LEO = 'LEO', + LINK = 'LINK', + LISK = 'LISK', + FREE = 'FREE', + MKR = 'MKR', + USDC = 'USDC', + UNI = 'UNI', + BAT = 'BAT', + TUSD = 'TUSD', + PAX = 'PAX', + PLTC = 'PLTC', + XCON = 'XCON', + MMY = 'MMY', + PAXG = 'PAXG', + VET = 'VET', + HAG = 'HAG', + BETH = 'BETH', + BUSD = 'BUSD', + BBTC = 'BBTC', + BADA = 'BADA', + WBNB = 'WBNB', + BDOT = 'BDOT', + BXRP = 'BXRP', + BLTC = 'BLTC', + BBCH = 'BBCH', + CAKE = 'CAKE', + BUSD_BSC = 'BUSD_BSC', + B2U_BSC = 'B2U_BSC', + WBTC = 'WBTC', + USDT_TRON = 'USDT_TRON', + USDT_MATIC = 'USDT_MATIC', + LATOKEN = 'LATOKEN', + INRT_TRON = 'INRT_TRON', + ALGO = 'ALGO', + SOL = 'SOL', + KCS = 'KCS', + NEO = 'NEO', + KLAY = 'KLAY', + EOS = 'EOS', + ARB = 'ARB', + OPTIMISM = 'OPTIMISM', + NEAR = 'NEAR', + CRO = 'CRO', + RSK = 'RSK', + AURORA = 'AURORA', + GNO = 'GNO', + DOT = 'DOT', + KSM = 'KSM', + OASIS = 'OASIS', + TEZOS = 'TEZOS', + PALM = 'PALM', + GLMR = 'GLMR', + INTENT = 'INTENT', + EURTENT = 'EURTENT', + GOLDAX = 'GOLDAX', + ZCASH = 'ZCASH', + ZEC = 'ZEC', + ZIL = 'ZIL', + ETC = 'ETC', +} +``` diff --git a/docs/exchange-rates/supported-fiats.md b/docs/exchange-rates/supported-fiats.md new file mode 100644 index 0000000..266c96f --- /dev/null +++ b/docs/exchange-rates/supported-fiats.md @@ -0,0 +1,182 @@ +--- +description: >- + This page lists all the Fiat currencies Tatum supports for Exchange Rate + Submodule. +--- + +# Supported Fiats + +Below of the list of the fiats we support for the Exchange Rate Submodule. + +```typescript +export enum Fiat { + AED = 'AED', + AFN = 'AFN', + ALL = 'ALL', + AMD = 'AMD', + ANG = 'ANG', + AOA = 'AOA', + ARS = 'ARS', + AUD = 'AUD', + AWG = 'AWG', + AZN = 'AZN', + BAM = 'BAM', + BBD = 'BBD', + BDT = 'BDT', + BGN = 'BGN', + BHD = 'BHD', + BIF = 'BIF', + BMD = 'BMD', + BND = 'BND', + BOB = 'BOB', + BRL = 'BRL', + BSD = 'BSD', + BTN = 'BTN', + BWP = 'BWP', + BYN = 'BYN', + BYR = 'BYR', + BZD = 'BZD', + CAD = 'CAD', + CDF = 'CDF', + CHF = 'CHF', + CLF = 'CLF', + CLP = 'CLP', + CNY = 'CNY', + COP = 'COP', + CRC = 'CRC', + CUC = 'CUC', + CUP = 'CUP', + CVE = 'CVE', + CZK = 'CZK', + DJF = 'DJF', + DKK = 'DKK', + DOP = 'DOP', + DZD = 'DZD', + EGP = 'EGP', + ERN = 'ERN', + ETB = 'ETB', + EUR = 'EUR', + FJD = 'FJD', + FKP = 'FKP', + GBP = 'GBP', + GEL = 'GEL', + GGP = 'GGP', + GHS = 'GHS', + GIP = 'GIP', + GMD = 'GMD', + GNF = 'GNF', + GTQ = 'GTQ', + GYD = 'GYD', + HKD = 'HKD', + HNL = 'HNL', + HRK = 'HRK', + HTG = 'HTG', + HUF = 'HUF', + IDR = 'IDR', + ILS = 'ILS', + IMP = 'IMP', + INR = 'INR', + IQD = 'IQD', + IRR = 'IRR', + ISK = 'ISK', + JEP = 'JEP', + JMD = 'JMD', + JOD = 'JOD', + JPY = 'JPY', + KES = 'KES', + KGS = 'KGS', + KHR = 'KHR', + KMF = 'KMF', + KPW = 'KPW', + KRW = 'KRW', + KWD = 'KWD', + KYD = 'KYD', + KZT = 'KZT', + LAK = 'LAK', + LBP = 'LBP', + LKR = 'LKR', + LRD = 'LRD', + LSL = 'LSL', + LTL = 'LTL', + LVL = 'LVL', + LYD = 'LYD', + MAD = 'MAD', + MDL = 'MDL', + MGA = 'MGA', + MKD = 'MKD', + MMK = 'MMK', + MNT = 'MNT', + MOP = 'MOP', + MRO = 'MRO', + MUR = 'MUR', + MVR = 'MVR', + MWK = 'MWK', + MXN = 'MXN', + MYR = 'MYR', + MZN = 'MZN', + NAD = 'NAD', + NGN = 'NGN', + NIO = 'NIO', + NOK = 'NOK', + NPR = 'NPR', + NZD = 'NZD', + OMR = 'OMR', + PAB = 'PAB', + PEN = 'PEN', + PGK = 'PGK', + PHP = 'PHP', + PKR = 'PKR', + PLN = 'PLN', + PYG = 'PYG', + QAR = 'QAR', + RON = 'RON', + RSD = 'RSD', + RUB = 'RUB', + RWF = 'RWF', + SAR = 'SAR', + SBD = 'SBD', + SCR = 'SCR', + SDG = 'SDG', + SEK = 'SEK', + SGD = 'SGD', + SHP = 'SHP', + SLL = 'SLL', + SOS = 'SOS', + SRD = 'SRD', + STD = 'STD', + SVC = 'SVC', + SYP = 'SYP', + SZL = 'SZL', + THB = 'THB', + TJS = 'TJS', + TMT = 'TMT', + TND = 'TND', + TOP = 'TOP', + TRY = 'TRY', + TTD = 'TTD', + TWD = 'TWD', + TZS = 'TZS', + UAH = 'UAH', + UGX = 'UGX', + USD = 'USD', + UYU = 'UYU', + UZS = 'UZS', + VEF = 'VEF', + VND = 'VND', + VUV = 'VUV', + WST = 'WST', + XAF = 'XAF', + XAG = 'XAG', + XAU = 'XAU', + XCD = 'XCD', + XDR = 'XDR', + XOF = 'XOF', + XPF = 'XPF', + YER = 'YER', + ZAR = 'ZAR', + ZMK = 'ZMK', + ZMW = 'ZMW', + ZWL = 'ZWL', +} + +``` diff --git a/docs/fee-estimation/README.md b/docs/fee-estimation/README.md new file mode 100644 index 0000000..08371ad --- /dev/null +++ b/docs/fee-estimation/README.md @@ -0,0 +1,65 @@ +--- +description: >- + The Fee submodule is a part of the Tatum SDK, which allows developers to + interact with various blockchain networks. It specifically provides + functionalities related to retrieving gas fees. +--- + +# โ›ฝ Fee Estimation + +## Introduction + +The Tatum Fee Submodule is a component of the Tatum SDK that provides a simple way to fetch and display the current gas fee for a specific blockchain network. Gas fees are a vital aspect of blockchain transactions, representing the cost required to execute operations on the network. By utilising this submodule, developers can easily retrieve and showcase the current gas fee for various blockchain networks, enabling better transparency and user experience within decentralised applications. + +## Get Started + +```javascript +import { TatumSDK, Network, ApiVersion } from "@tatumio/tatum"; + +// Initialize the Tatum SDK with the desired network and API version +const tatum = await TatumSDK.init({ network: Network.ETHEREUM, version: ApiVersion.V1 }); + +// Fetch the current gas fee +const fee = await tatum.fee.getCurrentFee(); + +// Display the fetched fee in console +console.log(fee.data.gasPrice.fast); +}); + +``` + +## Use Cases + +The Tatum Fee Submodule offers several use cases for developers working with blockchain networks. Some potential applications include: + +#### Transaction Cost Estimation + +Before executing a transaction on a blockchain network, it is essential to estimate the associated gas fee accurately. The Tatum Fee Submodule enables developers to fetch the current fee and use it to calculate the approximate transaction cost. This information allows users to make informed decisions and optimize their transaction parameters accordingly. + +#### User-Friendly Fee Display + +Displaying the current gas fee to end-users within a decentralised application can enhance their understanding of the transaction's cost. The Tatum Fee Submodule simplifies the process of fetching the fee and presenting it in a user-friendly format. Developers can integrate this functionality into their applications to show real-time gas fee updates, increasing transparency and facilitating user engagement. + +#### Gas Fee Comparison + +Comparing gas fees across different blockchain networks is crucial for users seeking the most cost-effective and efficient options. By utilising the Tatum Fee Submodule, developers can fetch and display fees from various supported networks simultaneously. This feature empowers users to evaluate and select networks based on current gas fees, enhancing the overall user experience. + +## Why it's tough to know Gas fees at a point of time + +Determining the precise gas fees at a particular moment can be challenging in the blockchain ecosystem due to several reasons: + +#### Dynamic Fee Market + +Blockchain networks often employ dynamic fee markets where fees fluctuate based on network congestion and demand. Gas fees are determined by a bidding process, where users compete to have their transactions included in the next block. As a result, gas fees can vary significantly within short timeframes, making it difficult to pinpoint the exact fee at any given point. + +#### Lack of Standardisation + +Different blockchain networks utilise varying fee models and calculation methods, further complicating the process of finding gas fees. Each network may have its own unit of measurement, fee structures, and mechanisms for determining transaction costs. This lack of standardisation makes it challenging to provide a unified approach to fetch gas fees across multiple networks. + +#### Network-Specific Implementations + +Fetching gas fees requires interacting with blockchain networks directly through their respective APIs or nodes. Each network may have its own specific implementation for retrieving fee data, including authentication requirements, rate limits, and API endpoints. Navigating these network-specific intricacies can be time-consuming and technically demanding for developers. + +The Tatum Fee Submodule addresses these challenges by providing a simplified and standardised interface to fetch gas fees from supported networks, allowing developers to focus on integrating fee-related functionalities into their applications without dealing with the complexities of individual networks. + +Note: The code provided in the initial question demonstrates a basic usage example of the Tatum Fee Submodule for fetching and displaying the current gas fee on the Ethereum network. diff --git a/docs/fee-estimation/getcurrentfee.md b/docs/fee-estimation/getcurrentfee.md new file mode 100644 index 0000000..350c973 --- /dev/null +++ b/docs/fee-estimation/getcurrentfee.md @@ -0,0 +1,111 @@ +--- +description: >- + This function fetches real-time gas fee data, including slow, medium, and fast + fees, based on the most recent recalculation, providing transparency for + blockchain transaction cost estimation. +--- + +# getCurrentFee + +## Overview + +The `getCurrentFee()` function is a method provided by the Tatum Fee Submodule in the Tatum SDK. It enables developers to fetch the current gas fee for a specific blockchain network. This function facilitates access to real-time fee information, allowing users to make informed decisions about transaction costs and optimize their blockchain interactions. + +#### Syntax + +```javascript +const fee = await tatum.fee.getCurrentFee(); +``` + +#### Note + +This function currently works with the previous version of our api & requires an explicit version initialisation for the main object to be called. + +```javascript +// Some code +const tatum = await TatumSDK.init( +{ network: Network.ETHEREUM, version: ApiVersion.V3 } +); +``` + +## Codepen + +{% embed url="https://codepen.io/tatum-devrel/pen/abQPQoz" %} + +## Response DTO + +```typescript +interface CurrentEvmFee { + /* Chain for the Response */ + chain: Network + + /* gasPrice for slow, medium, fast, baseFee & unit */ + gasPrice: { + slow: string + medium: string + fast: string + baseFee: string + unit: string + } + + /* Last time when the gas fees was Recalculated */ + lastRecalculated: string + + /* This property specifies the block number or block + identifier on the blockchain network on which the current + gas fee data is based. */ + basedOnBlockNumber: string +} +``` + +#### Return Value + +The `getCurrentFee()` function returns a Promise that resolves to an object containing the current gas fee data for the selected network. The specific structure of the returned object may vary depending on the blockchain network and API version being used. + +#### Usage + +1. Initialise the Tatum SDK with the desired network and API version using `TatumSDK.init()`. + +```javascript +const tatum = await TatumSDK.init({ network: Network.ETHEREUM, version: ApiVersion.V3 }); +``` + +2. Call the `getCurrentFee()` function to fetch the current gas fee for the selected network. + +```javascript +const fee = await tatum.fee.getCurrentFee(); +``` + +3. Access the fee data returned by the function to retrieve the gas fee information. + +```javascript +console.log(fee.data.gasPrice.fast); // Display the fast gas fee +``` + +## Supported blockchains + +* ETHEREUM +* BITCOIN +* LITECOIN +* DOGECOIN + +## Example + +The following example demonstrates the usage of the `getCurrentFee()` function within an event listener: + +```javascript +const button = document.getElementById("fetch-fee"); +const feeContainer = document.getElementById("fee-container"); + +button.addEventListener("click", async () => { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM, version: ApiVersion.V3 }); + + const fee = await tatum.fee.getCurrentFee(); + + feeContainer.textContent = `Current Fee: ${fee.data.gasPrice.fast}`; +}); +``` + +In this example, when the "Fetch Fee" button is clicked, the `getCurrentFee()` function is called to fetch the current gas fee for the Ethereum network. The returned fee data is then used to update the content of the `feeContainer` element with the fast gas fee value. + +Note: The example assumes that the HTML structure and event listeners are properly set up as described in the previous sections. Adjust the code according to your specific requirements and chosen blockchain network. diff --git a/docs/fungible-tokens/README.md b/docs/fungible-tokens/README.md new file mode 100644 index 0000000..784b96b --- /dev/null +++ b/docs/fungible-tokens/README.md @@ -0,0 +1,18 @@ +# ๐Ÿช™ Fungible tokens + +Fungible tokens are a type of cryptographic token on the blockchain, which are interchangeable with each other, like traditional fiat currencies such as USD, EUR, or JPY. They are constructed using standard protocols like the ERC-20 for Ethereum, and they serve various purposes, from being used as a currency, to representing voting rights, and more. Fungibility implies that each unit of the token is exactly the same as every other unit. + +### Examples of Fungible Token Use Cases + +1. **Cryptocurrencies:** The most common application of fungible tokens is cryptocurrencies like Bitcoin (BTC) and Ether (ETH). In these systems, each individual token is identical to the next, ensuring any BTC or ETH token you own or receive will hold the same value as any other. +2. **Utility Tokens:** Utility tokens offer users access to a product or service provided by a specific project or platform. An example of this is the Binance Coin (BNB). BNB is used on the Binance exchange platform for trading fees, participating in token sales, and more. +3. #### Stablecoins + + Stablecoins are a type of cryptocurrency designed to minimize volatility. They achieve this by pegging their value to a reserve of assets, typically fiat currencies like USD. Examples of stablecoins include Tether (USDT) and USD Coin (USDC). +4. #### Governance Tokens + + In Decentralized Autonomous Organizations (DAOs), governance tokens are used to grant holders voting rights within the community. One example is Maker (MKR). Holding MKR allows holders to participate in the governance of the Maker Protocol, voting on important issues such as risk parameters. +5. #### Reward Tokens + + Certain platforms offer reward tokens to incentivize user engagement or participation. An instance of this is Compound's COMP token, which is distributed to users as they interact with the protocol. + diff --git a/docs/fungible-tokens/create-a-fungible-token.md b/docs/fungible-tokens/create-a-fungible-token.md new file mode 100644 index 0000000..00e3fec --- /dev/null +++ b/docs/fungible-tokens/create-a-fungible-token.md @@ -0,0 +1,160 @@ +# Create a fungible token + +### Overview + +Creating a fungible token involves defining the parameters of the token, such as its name, symbol, and total supply, within a smart contract on a blockchain network like Ethereum. The distinguishing feature of fungible tokens, created using standards like ERC-20 or BEP-20, is their interchangeability. Each token is identical to the others in its set, meaning they can be exchanged on a one-for-one basis. This is in contrast to non-fungible tokens (NFTs), which are unique and not interchangeable, with each NFT representing a distinct asset or value. + +### How to create a fungible token on the Ethereum Sepolia network + +Use the TatumSDK (`@tatumio/tatum`) to create the token. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Network, Ethereum, ResponseDto, TokenMetadata } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.token.createNewFungibleToken({ + name: 'Test Token', + symbol: 'MY_TKN', + initialHolder: '0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48', + initialSupply: '1000000', + owner: '0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48', + }) + +console.log(result) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM_SEPOLIA }); + const result = await tatum.token.createNewFungibleToken({ + name: 'Test Token', + symbol: 'MY_TKN', + initialHolder: '0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48', + initialSupply: '1000000', + owner: '0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48', + }) + + console.log(result.data); + } catch (error) { + console.error("Error fetching token metadata:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request POST 'https://api.tatum.io/v4/contract/deploy?type=testnet' -H "Content-Type: application/json" -d '{"chain":"ethereum-sepolia","contractType":"fungible","name":"Test Token","symbol":"MY_TKN","initialHolder":"0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48","initialSupply":"1000000","owner":"0x48fa1676cfd0dfa23a71829c4c6d56874a88fa48"}' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```json5 +{ + "txId":"0x6f0ef980ee7c5289d10c8ee8cb5e1763ae72074d20424e2c3258f703c4ee7fba" +} +``` + +
+ +### Use cases of fungible tokens include: + +* **Native Tokens for Platforms/Projects:** For example, Binance Coin (BNB) is the native token of Binance, serving both as a cryptocurrency and a utility token within the platform. It's used for transaction fees, participating in new token sales, and more. +* **Stablecoins:** Tokens like USDT and USDC are examples of stablecoins, designed to maintain a stable value by being pegged to a reserve of assets, typically a fiat currency like USD. This provides stability in the volatile crypto markets. +* **Governance Tokens:** Governance tokens, such as Maker (MKR), grant voting rights within a Decentralized Autonomous Organization (DAO). Holders of these tokens can vote on key aspects of the project, influencing its direction and policies. +* **Reward Tokens:** Certain protocols, like Compound, use fungible tokens (in this case, COMP) as rewards to incentivise user engagement and participation within the platform. These tokens can also grant voting rights, enhancing the protocol's decentralised governance. + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface CreateFungibleToken { + /** + * Address of the fungible token owner + */ + owner: string + /** + * Optional. Address of the fungible token minter, it defaults to the owner address + */ + minter?: string + /** + * Optional. Address of the fungible token pauser, it defaults to the owner address + */ + pauser?: string + /** + * Name of fungible token + */ + name: string + /** + * Symbol of fungible token + */ + symbol: string + /** + * Initial supply of fungible token + */ + initialSupply: string + /** + * Initial holder of fungible token + */ + initialHolder: string + /** + * Optional. Number of decimal places for the fungible token, it defaults to 18 + */ + decimals?: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface TxIdResponse { + /** + * Id of the transaction + */ + txId: string +} +``` +{% endcode %} + +### Supported blockchain networks + +| Network | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | +|

Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai

| diff --git a/docs/fungible-tokens/get-all-fungible-tokens-the-wallet-holds.md b/docs/fungible-tokens/get-all-fungible-tokens-the-wallet-holds.md new file mode 100644 index 0000000..b3793be --- /dev/null +++ b/docs/fungible-tokens/get-all-fungible-tokens-the-wallet-holds.md @@ -0,0 +1,179 @@ +--- +description: >- + This function helps you to fetch all the fungible tokens a wallet holds, all + you have to do is pass the address to the function parameter and chain while + initialising the sdk. +--- + +# Get all fungible tokens the wallet holds + +### Overview + +The "Get all fungible tokens the wallet holds" function is designed to retrieve information about all the fungible tokens stored in a specific wallet. By providing the wallet address as a parameter and initialising the software development kit (SDK) with the appropriate blockchain, this function enables users to fetch data regarding the fungible tokens associated with that particular wallet. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQZjjj" %} + +### How to get fungible tokens on a wallet in the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a balance of the wallet. + +{% tabs %} +{% tab title="Typescript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Network, Ethereum, ResponseDto, FungibleTokenBalance } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.ETHEREUM }) + +const balance: ResponseDto = await tatum.token.getBalance({ + addresses: ['0x78E851C35326c9296485E9720D85CB3Bd153b428'], // replace with your address + }) + +console.log(balance.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="Javascript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const balance = await tatum.token.getBalance({ addresses: ['0x78E851C35326c9296485E9720D85CB3Bd153b428'], // replace with your address + }); + console.log(balance.data); + } catch (error) { + console.error("Error fetching balances of fungible tokens:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +``` +curl --location --request GET 'https://api.tatum.io/v4/data/balances?chain=ethereum&addresses=0x78E851C35326c9296485E9720D85CB3Bd153b428&tokenTypes=fungible' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```json5 +[ + { + chain: 'ethereum-mainnet', + tokenAddress: '0xd110bb8a24b100c37af7310416e685af807c1f10', + type: 'fungible', + lastUpdatedBlockNumber: 8167878, + address: '0x78e851c35326c9296485e9720d85cb3bd153b428', + balance: '0.0006' + }, + { + chain: 'ethereum-mainnet', + tokenAddress: '0x1fcdce58959f536621d76f5b7ffb955baa5a672f', + type: 'fungible', + lastUpdatedBlockNumber: 8348276, + address: '0x78e851c35326c9296485e9720d85cb3bd153b428', + balance: '1' + }, + { + chain: 'ethereum-mainnet', + tokenAddress: '0x558ec3152e2eb2174905cd19aea4e34a23de9ad6', + type: 'fungible', + lastUpdatedBlockNumber: 12136720, + address: '0x78e851c35326c9296485e9720d85cb3bd153b428', + balance: '201.752' + } +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface AddressBalanceDetails { + /** + * List of addresses to check. + */ + addresses: string[] + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface FungibleTokenBalance { + /** + * Blockchain network + */ + chain: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Token type, default 'fungible' (ERC-20). + */ + type: 'fungible' + + /** + * Block number of the last balance update. + */ + lastUpdatedBlockNumber: number + + /** + * Address + */ + address: string + + /** + * Balance of the address. + */ + balance: string +} +``` +{% endcode %} + +### Supported blockchain networks + +| Network | Support | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- | +|

Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai

| Multiple addresses per 1 invocation | + diff --git a/docs/fungible-tokens/get-metadata-of-a-fungible-token.md b/docs/fungible-tokens/get-metadata-of-a-fungible-token.md new file mode 100644 index 0000000..301314e --- /dev/null +++ b/docs/fungible-tokens/get-metadata-of-a-fungible-token.md @@ -0,0 +1,141 @@ +# Get metadata of a fungible token + +### Overview + +Fungible tokens can carry associated metadata, which is a set of data that provides information about the token's properties. Although each token is indistinguishable in value, metadata can specify attributes such as the token's name, symbol, or total supply. In the realm of cryptocurrencies, metadata is often used to create a clearer understanding of the token's purpose or functionality. For instance, a utility token's metadata might detail the specific service or access it provides within its platform. Similarly, a governance token's metadata could illustrate the voting rights or privileges it conveys in a Decentralised Autonomous Organisation (DAO). Thus, metadata provides essential context, enhancing the fungible tokens' usability in diverse scenarios. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGvOoe" %} + +### How to show the metadata of a fungible token on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get the token metadata. + +{% tabs %} +{% tab title="TypeScript" %} +
// yarn add @tatumio/tatum
+import { TatumSDK, Network, Ethereum, ResponseDto, TokenMetadata } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+const response: ResponseDto<TokenMetadata> = await tatum.token.getTokenMetadata({
+        tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
+      })
+
+console.log(response.data)
+
+{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const result = await tatum.token.getTokenMetadata({ + tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + }) + + console.log(result.data); + } catch (error) { + console.error("Error fetching token metadata:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/tokens?tokenAddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&chain=ethereum' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```json5 +{ + "symbol":"USDC", + "name":"USD Coin", + "supply":"26667389920178985", + "decimals":6, + "tokenType":"fungible", + "cap":"undefined" +} +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface TokenAddress { + /** + * Token contract address + */ + tokenAddress: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface TokenMetadata { + /** + * Symbol of the fungible token. + */ + symbol: string + /** + * Full name of the fungible token + */ + name: string + /** + * Total supply of the fungible token. + */ + supply: string + /** + * Number of decimal places for the fungible token. + */ + decimals: number + /** + * Type of the token - fungible + */ + tokenType: string + /** + * Maximum supply cap of the fungible token. + */ + cap: string +} +``` +{% endcode %} + +### Supported blockchain networks + +| Network | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | +|

Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai

| diff --git a/docs/fungible-tokens/show-fungible-token-history-of-a-wallet.md b/docs/fungible-tokens/show-fungible-token-history-of-a-wallet.md new file mode 100644 index 0000000..73152ed --- /dev/null +++ b/docs/fungible-tokens/show-fungible-token-history-of-a-wallet.md @@ -0,0 +1,198 @@ +# Show fungible token history of a wallet + +### Overview + +Fungible token transfers are critical in blockchain networks. They are used as a means of value exchange in cryptocurrency systems like Bitcoin and Ethereum. Beyond just transactions, they're also transferred into smart contracts in DeFi spaces for participation in liquidity pools or lending protocols. In Decentralised Autonomous Organisations (DAOs), governance tokens, a type of fungible token, are transferred to represent voting rights, enabling holders to have a say in network decisions. The versatility of fungible tokens and their transferability underscores the profound utility they bring to the blockchain ecosystem. + +{% embed url="https://codepen.io/tatum-devrel/pen/oNQJMPG" %} + +### How to show the fungible token history of a specific wallet on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a transaction history of the wallet. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Network, Ethereum, ResponseDto, Transaction } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const txs: ResponseDto = await tatum.token.getAllFungibleTransactions({ + addresses: ['0x78E851C35326c9296485E9720D85CB3Bd153b428'], // replace with your address + }) + +console.log(txs.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.token.getAllFungibleTransactions({ + addresses: ['0x78E851C35326c9296485E9720D85CB3Bd153b428'], // replace with your address + }) + console.log(txs.data); + } catch (error) { + console.error("Error fetching wallet history:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/transactions?addresses=0x78E851C35326c9296485E9720D85CB3Bd153b428&chain=ethereum&transactionTypes=fungible' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```json5 +[ + { + "chain":"ethereum-mainnet", + "blockNumber":17463011, + "hash":"0x3509d471bf8362f4bffcfec8d27b0d1d6af3d3520dbd72f2aad61cfb8e22417f", + "transactionType":"fungible", + "transactionIndex":60, + "tokenAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7", + "amount":"3900", + "timestamp":1686561155000, + "address":"0x78e851c35326c9296485e9720d85cb3bd153b428", + "counterAddress":"0x54157126f10ed5019ab2785cd8f1ced207d10346", + "transactionSubtype":"incoming" + } +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAllFungibleTransactionsQuery { + /** + * Token contract address + */ + tokenAddress?: string + /** + * Addresses to fetch. Up to 10 addresses as a comma separated string. + */ + addresses: string[] + /** + * Optional transaction type. If not specified, both incoming and outgoing transactions are returned. + */ + transactionTypes?: TransactionType[] + /** + * Optional from block. If not specified, all transactions are returned from the beginning of the blockchain. + */ + blockFrom?: number + /** + * Optional to block. If not specified, all transactions are returned up till now. + */ + blockTo?: number + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface Transaction { + /** + * Blockchain network + */ + chain: string + /** + * Block number + */ + blockNumber: number + /** + * Transaction hash + */ + hash: string + /** + * Transaction type + */ + transactionType: 'fungible' | 'nft' | 'multitoken' | 'native' | 'internal' + /** + * Transaction sub type + */ + transactionSubtype: 'incoming' | 'outgoing' | 'zero-transfer' + /** + * Index of the transaction in the block + */ + transactionIndex: number + /** + * Address of the token collection + */ + tokenAddress?: string + /** + * The ID of the token involved in the transaction (optional). + */ + tokenId?: string + /** + * Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number. + */ + amount: string + /** + * Transaction timestamp - UTC millis + */ + timestamp: number + /** + * Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions. + */ + address: string + /** + * Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`. + */ + counterAddress?: string +} +``` +{% endcode %} + +### Supported blockchain networks + +| Network | Support | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- | +|

Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai

| Multiple addresses per 1 invocation | diff --git a/docs/nfts/README.md b/docs/nfts/README.md new file mode 100644 index 0000000..159e389 --- /dev/null +++ b/docs/nfts/README.md @@ -0,0 +1,23 @@ +# ๐Ÿต NFTs + +A non-fungible token (NFT) is a unique digital asset that represents ownership of a one-of-a-kind item or piece of content, such as digital art, virtual real estate, or collectibles. Unlike fungible tokens, NFTs are not interchangeable, and each NFT has a distinct value based on its rarity, provenance, and demand for that specific token. + +## Video Guide on how to use NFT Submodule + +In this video guide we have demonstrated how you can use the Check Owner of an NFT function of this NFT Submodule to create a NFT gating app. This video is also helpful to get you started on using this submodule. + +{% embed url="https://youtu.be/byTVqO3eefE" %} +Building an NFT Gated Website. +{% endembed %} + +## Use cases of NFT's + +NFTs provide various benefits and use cases for both businesses and individuals: + +1. **Digital Art and Collectibles**: NFTs have become popular for digital artists and creators, as they can mint unique digital art pieces as NFTs, enabling them to prove ownership, protect their intellectual property, and monetise their creations. Collectors can buy, trade, and showcase their NFT collections, deriving value from their rarity and uniqueness. +2. **Gaming and Virtual Items**: NFTs have transformed the gaming industry, allowing players to own in-game assets such as characters, items, and virtual real estate. These NFT-based assets can be traded, sold, or transferred across different platforms, creating a new economy within the gaming ecosystem. +3. **Tokenized Physical Assets**: NFTs enable businesses to tokenize real-world assets like real estate, luxury goods, or even fine art. This tokenization process facilitates fractional ownership, making it possible for a broader audience to invest in and trade valuable assets that were previously less accessible. +4. **Proof of Authenticity**: NFTs can serve as digital certificates of authenticity for various items, ensuring their provenance and verifying their scarcity. This can be beneficial for businesses dealing with high-value products, such as luxury brands or art dealers, as it can help prevent counterfeiting and create trust in the market. +5. **Royalties and Secondary Sales**: NFTs can be programmed to generate royalties for creators every time their work is resold in the secondary market. This provides a new revenue stream for artists and creators, empowering them to capture more value from their work. + +For common people, NFTs present a new way to participate in the digital economy, enabling them to own, trade, and invest in unique digital assets that can appreciate in value over time. Additionally, NFTs offer a means to support their favorite artists, creators, and brands in a direct and meaningful way. diff --git a/docs/nfts/check-if-the-wallet-owns-a-specific-nft.md b/docs/nfts/check-if-the-wallet-owns-a-specific-nft.md new file mode 100644 index 0000000..9be94f6 --- /dev/null +++ b/docs/nfts/check-if-the-wallet-owns-a-specific-nft.md @@ -0,0 +1,132 @@ +--- +description: >- + This function checks if a wallet own's any or a specific nft from a + collection, you can pass collection address, wallet address & tokenId as an + option parameter. +--- + +# Check if the wallet owns a specific NFT + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQOjoQ" %} +Try this feature +{% endembed %} + +### Overview + +In the rapidly growing world of non-fungible tokens (NFTs), verifying the ownership of a particular NFT is crucial for creators, collectors, and traders alike. This guide introduces you to the operation of checking if a wallet owns a specific NFT, providing an efficient way to confirm the possession of unique digital assets. By leveraging this functionality, you can ensure the accuracy and authenticity of your NFT holdings, make well-informed decisions about buying, selling, or holding NFTs, and navigate the dynamic NFT landscape with greater confidence. Ultimately, this operation empowers you to manage your digital assets more effectively, fostering transparency and trust in your NFT transactions. + +### How to get the owner of the NFT on the Ethereum network + +Use the TatumSDK (`@tatumcom/js`) to check, if the wallet is the owner. + +{% tabs %} +{% tab title="TypeScript" %} +
// yarn add @tatumio/tatum
+import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+const isOwner: boolean = await tatum.nft.checkNftOwner({
+  tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', // replace with your collection
+  tokenId: '1',
+  owner: '0x46efbaedc92067e6d60e84ed6395099723252496' // owner wallet
+})
+
+console.log(isOwner)
+
+{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const isOwner = await tatum.nft.checkNftOwner({ + tokenAddress: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // replace with your collection + tokenId: "1", + owner: "0x46efbaedc92067e6d60e84ed6395099723252496" // owner wallet + }); + console.log(isOwner); + } catch (error) { + console.error("Error checking NFT owner:", error); + } +})(); + + +// Expected outcome +// true +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/owners/address?tokenAddress=0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&tokenId=1&chain=ethereum&address=0x46efbaedc92067e6d60e84ed6395099723252496' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### + +
+ +Expected Response + +```json5 +true +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetTokenOwner { + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Owner address of the NFT token + */ + owner: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response - true or false result + */ + data: boolean + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/nfts/create-multitoken-nft-collection.md b/docs/nfts/create-multitoken-nft-collection.md new file mode 100644 index 0000000..36a001d --- /dev/null +++ b/docs/nfts/create-multitoken-nft-collection.md @@ -0,0 +1,134 @@ +# Create MultiToken NFT Collection + +ERC-1155 is a standard for smart contracts on the Ethereum blockchain, which encompasses the functionality of both ERC-20 (fungible tokens, like cryptocurrencies) and ERC-721 (non-fungible tokens, or NFTs) within a single smart contract. This makes it a MultiToken standard. + +In the ERC-1155 standard, each token is identified by an ID. What makes this different from ERC-721 (where each token also has a unique ID) is that tokens of the same ID in ERC-1155 are interchangeable, just like ERC-20 tokens. This allows for both fungible and non-fungible tokens to be represented within a single contract. + +### Use Cases for ERC-1155 MultiToken Collections + +1. **Video Games**: ERC-1155 tokens can represent a wide variety of assets within a game, such as fungible resources (like in-game currency or consumable items) and non-fungible unique items (like a special character or a limited edition weapon). This can all be done within a single, smart contract. +2. **DeFi Platforms**: A single ERC-1155 contract can manage a variety of tokens, such as governance tokens (fungible) and insurance contracts or loan receipts (non-fungible). +3. **Art and Collectibles**: Just like with ERC-721, artists can mint their artworks as NFTs with ERC-1155. However, with ERC-1155 they can also issue fungible tokens, such as prints or copies, alongside the unique piece. +4. **Real World Assets**: ERC-1155 tokens can represent ownership in real world assets, such as real estate or commodities. The fungible tokens can represent a divisible interest in an asset, while non-fungible tokens can represent unique assets. + +By using the Tatum SDK to create an ERC-1155 MultiToken collection, you're able to manage a complex economy of both fungible and non-fungible tokens with ease. Whether you're developing an intricate in-game economy or creating a platform with diverse types of assets, ERC-1155 offers a versatile solution for digital ownership and trade. + +### How to show create MultiToken NFT Collection (ERC-1155 type) on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a transaction history of the wallet. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx: ResponseDto<{txId: string}> = await tatum.nft.createMultiTokenNftCollection({ + owner: '0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d', // replace with your address +}) + +console.log(tx.data.txId) +// 0x8e564406701caab6258501c794f5c1eece380f673be99b561d626c3d8d81b202 + +// you can get created collection address using this RPC call +const collectionAddress = await tatum.rpc.getContractAddress(tx.data.txId) +console.log(collectionAddress) +// 0x876977006988ce590e219f576077459a49c7318a +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.nft.createMultiTokenNftCollection({ + owner: '0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d', // replace with your address + }); + console.log(txs.data.txId); + // 0x8e564406701caab6258501c794f5c1eece380f673be99b561d626c3d8d81b202 + + const collectionAddress = await tatum.rpc.getContractAddress(tx.data.txId); + console.log(collectionAddress); + // 0x876977006988ce590e219f576077459a49c7318a + } catch (error) { + console.error("Error creating NFT collection:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request POST 'https://api.tatum.io/v4/contract/deploy' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "contractType": "multitoken", + "chain": "ethereum-sepolia", + "owner": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d" +}' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/LYXMBpZ" %} +Try this feature +{% endembed %} + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export interface CreateMultiTokenNftCollection { + /** + * Address of the NFT collection owner + */ + owner: string + /** + * Address of the NFT collection minter, this is optional and defaults to the owner address + */ + minter?: string + /** + * Optional base URI, which will be prepended to the token URI. If not specified, the token should be minted with the URI + */ + baseURI?: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto<{txId: string}> { + /** + * Actual payload of the response + */ + data: {txId: string} + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/nfts/create-nft-collection.md b/docs/nfts/create-nft-collection.md new file mode 100644 index 0000000..e4980f4 --- /dev/null +++ b/docs/nfts/create-nft-collection.md @@ -0,0 +1,149 @@ +# Create NFT Collection + +An NFT, or non-fungible token, is a type of cryptocurrency that represents a unique item or asset. Unlike regular cryptocurrencies such as Bitcoin or Ether, NFTs aren't interchangeable with other tokens of the same type but stand as unique tokens with their own specific value. They leverage blockchain technology to establish provenance and ownership. + +An NFT collection is a group of NFTs, typically bound together by a common theme or brand. Each individual NFT within the collection is unique, but they are all part of the broader collection. Think of it like a collection of paintings from the same artist or a series of collectible toys. + +### Use Cases for NFT Collections + +1. **Art**: Artists can mint their artworks as NFTs and sell them directly to collectors. Each NFT represents a unique piece of art or a limited edition series. +2. **Collectibles**: Virtual collectibles, such as CryptoPunks or NBA Top Shots, are often grouped into collections. Each unique item in the collection is an NFT. +3. **Virtual Real Estate and Goods**: Platforms like Decentraland allow users to own and trade virtual land and assets as NFTs. +4. **Music and Entertainment**: Musicians can mint their albums or songs as NFTs, providing a new way to monetize their work and connect with fans. Movies or show clips can also be tokenized as collectible NFTs. +5. **Identity and Certification**: NFTs can be used to represent ownership or the achievement of something, such as completing a course or owning a specific domain name. + +By creating an NFT collection using the Tatum SDK, you can easily mint, manage, and distribute NFTs on the blockchain. Whether you're an artist launching a new series of artwork, a game developer creating unique in-game items, or a brand creating digital collectibles, the ability to create an NFT collection offers exciting new possibilities for digital ownership and commerce. + +### How to create NFT Collection (ERC-721 type) on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to create the NFT collection. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx: ResponseDto<{txId: string}> = await tatum.nft.createNftCollection({ + name: 'My NFT Collection', + symbol: 'MyNFT', + owner: '0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d', // replace with your address +}) + +console.log(tx.data.txId) +// 0x8e564406701caab6258501c794f5c1eece380f673be99b561d626c3d8d81b202 + +// you can get created collection address using this RPC call +const collectionAddress = await tatum.rpc.getContractAddress(tx.data.txId) +console.log(collectionAddress) +// 0x876977006988ce590e219f576077459a49c7318a +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.nft.createNftCollection({ + name: 'My NFT Collection, + symbol: 'MyNFT' + owner: '0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d', // replace with your address + }); + console.log(txs.data.txId); + // 0x8e564406701caab6258501c794f5c1eece380f673be99b561d626c3d8d81b202 + + const collectionAddress = await tatum.rpc.getContractAddress(tx.data.txId); + console.log(collectionAddress); + // 0x876977006988ce590e219f576077459a49c7318a + } catch (error) { + console.error("Error creating NFT collection:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request POST 'https://api.tatum.io/v4/contract/deploy' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "contractType": "nft", + "chain": "ethereum-sepolia", + "name": "My NFT Collection", + "symbol": "MyNFT", + "owner": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d" +}' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/zYMyagO" %} + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export interface CreateNftCollection { + /** + * Name of the NFT collection, e.g. Bored Ape Yacht Club + */ + name: string + /** + * Symbol of the NFT collection, e.g. BAYC + */ + symbol: string + /** + * Address of the NFT collection owner + */ + owner: string + /** + * Address of the NFT collection minter, this is optional and defaults to the owner address + */ + minter?: string + /** + * Optional base URI, which will be prepended to the token URI. If not specified, the token should be minted with the URI + */ + baseURI?: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto<{txId: string}> { + /** + * Actual payload of the response + */ + data: {txId: string} + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ +### Limitations + diff --git a/docs/nfts/get-all-nfts-in-the-nft-collection.md b/docs/nfts/get-all-nfts-in-the-nft-collection.md new file mode 100644 index 0000000..48d52b7 --- /dev/null +++ b/docs/nfts/get-all-nfts-in-the-nft-collection.md @@ -0,0 +1,168 @@ +# Get all NFTs in the NFT collection + +As the non-fungible token (NFT) market continues to flourish, creators, collectors, and traders need efficient ways to manage and explore their digital collections. This guide introduces you to the operation of retrieving all NFTs in a specific collection, providing a comprehensive view of the unique digital assets grouped together. By leveraging this functionality, you can easily navigate and analyze your NFT collection, gain insights into the themes and trends within your portfolio, and make informed decisions about buying, selling, or holding specific NFTs. Ultimately, this operation enables you to better understand your digital assets, streamlines your NFT management, and empowers you to engage with the NFT market more effectively. + +### How to get NFTs of a collection in the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get all NFTs of the collection. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftTokenDetail} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const nfts: ResponseDto = await tatum.nft.getNftsInCollection({ + collectionAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // replace with your collection +}) + +console.log(nfts.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const nfts = await tatum.nft.getNftsInCollection({ + collectionAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // replace with your collection + }); + console.log(nfts.data); + } catch (error) { + console.error("Error fetching NFT collection:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/collections?collectionAddresses=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&chain=ethereum' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQbKxX" %} + + + +
+ +Expected Response + +```json5 +[ + { + "address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d", + "balance": "2", + "chain": "ethereum-mainnet", + "lastUpdatedBlockNumber": 14086122, + "metadata": { + "description": "# ***\"Sometimes I swear I can see a glimmer of the Sun through all the layers of chaos. It's probably just wishful thinking. There's a lot of that here.\" โ€” Renn Dialos, Alexandria Research Node 557***\n### **1 / 71492 Jupiter DAO Tokens**\n\nThis token represents proportional ownership over Jupiter. Together with other Jupiter DAO Token holders, its owner is able to actively build and govern the planet into its own unique environment.\n\n*Jupiter represents 10.4% of the total voting power for MetaHero Universe's United Planets DAO.*\n\n*[ Token Design by: TheVirtunaut, Odious, Raw & Rendered | Joey Camacho ]*", + "external_url": "https://punkscomic.com", + "image": "ipfs://QmS21WhH94jBnYompXHD1SxS6Gw2bY8E81sTYRktWrYa7a/JUPITER.mp4", + "name": "MetaHero Universe: Jupiter DAO Token" + }, + "metadataURI": "ipfs://QmR9PokA9rnKKUF1uLtZyHYEhExqQU1Z7t8AbovMBxND4U/5", + "tokenAddress": "0x7deb7bce4d360ebe68278dee6054b882aa62d19c", + "tokenId": "5", + "type": "multitoken" + } +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetCollection { + /** + * Collection contract address + */ + collectionAddress: string + /** + * Optional flag to exclude metadata from the response. In this case, only token IDs are returned. Defaults to false. + */ + excludeMetadata?: boolean + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface NftTokenDetail { + /** + * Blockchain network + */ + chain: string + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Token type. Either 'nft' (ERC-721) or 'multitoken' (ERC-1155) + */ + tokenType: 'nft' | 'multitoken' + /** + * Token URI + */ + metadataURI: string + /** + * Token metadata + */ + metadata?: { + name: string + description: string + image: string + [metadataKey: string]: unknown + } +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
Multiple addresses per 1 invocation
NFTs (BAYC,...)
ERC-1155 Tokens
diff --git a/docs/nfts/get-all-nfts-the-wallet-holds.md b/docs/nfts/get-all-nfts-the-wallet-holds.md new file mode 100644 index 0000000..dc9e9a0 --- /dev/null +++ b/docs/nfts/get-all-nfts-the-wallet-holds.md @@ -0,0 +1,178 @@ +--- +description: >- + This function helps you to fetch all the NFT's a wallet holds, all you have to + do is pass the address to the function parameter and chain while initialising + the sdk. +--- + +# Get all NFTs the wallet holds + +The world of non-fungible tokens (NFTs) has witnessed exponential growth, attracting artists, collectors, and investors alike. As users accumulate various NFTs across multiple blockchain networks, it becomes crucial to manage and track their digital collections. This guide introduces you to the operation of obtaining all NFTs associated with a particular address, offering you a comprehensive snapshot of your NFT holdings. By leveraging this functionality, you can effectively monitor your NFT collection, verify ownership, and assess the value of your digital assets. Ultimately, this operation empowers you to take full control of your unique digital assets and manage them with greater ease and efficiency. + +### How to get NFTs on a wallet in the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a balance of the wallet. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftAddressBalance} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const balance: ResponseDto = await tatum.nft.getBalance({ + addresses: ['0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d'], // replace with your address +}) + +console.log(balance.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const balance = await tatum.nft.getBalance({ + addresses: ['0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d'], // replace with your address + }); + console.log(balance.data); + } catch (error) { + console.error("Error fetching NFT balance:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/balances?chain=ethereum&addresses=0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/oNQJyJb" %} + +
+ +Expected Response + +```json5 +[ + { + "address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d", + "balance": "2 + ", + "chain": "ethereum-mainnet", + "lastUpdatedBlockNumber": 14086122, + "metadata": { + "description": "# ***\"Sometimes I swear I can see .... | Joey Camacho ]*", + "external_url": "https://punkscomic.com", + "image": "ipfs://QmS21WhH94jBnYompXHD1SxS6Gw2bY8E81sTYRktWrYa7a/JUPITER.mp4", + "name": "MetaHero Universe: Jupiter DAO Token" + }, + "metadataURI": "ipfs://QmR9PokA9rnKKUF1uLtZyHYEhExqQU1Z7t8AbovMBxND4U/5", + "tokenAddress": "0x7deb7bce4d360ebe68278dee6054b882aa62d19c", + "tokenId": "5", + "type": "multitoken" + } +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface AddressBalanceDetails { + /** + * List of addresses to check. + */ + addresses: string[] + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface NftAddressBalance { + /** + * Balance of the address. + */ + balance: string + /** + * Blockchain network + */ + chain: string + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Token type. Either 'nft' (ERC-721) or 'multitoken' (ERC-1155) + */ + tokenType: 'nft' | 'multitoken' + /** + * Token URI + */ + metadataURI: string + /** + * Token metadata + */ + metadata?: { + name: string + description: string + image: string + [metadataKey: string]: unknown + } + /** + * Block number of the last balance update. + */ + lastUpdatedBlock: number +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
Multiple addresses per 1 invocation
NFTs (BAYC,...)
ERC-1155 Tokens
diff --git a/docs/nfts/get-the-metadata-of-a-specific-nft.md b/docs/nfts/get-the-metadata-of-a-specific-nft.md new file mode 100644 index 0000000..f8811cd --- /dev/null +++ b/docs/nfts/get-the-metadata-of-a-specific-nft.md @@ -0,0 +1,119 @@ +# Get the metadata of a specific NFT + +As non-fungible tokens (NFTs) gain popularity in the digital asset space, it becomes increasingly important for creators, collectors, and traders to have access to detailed information about individual NFTs. This guide introduces you to the operation of retrieving the metadata of a specific NFT, providing valuable insights into the unique properties, characteristics, and history of the digital asset. By leveraging this functionality, you can better understand the provenance, rarity, and artistic attributes of the NFT, make well-informed decisions about buying, selling, or holding it, and navigate the dynamic NFT market with greater confidence. Ultimately, this operation allows you to manage your digital assets more effectively and fosters a deeper appreciation for the unique qualities of each NFT. + +### How to get the metada of the NFT on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get the metadata of the specific NFT. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftTokenDetail} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const metadata: ResponseDto = await tatum.nft.getNftMetadata({ + tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', // replace with your collection + tokenId: '1' +}) + +console.log(metadata.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const metadata = await tatum.nft.getNftMetadata({ + tokenAddress: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // replace with your collection + tokenId: "1" + }); + console.log(metadata.data); + } catch (error) { + console.error("Error getting NFT metadata:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/metadata?chain=ethereum&tokenAddress=0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&tokenIds=1' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyoBYd" %} + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetNftMetadata { + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface NftTokenDetail { + /** + * Blockchain network + */ + chain: string + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Token type. Either 'nft' (ERC-721) or 'multitoken' (ERC-1155) + */ + tokenType: 'nft' | 'multitoken' + /** + * Token URI + */ + metadataURI: string + /** + * Token metadata + */ + metadata?: { + name: string + description: string + image: string + [metadataKey: string]: unknown + } +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/nfts/retrieve-the-owner-of-the-nft.md b/docs/nfts/retrieve-the-owner-of-the-nft.md new file mode 100644 index 0000000..d8dc4eb --- /dev/null +++ b/docs/nfts/retrieve-the-owner-of-the-nft.md @@ -0,0 +1,122 @@ +# Retrieve the owner of the NFT + +In the rapidly evolving world of non-fungible tokens (NFTs), it is essential for creators, collectors, and traders to have the ability to verify the ownership of individual NFTs. This guide introduces you to the operation of retrieving the owner of a specific NFT, providing you with the necessary information to confirm the current holder of the unique digital asset. By leveraging this functionality, you can ensure the authenticity and provenance of the NFT, make informed decisions about buying, selling, or holding it, and navigate the dynamic NFT market with confidence. Ultimately, this operation enables you to manage your digital assets more effectively and maintain the integrity of your NFT transactions. + +### How to get the owner of the NFT on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get an owner of the NFT. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftTransaction} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const owner: ResponseDto = await tatum.nft.getNftOwner({ + tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', // replace with your collection + tokenId: '1' +}) + +console.log(owner.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.nft.getNftOwner({ + tokenAddress: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // replace with your collection + tokenId: "1" + }); + console.log(txs.data); + } catch (error) { + console.error("Error fetching NFT owner:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/owners?tokenAddress=0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&tokenId=1&chain=ethereum' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQorxB" %} + +
+ +Expected Response + +```json5 +[ + "0x46efbaedc92067e6d60e84ed6395099723252496" +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetTokenOwner { + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response - list of the owner address + */ + data: string[] + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/nfts/show-the-nft-history-of-a-wallet.md b/docs/nfts/show-the-nft-history-of-a-wallet.md new file mode 100644 index 0000000..d36864e --- /dev/null +++ b/docs/nfts/show-the-nft-history-of-a-wallet.md @@ -0,0 +1,196 @@ +# Show the NFT history of a wallet + +As non-fungible tokens (NFTs) gain traction in the world of digital assets, it becomes increasingly essential for users to manage and monitor their NFT-related transactions across various blockchain networks. This guide introduces you to obtaining all NFT transactions for a specific wallet, offering a comprehensive view of your NFT wallet history. By leveraging this functionality, you can effectively track the acquisition, transfer, and sale of NFTs associated with your wallet, analyze your trading patterns, and maintain accurate records for tax or accounting purposes. Ultimately, this operation empowers you to take full control of your unique digital assets and navigate the ever-evolving NFT landscape with greater ease and efficiency. + +### How to show the NFT history of a specific wallet on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a transaction history of the wallet. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftTransaction} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const txs: ResponseDto = await tatum.nft.getAllNftTransactionsByAddress({ + addresses: ['0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d'], // replace with your address +}) + +console.log(txs.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.nft.getAllNftTransactionsByAddress({ + addresses: ['0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d'], // replace with your address + }); + console.log(txs.data); + } catch (error) { + console.error("Error fetching wallet history:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/transactions?addresses=0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d&chain=ethereum' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQLKGO?editors=1111" %} + +### + +
+ +Expected Response + +```javascript +[ + { + "chain": "ethereum-mainnet", + "hash": "0x3d5dafbb461ae5b1a485756c345779ed7e0a21ca4d8e2d59fb3453a7c38131b9", + "address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d", + "blockNumber": 17029923, + "transactionIndex": 79, + "transactionType": "nft", + "transactionSubtype": "outgoing", + "amount": "-0.2", + "timestamp": 1681278035000, + "counterAddress": "0x64ceaaf5df1be80f29f35589f096f0714f458b40" + } +] +``` + +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAllNftTransactionsByAddress { + /** + * Addresses to get NFT transactions from. + */ + addresses: string[] + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Optional transaction type. If not specified, both incoming and outgoing transactions are returned. + */ + transactionType?: 'incoming' | 'outgoing' + /** + * Optional from block. If not specified, all transactions are returned from the beginning of the blockchain. + */ + fromBlock?: number + /** + * Optional to block. If not specified, all transactions are returned up till now. + */ + toBlock?: number + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface NftTransaction { + /** + * Blockchain network + */ + chain: string + /** + * Block number + */ + blockNumber: number + /** + * Transaction hash + */ + hash: string + /** + * Transaction type + */ + transactionType: 'incoming' | 'outgoing' | 'zero-transfer' + /** + * Index of the transaction in the block + */ + transactionIndex: number + /** + * Address of the token collection + */ + tokenAddress: string + /** + * Token ID + */ + tokenId: string + /** + * Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number. + */ + amount: string + /** + * Transaction timestamp - UTC millis + */ + timestamp: number + /** + * Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions. + */ + address: string + /** + * Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`. + */ + counterAddress: string +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/nfts/trace-the-history-of-a-specific-nft.md b/docs/nfts/trace-the-history-of-a-specific-nft.md new file mode 100644 index 0000000..3eedb64 --- /dev/null +++ b/docs/nfts/trace-the-history-of-a-specific-nft.md @@ -0,0 +1,207 @@ +# Trace the history of a specific NFT + +As the popularity of non-fungible tokens (NFTs) continues to surge, it becomes increasingly important for creators, collectors, and traders to monitor the transaction history of individual NFTs. This guide introduces you to the operation of obtaining all transactions for a specific NFT, providing a detailed overview of its transfer, trading, and ownership history. By leveraging this functionality, you can gain insights into the provenance and value of an NFT, assess its authenticity, and make informed decisions about buying, selling, or holding it. Ultimately, this operation enables you to navigate the dynamic NFT market with confidence and manage your digital assets more effectively. + +### How to trace the history of a specific NFT on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a transaction history of the NFT. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, NftTransaction} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const txs: ResponseDto = await tatum.nft.getAllNftTransactions({ + tokenId: '14721', + tokenAddress: '0xccb9d89e0f77df3618eec9f6bf899be3b5561a89', // replace with your collection +}) + +console.log(txs.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.nft.getAllNftTransactions({ + tokenId: '14721', + tokenAddress: '0xccb9d89e0f77df3618eec9f6bf899be3b5561a89', // replace with your collection + }); + console.log(txs.data); + } catch (error) { + console.error("Error fetching wallet balance:", error); + } +})(); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl --location --request GET 'https://api.tatum.io/v4/data/transactions?tokenAddress=0xccb9d89e0f77df3618eec9f6bf899be3b5561a89&tokenId=14721&chain=ethereum' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzZXxZ" %} + +
+ +Expected Response + +
[
+  {
+    "chain": "ethereum-mainnet",
+    "hash": "0xbbac7d1a2196c5148958bcf4ef05658f8220ca3f0ce1ff6ae9e87f67b9c940c5",
+    "address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d",
+    "blockNumber": 14568283,
+    "transactionIndex": 34,
+    "transactionType": "nft",
+    "transactionSubtype": "incoming",
+    "amount": "1",
+    "timestamp": 1649733396000,
+    "tokenId": "14721",
+    "tokenAddress": "0xccb9d89e0f77df3618eec9f6bf899be3b5561a89",
+    "counterAddress": "0x0000000000000000000000000000000000000000"
+  },
+  {
+    "chain": "ethereum-mainnet",
+    "hash": "0xbbac7d1a2196c5148958bcf4ef05658f8220ca3f0ce1ff6ae9e87f67b9c940c5",
+    "address": "0x0000000000000000000000000000000000000000",
+    "blockNumber": 14568283,
+    "transactionIndex": 34,
+    "transactionType": "nft",
+    "transactionSubtype": "outgoing",
+    "amount": "-1",
+    "timestamp": 1649733396000,
+    "tokenId": "14721",
+    "tokenAddress": "0xccb9d89e0f77df3618eec9f6bf899be3b5561a89",
+    "counterAddress": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d"
+  }
+]
+
+ +
+ +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAllNftTransactionsQuery { + /** + * Token ID + */ + tokenId: string + /** + * Token contract address + */ + tokenAddress: string + /** + * Optional transaction type. If not specified, both incoming and outgoing transactions are returned. + */ + transactionType?: 'incoming' | 'outgoing' + /** + * Optional from block. If not specified, all transactions are returned from the beginning of the blockchain. + */ + fromBlock?: number + /** + * Optional to block. If not specified, all transactions are returned up till now. + */ + toBlock?: number + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface NftTransaction { + /** + * Blockchain network + */ + chain: string + /** + * Block number + */ + blockNumber: number + /** + * Transaction hash + */ + hash: string + /** + * Transaction type + */ + transactionType: 'incoming' | 'outgoing' | 'zero-transfer' + /** + * Index of the transaction in the block + */ + transactionIndex: number + /** + * Address of the token collection + */ + tokenAddress: string + /** + * Token ID + */ + tokenId: string + /** + * Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number. + */ + amount: string + /** + * Transaction timestamp - UTC millis + */ + timestamp: number + /** + * Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions. + */ + address: string + /** + * Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`. + */ + counterAddress: string +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
NFTs (BAYC,...)
ERC-1155 Tokens
+ diff --git a/docs/notifications/README.md b/docs/notifications/README.md new file mode 100644 index 0000000..0c505db --- /dev/null +++ b/docs/notifications/README.md @@ -0,0 +1,19 @@ +--- +description: What is a Notification on a Blockchain? +--- + +# ๐Ÿ“ฉ Notifications + +A notification on a blockchain is an alert or message sent to users when specific events occur on the blockchain network. These events can include transactions, new blocks, contract executions, or any other actions that can be monitored. Notifications are typically delivered through webhook technology, which sends real-time updates to specified endpoints, such as an application or server. + +{% hint style="success" %} +Using blockchain notifications offers significant benefits compared to reading and parsing blocks manually. Notifications streamline the process by delivering real-time updates on relevant events, reducing resource consumption and improving overall efficiency, while also allowing users to focus on building functionality around these events instead of parsing raw blockchain data. +{% endhint %} + +### Why Should People Use Blockchain Notifications? + +1. **Real-time Updates**: Blockchain notifications provide real-time updates on events, enabling users to stay informed about the latest transactions, blocks, or smart contract activities. This real-time monitoring is crucial for applications that depend on the timely processing of transactions or other blockchain events. +2. **Automate Processes**: Notifications can trigger automated processes in response to specific blockchain events. For example, a user might want to automate the release of digital assets when a certain transaction occurs or trigger a specific function in their application upon the creation of a new block. +3. **Enhanced Security**: By receiving real-time notifications about transactions, users can monitor their accounts or smart contracts for any suspicious activity. In case of an unauthorized transaction, users can take immediate action to mitigate potential risks or losses. +4. **Efficient Resource Utilization**: Instead of constantly polling the blockchain for updates, which consumes resources and bandwidth, notifications deliver updates only when relevant events occur. This approach reduces the load on your infrastructure and improves overall efficiency. +5. **Improved User Experience**: By integrating notifications into your application, you can provide users with timely updates on important events, such as the confirmation of a transaction or the execution of a smart contract. This enhances the user experience by keeping them informed and engaged with your platform. diff --git a/docs/notifications/notification-types/README.md b/docs/notifications/notification-types/README.md new file mode 100644 index 0000000..82b13ae --- /dev/null +++ b/docs/notifications/notification-types/README.md @@ -0,0 +1,2 @@ +# Notification types + diff --git a/docs/notifications/notification-types/address-event.md b/docs/notifications/notification-types/address-event.md new file mode 100644 index 0000000..6a4f3b0 --- /dev/null +++ b/docs/notifications/notification-types/address-event.md @@ -0,0 +1,144 @@ +--- +description: Unlock the Power of ADDRESS_EVENT Notifications for Real-Time Balance Updates +--- + +# Address event + +Monitoring blockchain addresses can be a challenging and resource-intensive task, especially when you need to track balance updates across multiple token types and currencies. However, with Tatum's ADDRESS\_EVENT notification type, you can stay up-to-date with real-time balance updates, allowing you to streamline your operations and enhance the user experience. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.addressEvent({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all ETH transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "ADDRESS_EVENT",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format depends on case whether the address you subscribed on is sending or receiving address.\ +\ +**You subscribed sending address** + +In this case you will get two notifications fired in your webhook listener: + +1. Related to **`fee`** paid for transaction with defined `"type": "fee"` + +```json +{ + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "amount": "-0.000031500000168", + "asset": "ETH", + "blockNumber": 3553692, + "txId": "0xde48b2572176eb3e1c4a2a9abe62c5552f778afcbba1ded8491a2ceb675a6390", + "type": "fee", + "chain": "ethereum-mainnet", + "subscriptionType": "ADDRESS_EVENT" +} +``` + +2. Related to **`transaction`** itself with defined `"type": "native"` or "`fungible"` and etc. + +{% code lineNumbers="true" %} +```json +{ + "address": "0xfAF0F447715dEeDF6Dd79c2fd1F7966F0CC647A1", + "amount": "0.001", + "asset": "ETH", + "blockNumber": 3553692, + "counterAddress": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "txId": "0xde48b2572176eb3e1c4a2a9abe62c5552f778afcbba1ded8491a2ceb675a6390", + "type": "native", + "chain": "ethereum-mainnet", + "subscriptionType": "ADDRESS_EVENT" +} +``` +{% endcode %} + +**You subscribed receiving address** + +In this case you will get only one single notification fired in your webhook listener: + +```json +{ + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "amount": "0.0001", + "asset": "ETH", + "blockNumber": 3553815, + "counterAddress": "0xfAF0F447715dEeDF6Dd79c2fd1F7966F0CC647A1", + "txId": "0x24e3c8d20449958b53186feb1844a022b864cba67bbca792330b5ab71035b499", + "type": "native", + "chain": "ethereum-mainnet", + "subscriptionType": "ADDRESS_EVENT" +} +``` + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Bitcoin | Network.BITCOIN | Network.BITCOIN\_TESTNET | +| Litecoin | Network.LITECOIN | Network.LITECOIN\_TESTNET | +| Dogecoin | Network.DOGECOIN | Network.DOGECOIN\_TESTNET | +| Bitcoin Cash | Network.BITCOIN\_CASH | Network.BITCOIN\_CASH\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLAYTN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | +| XRP | Network.XRP | Network.XRP\_TESTNET | + +### Why Use ADDRESS\_EVENT Notifications? + +The ADDRESS\_EVENT notification type delivers a webhook notification every time there is a balance update on a monitored address. This comprehensive notification system covers incoming and outgoing transactions for native currencies, as well as popular token standards like ERC-20, ERC-721, and ERC-1155. Moreover, it even tracks internal smart contract native transfers, ensuring a seamless monitoring experience across various blockchain activities. + +Here are some key benefits of using ADDRESS\_EVENT notifications: + +#### Real-time Monitoring + +Stay informed about balance changes as they happen. ADDRESS\_EVENT notifications provide real-time updates, enabling you to react promptly to important events and ensuring that your application or platform always has the latest information. + +#### Simplified Tracking + +With support for native currencies, as well as popular token standards like ERC-20, ERC-721, and ERC-1155, ADDRESS\_EVENT notifications simplify the process of tracking balance changes across multiple token types. This feature allows you to focus on building functionality around these events, rather than spending time and resources on parsing raw blockchain data. + +#### Enhanced Security + +By receiving real-time notifications about balance changes, you can monitor your accounts or smart contracts for any suspicious activity. In case of unauthorized transactions or potential security risks, you can take immediate action to mitigate potential losses. + +#### Improved User Experience + +Integrating ADDRESS\_EVENT notifications into your application or platform keeps your users informed about balance updates, enhancing their experience and fostering trust in your service. Timely information empowers users to make informed decisions and interact confidently with your platform. diff --git a/docs/notifications/notification-types/contract-address-log-event.md b/docs/notifications/notification-types/contract-address-log-event.md new file mode 100644 index 0000000..a19cf1a --- /dev/null +++ b/docs/notifications/notification-types/contract-address-log-event.md @@ -0,0 +1,91 @@ +--- +description: Unleashing the Power of CONTRACT_ADDRESS_LOG_EVENT Notifications +--- + +# Contract Address Log Event + +The world of blockchain and smart contracts is evolving at an unprecedented pace. CONTRACT\_ADDRESS\_LOG\_EVENT notifications offer a powerful way to stay informed about specific smart contract events in real-time. By utilizing this feature, you can enhance security, streamline data analysis, improve user experience, and maintain flexibility in your monitoring approach. If you're a developer or business involved in the blockchain space, it's time to harness the power of these webhook notifications to optimize your dApp or service. + + + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredContractAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const monitoredEvent = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' + + const subscription = await tatum.notification.subscribe.contractAddressLogEvent({ + contractAddress: monitoredContractAddress, + event: monitoredEvent, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all monitored event calls on ${monitoredContractAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl -i -X POST \ + https://api.tatum.io/v4/subscription?type=mainnet \ + -H 'Content-Type: application/json' \ + -d '{ + "type": "CONTRACT_ADDRESS_LOG_EVENT", + "attr": { + "contractAddress": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "chain": "ETH", + "event": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "url": "https://" + } + }' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "events": [ + { + "txId": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b", + "logIndex": 1, + "timestamp": 1620914417, + "address": "0x7D3Dda0430471Fe460C07b1ecaB35670eF4ce85b", + "topic_0": "0x4e3275a5d28e4f6383a4f74592ac9e2f1d0331bde8f7f25cf47d4b15323a47b8", + "topic_1": "0x000000000000000000000000f64e82131be01618487da5142fc9d289cbb60e9d", + "topic_2": "0x000000000000000000000000690b9a9e9aa1c9db991c7721a92d351db4fac990", + "data": "0x0000000000000000000000000000000000000000000000000000000000000064" + } + ], + "blockNumber": 110827114, + "chain": "ethereum-mainnet", + "subscriptionType": "CONTRACT_ADDRESS_LOG_EVENT" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | diff --git a/docs/notifications/notification-types/failed-transactions-in-a-block.md b/docs/notifications/notification-types/failed-transactions-in-a-block.md new file mode 100644 index 0000000..b624a6a --- /dev/null +++ b/docs/notifications/notification-types/failed-transactions-in-a-block.md @@ -0,0 +1,88 @@ +--- +description: Stay Ahead of Failed Transactions with FAILED_TXS_PER_BLOCK Notifications +--- + +# Failed transactions in a block + +In the fast-paced world of blockchain, keeping track of failed transactions is crucial for maintaining a secure and efficient platform. Tatum's OUTGOING\_FAILED\_TX notification type provides an invaluable tool to help you stay informed about all transactions in a block that fail to be included in a block. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const subscription = await tatum.notification.subscribe.failedTxsPerBlock({ + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all failed transactions`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "FAILED_TX_PER_BLOCK",
+    "attr": {
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "0.001", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "FAILED_TXS_PER_BLOCK" + "blockNumber": 2913059, + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "mempool": false +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | + +### Why Use FAILED\_TXS\_PER\_BLOCK Notifications? + +FAILED\_TXS\_PER\_BLOCK notifications offer an effective way to monitor failed transactions in real-time. By focusing on transactions that fail to be included in a block, this notification type delivers several key benefits: + +#### Real-time Monitoring + +Stay informed about failed transactions as they occur. FAILED\_TXS\_PER\_BLOCK notifications provide real-time updates, allowing you to react promptly to important events and ensuring your application or platform always has the latest information. + +#### Proactive Problem Solving + +FAILED\_TXS\_PER\_BLOCK notifications help you identify and address the reasons behind failed transactions, such as insufficient gas fees, incorrect contract addresses, or network congestion. By proactively resolving these issues, you can minimize disruptions and maintain a smooth-running platform. + +\ diff --git a/docs/notifications/notification-types/incoming-internal-transactions.md b/docs/notifications/notification-types/incoming-internal-transactions.md new file mode 100644 index 0000000..a8790bd --- /dev/null +++ b/docs/notifications/notification-types/incoming-internal-transactions.md @@ -0,0 +1,80 @@ +--- +description: Enhance Your Address Monitoring with INCOMING_INTERNAL_TX Notifications +--- + +# Incoming internal transactions + +In the dynamic world of blockchain, staying updated with transactions involving smart contracts is essential for maintaining a secure and efficient platform. Tatum's INCOMING\_INTERNAL\_TX notification type offers a powerful solution to help you track incoming native balance updates on a monitored address, which originated from smart contracts.\ + + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.incomingInternalTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing ETH transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "INCOMING_INTERNAL_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "blockNumber": 2913059, + "subscriptionType": "INCOMING_INTERNAL_TX", + "mempool": false, + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "amount": "0.001" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Tron | Network.TRON | Network.TRON\_SHASTA | + +\ diff --git a/docs/notifications/notification-types/incoming-multitokens.md b/docs/notifications/notification-types/incoming-multitokens.md new file mode 100644 index 0000000..fe55692 --- /dev/null +++ b/docs/notifications/notification-types/incoming-multitokens.md @@ -0,0 +1,88 @@ +--- +description: >- + Stay Informed on Multi-Token Transactions with INCOMING_MULTITOKEN_TX + Notifications +--- + +# Incoming MultiTokens + +In the dynamic world of blockchain, keeping track of multi-token transactions is crucial for maintaining a secure and efficient platform. Tatum's INCOMING\_MULTITOKEN\_TX notification type offers a powerful solution to help you stay informed about incoming multi-token transactions (e.g., ERC-1155 transfers) involving a specific address. + +{% hint style="info" %} +A MultiToken (ERC-1155) could be likened to a series of limited edition art prints, where each print belongs to the same series but has its unique edition number. In this scenario, ERC-1155 tokens can represent both the series (fungible aspect) and the individual editions (non-fungible aspect) within a single smart contract, allowing for seamless management and transfer of value. +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.incomingMultitokenTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all incoming MultiToken transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "INCOMING_MULTITOKEN_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of MultiToken is being transferred. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "INCOMING_MULTITOKEN_TX", + "blockNumber": 110827114, + "txId": "0xe118976ba31815f81301341b4e211825bce1393cac1c4215075177b0a6b98930", + "contractAddress": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b", + "tokenId": "1450000023306", + "metadataURI": "https://touhao.bj.bcebos.com/nft/metadata/1450000023306.json" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | diff --git a/docs/notifications/notification-types/incoming-native-transactions.md b/docs/notifications/notification-types/incoming-native-transactions.md new file mode 100644 index 0000000..150bbbc --- /dev/null +++ b/docs/notifications/notification-types/incoming-native-transactions.md @@ -0,0 +1,84 @@ +--- +description: Stay on Top of Your Transactions with INCOMING_NATIVE_TX Notifications +--- + +# Incoming native transactions + +In the world of blockchain, staying updated with incoming transactions is crucial for ensuring smooth operations and an optimal user experience. Tatum's INCOMING\_NATIVE\_TX notification type is designed to help you do just that โ€“ by sending webhook notifications every time there's an incoming native balance update on a monitored address. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.incomingNativeTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all incoming ETH transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "INCOMING_NATIVE_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "0.0001", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x0229338ee05154a406945899fb8c7bef36eb9220", + "subscriptionType": "INCOMING_NATIVE_TX", + "blockNumber": 3553920, + "txId": "0x21c78973a2d47b1910d79b8586c55d13c732dfb41883ee5af4318dafc66a0db9", + "mempool": false +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Bitcoin | Network.BITCOIN | Network.BITCOIN\_TESTNET | +| Litecoin | Network.LITECOIN | Network.LITECOIN\_TESTNET | +| Dogecoin | Network.DOGECOIN | Network.DOGECOIN\_TESTNET | +| Bitcoin Cash | Network.BITCOIN\_CASH | Network.BITCOIN\_CASH\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | +| XRP | Network.XRP | Network.XRP\_TESTNET | + diff --git a/docs/notifications/notification-types/incoming-nfts.md b/docs/notifications/notification-types/incoming-nfts.md new file mode 100644 index 0000000..b1c0f27 --- /dev/null +++ b/docs/notifications/notification-types/incoming-nfts.md @@ -0,0 +1,93 @@ +--- +description: >- + Stay Updated on Non-Fungible Token Transactions with INCOMING_NFT_TX + Notifications +--- + +# Incoming NFTs + +In the ever-expanding world of blockchain, keeping track of non-fungible token (NFT) transactions is crucial for maintaining a secure and efficient platform. Tatum's INCOMING\_NFT\_TX notification type offers a powerful solution to help you stay informed about incoming non-fungible token transactions (e.g., ERC-721 / SPL transfers) involving a specific address. + +{% hint style="info" %} +A non-fungible token (NFT) is a unique digital asset that represents ownership of a one-of-a-kind item or piece of content, such as digital art, virtual real estate, or collectibles. Unlike fungible tokens, NFTs are not interchangeable and each NFT has a distinct value based on its rarity, provenance, and the demand for that specific token. + +\ +There are different NFT standards, most known are ERC-721 on EVM chains or SPL +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.incomingNftTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all incoming NFT transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "INCOMING_NFT_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of NFT is being transferred. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "INCOMING_NFT_TX", + "blockNumber": 110827114, + "txId": "0xe118976ba31815f81301341b4e211825bce1393cac1c4215075177b0a6b98930", + "contractAddress": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b", + "tokenId": "1450000023306", + "metadataURI": "https://touhao.bj.bcebos.com/nft/metadata/1450000023306.json" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | diff --git a/docs/notifications/notification-types/incoming-tokens.md b/docs/notifications/notification-types/incoming-tokens.md new file mode 100644 index 0000000..8f64161 --- /dev/null +++ b/docs/notifications/notification-types/incoming-tokens.md @@ -0,0 +1,86 @@ +--- +description: Stay on Top of Token Transactions with INCOMING_FUNGIBLE_TX Notifications +--- + +# Incoming Tokens + +In the ever-evolving world of blockchain, keeping track of fungible token transactions is essential for maintaining a secure and efficient platform. Tatum's INCOMING\_FUNGIBLE\_TX notification type offers a powerful solution to help you stay informed about incoming fungible token transactions (e.g., ERC-20 transfers) involving a specific address. + +{% hint style="info" %} +A fungible token is a type of digital asset that is interchangeable and holds the same value across all its individual units. Examples of fungible tokens include popular cryptocurrencies like Bitcoin (BTC) and Ether (ETH), as well as ERC-20 tokens like Chainlink (LINK) and USD Coin (USDC), which can be easily exchanged, divided, and combined without altering their overall worth. +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.incomingFungibleTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all incoming token transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "INCOMING_FUNGIBLE_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of Token arrives at the monitored address. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "INCOMING_FUNGIBLE_TX", + "blockNumber": 2913059, + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "contractAddress": "0x743e8b6cc1676adae0e3243b5c011f7139c26128" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | diff --git a/docs/notifications/notification-types/outgoing-failed-transactions.md b/docs/notifications/notification-types/outgoing-failed-transactions.md new file mode 100644 index 0000000..90610bd --- /dev/null +++ b/docs/notifications/notification-types/outgoing-failed-transactions.md @@ -0,0 +1,89 @@ +--- +description: Stay Ahead of Failed Transactions with OUTGOING_FAILED_TX Notifications +--- + +# Outgoing failed transactions + +In the fast-paced world of blockchain, keeping track of failed transactions is crucial for maintaining a secure and efficient platform. Tatum's OUTGOING\_FAILED\_TX notification type provides an invaluable tool to help you stay informed about transactions from monitored addresses that fail to be included in a block. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingFailedTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing failed transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "OUTGOING_FAILED_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "amount": "0.001", + "blockNumber": 2913059, + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "chain": "ethereum-mainnet", + "subscriptionType": "OUTGOING_FAILED_TX", + "currency": "ETH" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | + +### Why Use OUTGOING\_FAILED\_TX Notifications? + +OUTGOING\_FAILED\_TX notifications offer an effective way to monitor failed transactions in real-time. By focusing on transactions that fail to be included in a block, this notification type delivers several key benefits: + +#### Real-time Monitoring + +Stay informed about failed transactions as they occur. OUTGOING\_FAILED\_TX notifications provide real-time updates, allowing you to react promptly to important events and ensuring your application or platform always has the latest information. + +#### Proactive Problem Solving + +OUTGOING\_FAILED\_TX notifications help you identify and address the reasons behind failed transactions, such as insufficient gas fees, incorrect contract addresses, or network congestion. By proactively resolving these issues, you can minimize disruptions and maintain a smooth-running platform. + +\ diff --git a/docs/notifications/notification-types/outgoing-internal-transactions.md b/docs/notifications/notification-types/outgoing-internal-transactions.md new file mode 100644 index 0000000..94cc4e8 --- /dev/null +++ b/docs/notifications/notification-types/outgoing-internal-transactions.md @@ -0,0 +1,80 @@ +--- +description: Enhance Your Smart Contract Monitoring with OUTGOING_INTERNAL_TX Notifications +--- + +# Outgoing internal transactions + +In the dynamic world of blockchain, staying updated with transactions involving smart contracts is essential for maintaining a secure and efficient platform. Tatum's OUTGOING\_INTERNAL\_TX notification type offers a powerful solution to help you track outgoing native balance updates on a monitored smart contract.\ + + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredSmartContract = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingInternalTx({ + address: monitoredSmartContract, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing ETH transactions on ${monitoredSmartContract}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "OUTGOING_INTERNAL_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "blockNumber": 2913059, + "subscriptionType": "OUTGOING_INTERNAL_TX", + "mempool": false, + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "amount": "0.001" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Tron | Network.TRON | Network.TRON\_SHASTA | + +\ diff --git a/docs/notifications/notification-types/outgoing-multitokens.md b/docs/notifications/notification-types/outgoing-multitokens.md new file mode 100644 index 0000000..3c00927 --- /dev/null +++ b/docs/notifications/notification-types/outgoing-multitokens.md @@ -0,0 +1,91 @@ +--- +description: >- + Master Outgoing Multi-Token Transactions with OUTGOING_MULTITOKEN_TX + Notifications +--- + +# Outgoing MultiTokens + +In the rapidly evolving world of blockchain, keeping track of multi-token transactions is essential for maintaining a secure and efficient platform. Tatum's OUTGOING\_MULTITOKEN\_TX notification type offers a powerful solution to help you stay informed about outgoing multi-token transactions (e.g., ERC-1155 transfers) from a specific address. + +{% hint style="info" %} +A MultiToken (ERC-1155) could be likened to a series of limited edition art prints, where each print belongs to the same series but has its unique edition number. In this scenario, ERC-1155 tokens can represent both the series (fungible aspect) and the individual editions (non-fungible aspect) within a single smart contract, allowing for seamless management and transfer of value. +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingMultitokenTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing MultiToken transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl -i -X POST \ + https://api.tatum.io/v4/subscription?type=mainnet \ + -H 'Content-Type: application/json' \ + -d '{ + "type": "OUTGOING_MULTITOKEN_TX", + "attr": { + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "chain": "ETH", + "url": "https://" + } + }' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of MultiToken is being transferred. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "OUTGOING_MULTITOKEN_TX", + "blockNumber": 110827114, + "txId": "0xe118976ba31815f81301341b4e211825bce1393cac1c4215075177b0a6b98930", + "contractAddress": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b", + "tokenId": "1450000023306", + "metadataURI": "https://touhao.bj.bcebos.com/nft/metadata/1450000023306.json" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | diff --git a/docs/notifications/notification-types/outgoing-native-transactions.md b/docs/notifications/notification-types/outgoing-native-transactions.md new file mode 100644 index 0000000..505139d --- /dev/null +++ b/docs/notifications/notification-types/outgoing-native-transactions.md @@ -0,0 +1,81 @@ +--- +description: Master Your Outgoing Transactions with OUTGOING_NATIVE_TX Notifications +--- + +# Outgoing native transactions + +Monitoring outgoing transactions is essential for maintaining a secure and efficient blockchain platform. Tatum's OUTGOING\_NATIVE\_TX notification type offers a powerful solution to help you stay informed about outgoing native balance updates on a monitored address, simplifying your operations and enhancing user experience. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingNativeTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing ETH transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "OUTGOING_NATIVE_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "0.001", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "OUTGOING_NATIVE_TX", + "blockNumber": 3553968, + "txId": "0xac4b590e7668ca2adfd7cceef398d9859de23e61e1a46cfa9f79ac29a1ddc541", + "mempool": false +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Bitcoin | Network.BITCOIN | Network.BITCOIN\_TESTNET | +| Litecoin | Network.LITECOIN | Network.LITECOIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | +| XRP | Network.XRP | Network.XRP\_TESTNET | diff --git a/docs/notifications/notification-types/outgoing-nfts.md b/docs/notifications/notification-types/outgoing-nfts.md new file mode 100644 index 0000000..b2a4f51 --- /dev/null +++ b/docs/notifications/notification-types/outgoing-nfts.md @@ -0,0 +1,91 @@ +--- +description: Monitor Non-Fungible Token Transactions with OUTGOING_NFT_TX Notifications +--- + +# Outgoing NFTs + +In the fast-paced world of blockchain, keeping track of non-fungible token (NFT) transactions is essential for maintaining a secure and efficient platform. Tatum's OUTGOING\_NFT\_TX notification type offers a powerful solution to help you stay informed about outgoing non-fungible token transactions (e.g., ERC-721 / SPL transfers) from a specific address. + +{% hint style="info" %} +A non-fungible token (NFT) is a unique digital asset that represents ownership of a one-of-a-kind item or piece of content, such as digital art, virtual real estate, or collectibles. Unlike fungible tokens, NFTs are not interchangeable and each NFT has a distinct value based on its rarity, provenance, and the demand for that specific token. + +\ +There are different NFT standards, most known are ERC-721 on EVM chains or SPL +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingNftTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing NFT transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "OUTGOING_NFT_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of NFT is being transferred. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "OUTGOING_NFT_TX", + "blockNumber": 110827114, + "txId": "0xe118976ba31815f81301341b4e211825bce1393cac1c4215075177b0a6b98930", + "contractAddress": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b", + "tokenId": "1450000023306", + "metadataURI": "https://touhao.bj.bcebos.com/nft/metadata/1450000023306.json" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | diff --git a/docs/notifications/notification-types/outgoing-tokens.md b/docs/notifications/notification-types/outgoing-tokens.md new file mode 100644 index 0000000..679e847 --- /dev/null +++ b/docs/notifications/notification-types/outgoing-tokens.md @@ -0,0 +1,86 @@ +--- +description: Stay on Top of Token Transactions with OUTGOING_FUNGIBLE_TX Notifications +--- + +# Outgoing Tokens + +In the dynamic world of blockchain, staying updated with fungible token transactions is vital for maintaining a secure and efficient platform. Tatum's OUTGOING\_FUNGIBLE\_TX notification type offers a powerful solution to help you track outgoing fungible token transactions (e.g., ERC-20 / SPL transfers) from a specific address. + +{% hint style="info" %} +A fungible token is a type of digital asset that is interchangeable and holds the same value across all its individual units. Examples of fungible tokens include popular cryptocurrencies like Bitcoin (BTC) and Ether (ETH), as well as ERC-20 tokens like Chainlink (LINK) and USD Coin (USDC), which can be easily exchanged, divided, and combined without altering their overall worth. +{% endhint %} + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.outgoingFungibleTx({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all outgoing token transactions on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "OUTGOING_FUNGIBLE_TX",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +This notification will be fired no matter what kind of Token leaves the monitored address. +{% endhint %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "1", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "subscriptionType": "OUTGOING_FUNGIBLE_TX", + "blockNumber": 2913059, + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "contractAddress": "0x743e8b6cc1676adae0e3243b5c011f7139c26128" +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| Solana | Network.SOLANA | Network.SOLANA\_DEVNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | diff --git a/docs/notifications/notification-types/paid-fee.md b/docs/notifications/notification-types/paid-fee.md new file mode 100644 index 0000000..80fa091 --- /dev/null +++ b/docs/notifications/notification-types/paid-fee.md @@ -0,0 +1,93 @@ +--- +description: Stay Informed About Transaction Fees with PAID_FEE Notifications +--- + +# Paid fee + +In the complex world of blockchain, keeping track of transaction fees is crucial for maintaining a transparent and efficient platform. Tatum's PAID\_FEE notification type provides a valuable tool to help you stay informed about fees paid as part of transactions involving a specific address. + +### How to do it? + +{% tabs %} +{% tab title="TypeScript / JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +(async () => { + const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + + const monitoredAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d' + + const subscription = await tatum.notification.subscribe.paidFee({ + address: monitoredAddress, + url: 'https://' // replace with your handler URL + }) + console.log(`Now you will be notified about all paid fees on ${monitoredAddress}`) +})() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "PAID_FEE",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +### What does the fired webhook look like? + +The fired notification webhook you will receive in your webhook listener will have the following format. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "currency": "ETH", + "chain": "ethereum-mainnet", + "amount": "0.000031500000168", + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "subscriptionType": "PAID_FEE", + "blockNumber": 2913059, + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "mempool": false +} +``` +{% endcode %} + +### Which blockchain networks are supported? + +| Blockchain | Mainnet | Testnet | +| ------------------- | ----------------------------- | ---------------------------------------------------------- | +| Ethereum | Network.ETHEREUM |

Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI

| +| Polygon | Network.POLYGON | Network.POLYGON\_MUMBAI | +| Binance Smart Chain | Network.BINANCE\_SMART\_CHAIN | Network.BINANCE\_SMART\_CHAIN\_TESTNET | +| Celo | Network.CELO | Network.CELO\_ALFAJORES | +| Klaytn | Network.KLAYTN | Network.KLATN\_BAOBAB | +| XRP | Network.XRP | Network.XRP\_TESTNET | +| Tron | Network.TRON | Network.TRON\_SHASTA | + +### Why Use PAID\_FEE Notifications? + +PAID\_FEE notifications offer an effective way to monitor transaction fees in real-time. By focusing on fees paid in transactions involving a specific address, this notification type delivers several key benefits: + +#### Real-time Monitoring + +Stay informed about transaction fees as they occur. PAID\_FEE notifications provide real-time updates, allowing you to react promptly to important events and ensuring your application or platform always has the latest information. + +#### Enhanced Transparency + +Receiving real-time notifications about transaction fees helps you maintain a transparent and accountable platform. Users can clearly see the fees associated with their transactions, fostering trust in your service and promoting a fair ecosystem. + +#### Proactive Fee Management + +PAID\_FEE notifications help you identify and address potential issues related to transaction fees, such as underpayment or overpayment. By proactively resolving these issues, you can minimize disruptions and maintain a smooth-running platform. diff --git a/docs/notifications/notification-workflow/README.md b/docs/notifications/notification-workflow/README.md new file mode 100644 index 0000000..a5cd95b --- /dev/null +++ b/docs/notifications/notification-workflow/README.md @@ -0,0 +1,159 @@ +# Notification workflow + +Webhooks are automated messages sent from applications when certain events occur. In this case, the TatumSDK webhook system enables you to receive notifications about balance update events for a specific Ethereum address. To better understand the workflow, let's break it down into steps and present it in a simple guide. Then, we'll add a UML diagram to visualise the process. + +### Webhook Workflow Guide + +1. **Create a subscription**: Use the TatumSDK (@tatumio/tatum) to create a subscription for address events. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const subscription = await tatum.notification.subscribe.addressEvent({ + address: '0xF64E82131BE01618487Da5142fc9d289cbb60E9d', // replace with your address + url: 'https://' // replate with your URL handler +}); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "ADDRESS_EVENT",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +This function returns an object with an `id` property - a string identifier of the created subscription. + +{% hint style="info" %} +Playing with curl and having a need to define type of net, please, use query parameter `type` with `testnet` or `mainnet` values.\ +\ +Example: `https://api.tatum.io/v4/subscription?type=mainnet`\ +\ +If you do not use it explicitly `mainnet` is set by default. +{% endhint %} + +2. **Monitor the address**: Tatum starts monitoring the specified address for any balance update events happening on the Ethereum blockchain. +3. **Trigger the webhook**: Once Tatum detects an event, it fires a notification as an HTTP POST request to the webhook listener URL defined in the subscription. The request includes a JSON payload with the event details. Should you have specific access controls in place, you can whitelist these Tatum IP addresses ([TXT](https://ips.tatum.com/ips.txt) |ย [JSON](https://ips.tatum.com/ips.json)) that will fire requests to your application. +4. **Unsubscribe from the notification**: The user can unsubscribe from the notification by calling `tatum.notification.unsubscribe(id)`. +5. **List fired webhooks**: Users can list all fired webhooks by calling the `tatum.notification.getAllExecutedWebhooks()` operation. + +### UML Diagram + +Here's a UML diagram that focuses on the flow of subscribing, receiving events, and firing notifications. Code examples are included in the boxes for each step. + +```css ++------------------------+ +------------------------+ +| | | | +| 1. User Subscribes | | 2. Monitor Address | +| | | | +| Code example: | | (Handled by Tatum) | +| | | | +| tatum.notification | +-----------+------------+ +| .subscribe | | +| .addressEvent({ +--------------------->| +| address: '0xF64E8...'| | +| url: 'https://das...'| | +| }); | | ++------------------------+ | + | + +---------------------+ | + | | | + | Event Detected on |<----------------------+ + | the Address +---------------------->| + +---------------------+ | + | + | + | + v + +----------+----------+ + | | + | 3. Process Event | + | (Tatum) & | + | Fire | + | Notification | + | | + | (Handled by | + | Webhook | + | Listener) | + | | + | Example | + | Payload: | + | { | + | "type": "BALANCE", | + | "amount": "0.5" | + | } | + +---------------------+ +``` + +In this diagram, the following steps are shown: + +1. **Create subscription**: The user creates a subscription using the TatumSDK with the specified Ethereum address and webhook listener URL. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = TatumSDK.init({network: Network.ETHEREUM}) + +const subscription = await tatum.notification.subscribe.addressEvent({ + address: '0xF64E82131BE01618487Da5142fc9d289cbb60E9d', // replace with your address + url: 'https://' // replate with your URL handler +}); +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "ADDRESS_EVENT",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +2. **Monitor Address**: Tatum monitors the specified address for balance update events happening on the Ethereum blockchain. +3. **Receive & Fire Notification**: The webhook listener receives the event and processes the notification. An example JSON payload is provided in the diagram. Should you have specific access controls in place, you can whitelist these Tatum IP Addresses ([TXT](https://ips.tatum.com/ips.txt) |ย [JSON](https://ips.tatum.com/ips.json)) that will fire requests to your application. + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d", + "amount": "0.001", + "asset": "ETH", + "blockNumber": 2913059, + "counterAddress": "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990", + "txId": "0x062d236ccc044f68194a04008e98c3823271dc26160a4db9ae9303f9ecfc7bf6", + "type": "native", + "chain": "ethereum-mainnet", + "subscriptionType": "ADDRESS_EVENT" +} +``` +{% endcode %} diff --git a/docs/notifications/notification-workflow/get-all-existing-monitoring-subscriptions.md b/docs/notifications/notification-workflow/get-all-existing-monitoring-subscriptions.md new file mode 100644 index 0000000..68a2cd0 --- /dev/null +++ b/docs/notifications/notification-workflow/get-all-existing-monitoring-subscriptions.md @@ -0,0 +1,105 @@ +# Get all existing monitoring subscriptions + +Getting all existing monitoring subscriptions means retrieving a list of all the active webhook subscriptions that have been created through Tatum. Each subscription in the list represents a blockchain address being monitored for events, such as balance updates or contract interactions, along with the associated webhook listener URL to which the notifications are sent. + +When you request to get all existing monitoring subscriptions, Tatum returns a collection of subscription objects. Each object typically includes information such as the subscription identifier, the monitored blockchain address, the webhook listener URL, and any additional configuration or filters applied to the subscription. + +This functionality is useful for managing and reviewing your current webhook subscriptions, allowing you to keep track of which addresses are being monitored and the corresponding webhook listener URLs. By examining the list of existing subscriptions, you can ensure that you have the desired monitoring configurations in place and make any necessary adjustments or updates to your webhook subscriptions. + +### How to get all existing/active notifications + +When you request to get all active notifications using the `tatum.notification.`getAll`()` operation, Tatum returns a collection of active notifications that you have for monitoring the specified blockchain address(es) and detecting events such as balance updates or contract interactions. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, NotificationSubscription, ResponseDto} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const {status, data}: ResponseDto = await tatum.notification.getAll() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl -i -X GET \ + 'https://api.tatum.io/v4/subscription?pageSize=10&type=mainnet' +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +{% hint style="info" %} +Playing with curl and having a need to define type of net, please, use query parameter `type` with `testnet` or `mainnet` values.\ +\ +Example: `https://api.tatum.io/v4/subscription?pageSize=10&type=mainnet`\ +\ +If you do not use it explicitly `mainnet` is set by default. +{% endhint %} + +### Method parameters + +The method accepts the optional object with the following properties. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAllSubscriptionsQuery { + /** + * Number of records to return. The default is 10. + */ + pageSize?: number + /** + * Number of records to skip. The default is 0. + */ + offset?: number + /** + * Address to filter by. + */ + address?: string +} +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Subscription response + +The methods response has the following format. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface NotificationSubscription { + /** + * ID of a subscription. + */ + id: string + /** + * Blockchain network. + */ + network: Network + /** + * URL of the webhook listener. + */ + url: string + /** + * Type of notification subscription. + */ + type: NotificationType + /** + * Address to monitor, valid for some of the types only. + */ + address?: string +} +``` +{% endcode %} +{% endtab %} +{% endtabs %} diff --git a/docs/notifications/notification-workflow/get-all-sent-notifications.md b/docs/notifications/notification-workflow/get-all-sent-notifications.md new file mode 100644 index 0000000..5a4b472 --- /dev/null +++ b/docs/notifications/notification-workflow/get-all-sent-notifications.md @@ -0,0 +1,184 @@ +# Get all sent notifications + +Getting all sent notifications means retrieving a list of all webhook notifications that have been triggered and sent by the Tatum system to the specified webhook listener URL. This list typically includes information about each fired webhook, such as the event details, timestamp, subscription identifier, and the status of the webhook (e.g., whether it was successfully delivered or encountered an error). + +This functionality is useful for maintaining an overview of past webhook events, analyzing the event history, troubleshooting issues, or reconciling data between the Tatum system and your application. By examining the list of fired webhooks, you can gain insights into the events that have occurred on the monitored address(es) and identify any potential issues or discrepancies in your system's handling of these events. + +### How to get all sent notifications + +When you request to get all fired webhooks using the `tatum.notification.getAllExecutedWebhooks()` operation, the Tatum system returns a collection of webhook events that have been triggered as a result of monitoring the specified blockchain address(es) and detecting events such as balance updates or contract interactions. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, Webhook, ResponseDto} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const {status, data}: ResponseDto = await tatum.notification.getAllExecutedWebhooks() +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +{% code overflow="wrap" lineNumbers="true" %} +```bash +curl -i -X GET \ + 'https://api.tatum.com/v1/subscription/webhook?pageSize=10&type=mainnet' +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +using System.Text.Json; +using Tatum; +using Tatum.Core; +using Tatum.Notifications.Models.Responses; + +// Initialize Tatum SDK +TatumSdk tatumSdk = await TatumSdk.InitAsync(); + +Result> executedWebhooks = + await tatumSdk.Notifications.GetAllExecutedWebhooks(); + +Console.WriteLine( + JsonSerializer.Serialize( + executedWebhooks.Value, + new JsonSerializerOptions() { WriteIndented = true} + ) +); +``` +{% endtab %} +{% endtabs %} + +{% hint style="info" %} +Playing with curl and having a need to define type of net, please, use query parameter `type` with `testnet` or `mainnet` values.\ +\ +Example:`https://api.tatum.io/v4/subscription/webhook?pageSize=10&type=mainnet`\ +\ +If you do not use it explicitly `mainnet` is set by default. +{% endhint %} + +### Method parameters + +The method accepts the optional object with the following properties. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAllExecutedWebhooksQuery { + /** + * The number of items to return per page. Defaults to 10. + */ + pageSize?: number + /** + * The page offset. Defaults to 0. + */ + offset?: number + /** + * Order of the returned items. 'desc' means the most recent items are returned first. Defaults to 'desc'. + */ + direction?: 'asc' | 'desc' + /** + * Filter failed notifications. If the present method will return only successful or failed results based on the filterFailed field. + */ + filterFailed?: boolean +} +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Webhook response + +The methods response has the following format. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface Webhook { + // Type of the subscription + type: NotificationType + // Id of the notification + id: string + // Id of the subscription + subscriptionId: string + // The URL on which is notifications request sent + url: string + // The webhook payload + data: { + // Monitored address + address: string + // Amount of the transaction + amount: string + // The asset of the notification + asset: string + // The number of the block in which the transaction occurs + blockNumber: number + // Transaction hash + txId: string + // Type of the notification + type: string + // Network of the notification + chain: string + // Type of the subscription + subscriptionType: NotificationType + } + // Next notification execution try time - Unix timestamp + nextTime: number + // Notification execution time - Unix timestamp + timestamp: number + // Number of retries in case of the failed attempts in the past + retryCount: number + // Flag indicating whether this notification was successful or not + failed: boolean + // Response from the server in case the notification was unsuccessful + response: { + code: number + data: string + networkError: boolean + } +} + +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Example + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": "64133ffb2367c7fb4fdeb0cf", + "subscriptionId": "64133c4b2aef5483132f9d40", + "url": "https://dashboard.tatum.io/webhook-handler", + "type": "FAILED_TXS_PER_BLOCK", + "data": { + "address": "0x3a88ededf304949c46d1380f6960bc1de94b9dcf", + "amount": "0", + "asset": "KLAY", + "blockNumber": 117406122, + "counterAddress": "0xfdeedbb2fe5b48d5b49e435ba00e0358740d0cf5", + "txId": "0xa3d2bb94d1faf6e3ae85c869e73cbb8eedb73f0b0feb35601e982c087c2e3f91", + "type": "native", + "chain": "klaytn-baobab", + "subscriptionType": "FAILED_TXS_PER_BLOCK", + }, + "nextTime": 1678983161545, + "timestamp": 1678983163000, + "retryCount": 2, + "failed": true, + "response": { + "code": 404, + "data": "NOT FOUND", + "networkError": false + } +} +``` +{% endcode %} diff --git a/docs/notifications/notification-workflow/start-monitoring-of-the-address.md b/docs/notifications/notification-workflow/start-monitoring-of-the-address.md new file mode 100644 index 0000000..eabb24d --- /dev/null +++ b/docs/notifications/notification-workflow/start-monitoring-of-the-address.md @@ -0,0 +1,116 @@ +# Start monitoring of the address + +Starting to monitor an address means that the Tatum system begins observing the specified blockchain address for any changes, particularly balance updates. When monitoring an address, Tatum listens for incoming transactions, outgoing transactions, and internal contract interactions that may affect the balance of the address. + +{% hint style="info" %} +In the context of Ethereum or any other EVM blockchain, monitoring an address involves tracking the Ethereum blockchain for transactions that involve the given address either as a sender or a receiver. The system also checks for interactions with smart contracts that may change the address's balance, such as token transfers or contract executions. +{% endhint %} + +When an event related to the address is detected, Tatum triggers the webhook, sending a notification to the user's specified webhook listener URL. This allows users to receive real-time updates about events occurring on the monitored address, enabling them to react promptly to any changes in their address's balance. + +### How to start with address monitoring + +Use the TatumSDK (@tatumio/tatum) to create a subscription for address events. + +{% hint style="info" %} +All possible types of notifications with detailed descriptions can be found [here](../notification-types/). +{% endhint %} + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, AddressBasedNotification} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const subscription: ResponseDto = await tatum.notification.subscribe.addressEvent({ + address: '0xF64E82131BE01618487Da5142fc9d289cbb60E9d', // replace with your address + url: 'https://' // replate with your URL handler +}) +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X POST \
+  https://api.tatum.io/v4/subscription?type=mainnet \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "type": "ADDRESS_EVENT",
+    "attr": {
+      "address": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
+      "chain": "ETH",
+      "url": "https://<YOUR_WEBHOOK_URL>"
+    }
+  }'
+
+{% endtab %} +{% endtabs %} + +This function returns an object with a `id` property - a string identifier of the created subscription. Store this identifier in order to stop the monitoring of this address in the future. + +{% hint style="info" %} +Playing with curl and having a need to define type of net, please, use query parameter `type` with `testnet` or `mainnet` values.\ +\ +Example: `https://api.tatum.io/v4/subscription?type=mainnet`\ +\ +If you do not use it explicitly `mainnet` is set by default. +{% endhint %} + +{% hint style="info" %} +You can also use [Get all existing monitoring subscriptions](get-all-existing-monitoring-subscriptions.md) operation to get the correct `id`. +{% endhint %} + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface AddressBasedNotification { + /** + * ID of a subscription. + */ + id: string + /** + * Monitored address. + */ + address: string + /** + * URL of a webhook listener. + */ + url: string +} +``` +{% endcode %} + +### Troubleshooting + +#### The address is already subscribed for a blockchain + +If the same address is already subscribed to a notification type, the method call will fail with the following message: + +`Subscription for type ADDRESS_EVENT on the address id 0xbaf6dc2e647aeb6f510f9e318856a1bcd66c5e19 and currency ETH already exists.` + +> #### ๐Ÿšง Only 1 unique address per notification type on a blockchain can be subscribed at the same time for the same user + +#### Invalid format of the address + +If the submitted address is in an invalid format it will respond with the following error message: + +`address must be a valid ETH address. Address must start with 0x and must contain 40 hexadecimal characters after and have the correct checksum.` + +> #### ๐Ÿšง Submitted address should be in valid format. diff --git a/docs/notifications/notification-workflow/stop-monitoring-of-the-address.md b/docs/notifications/notification-workflow/stop-monitoring-of-the-address.md new file mode 100644 index 0000000..23045b0 --- /dev/null +++ b/docs/notifications/notification-workflow/stop-monitoring-of-the-address.md @@ -0,0 +1,49 @@ +# Stop monitoring of the address + +Stopping the monitoring of an address means that the Tatum system will no longer push notifications via webhooks for any changes related to that address. Note that this only stops the Notification for a particular address which you are willing to stop monitoring for, incase + +{% hint style="info" %} +In the context of Ethereum or any other EVM chains, stopping the monitoring of an address means that Tatum will no longer track the Ethereum blockchain for transactions involving the given address, either as a sender or a receiver. The system will also discontinue checking for interactions with smart contracts that may change the address's balance, such as token transfers or contract executions. +{% endhint %} + +### How to stop monitoring of the address + +To stop monitoring an address, you can unsubscribe from the webhook notification by calling `tatum.notification.unsubscribe(id)` using the subscription identifier. Once unsubscribed, the Tatum system will no longer send notifications to the specified webhook listener URL about events occurring on the monitored address. + +{% tabs %} +{% tab title="JavaScript / TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +await tatum.notification.unsubscribe('YOUR_SUBSCRIPTION_ID') +``` +{% endcode %} +{% endtab %} + +{% tab title="curl" %} +
curl -i -X DELETE \
+  https://api.tatum.io/v4/subscription/YOUR_SUBSCRIPTION_ID \
+  -H 'Content-Type: application/json'
+
+{% endtab %} +{% endtabs %} + +{% hint style="info" %} +Playing with curl and having a need to define type of net, please, use query parameter `type` with `testnet` or `mainnet` values.\ +\ +Example:`https://api.tatum.io/v4/subscription/{id}?type=mainnet`\ +\ +If you do not use it explicitly `mainnet` is set by default. +{% endhint %} + +### Troubleshooting + +### Invalid subscription id + +If the subscription id is invalid, the following message is returned: + +`id should be valid id and 24 characters long, e.g. 6398ded68bfa23a9709b1b17` diff --git a/docs/notifications/supported-types-and-blockchain-networks.md b/docs/notifications/supported-types-and-blockchain-networks.md new file mode 100644 index 0000000..f4b2300 --- /dev/null +++ b/docs/notifications/supported-types-and-blockchain-networks.md @@ -0,0 +1,69 @@ +# Supported types and blockchain networks + +### Types of notifications you can monitor + +Tatum supports various types of notifications on a chain, which are designed to cover a wide range of blockchain events. These are the notifications types we offer : + +
+ +Incoming Transaction Notifications ๐Ÿ“ญ : + +1. [**Incoming Native Transactions**](notification-types/incoming-native-transactions.md)**:** This notification is triggered when an address you are subscribed to, receives some [Native Token](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md) from any address. +2. [**Incoming Internal Transactions**](notification-types/incoming-internal-transactions.md)**:** This notification is triggered when an address you are subscribed to, receives an [Internal transaction](../../learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md) (such as transfer an asset by a smart contract). +3. [**Incoming Fungible Transactions**](notification-types/incoming-tokens.md)**:** This notification is triggered when an address you are subscribed to, receives a [Fungible token](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md) from any address. +4. [**Incoming NFT Transactions**](notification-types/incoming-nfts.md): This notification is triggered when an address you are subscribed to, receives a [Non Fungible Token](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md) (NFT's) from any address. +5. [**Incoming MultiToken Transactions**](notification-types/incoming-multitokens.md): This notification is triggered when an address you are subscribed to, receives [MultiToken](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md) from any address. + +
+ +
+ +Outgoing Transaction Notifications โœˆ๏ธ : + +1. [**Outgoing Native Transactions**](notification-types/outgoing-native-transactions.md): This notification is triggered when an address you are subscribed to, sends some [Native Token](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md) to any address. +2. [**Outgoing Internal Transactions**](notification-types/outgoing-internal-transactions.md): This notification is triggered when an smart contract address you are subscribed to, sends assets to another address ([Internal transaction](../../learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md)). +3. [**Outgoing Fungible Transactions**](notification-types/outgoing-nfts.md): This notification is triggered when an address you are subscribed to, send's [Fungible tokens](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md) to any address. +4. [**Outgoing NFT Transactions**](notification-types/outgoing-nfts.md): This notification is triggered when an address you are subscribed to, sends a [Non Fungible Token](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md) (NFT's) to any address. +5. [**Outgoing MultiToken Transaction**](notification-types/outgoing-multitokens.md): This notification is triggered when an address you are subscribed to, sends a [MultiToken](../../learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md) to any address. +6. [**Outgoing Failed Transactions**](notification-types/outgoing-failed-transactions.md): This notification is triggered when an address you are subscribed to, initiates any transaction but it failed due to any [reason](../../learn-blockchain/basics/what-are-transactions/what-are-the-reasons-a-transaction-fails.md). + +
+ +
+ +Special Abstraction Notifications ๐Ÿ”” : + +1. [**Address Events**](notification-types/address-event.md): This notification is triggered when a user either receives or sends any token to any address on blockchain. +2. [**Paid Fee**](notification-types/paid-fee.md): This notification is triggered when a fee is paid as part of a transaction involving a specific address. +3. [**Failed Transactions in a Block** ](notification-types/failed-transactions-in-a-block.md): This notification is triggered when a block containing failed transactions is detected. This notification can be useful for monitoring and analysing failed transactions within specific blocks. +4. [**Contract Address Log Event :**](notification-types/contract-address-log-event.md) This notification allows you to monitor specific custom log events of a smart contract. + +
+ +These notification types allow users to monitor a wide range of events on the blockchain, enabling them to build responsive and efficient applications. + +### Blockchain protocols you can work with + +{% hint style="info" %} +Every type of notification has its [own guide](notification-types/), where all the supported blockchain for that type is mentioned. +{% endhint %} + +Each of the notification types provided by Tatum can be used across various blockchains, depending on the blockchain family. These families include + +1. UTXO (Unspent Transaction Output) chains : + 1. Bitcoin + 2. Litecoin + 3. Dogecoin + 4. Bitcoin Cash +2. EVM (Ethereum Virtual Machine) chains : + 1. Ethereum + 2. Binance Smart Chain + 3. Polygon + 4. Celo + 5. Klaytn +3. Other Blockchains + 1. Solana + 2. XRP + 3. Tron + +By offering compatibility with different blockchain families, Tatum ensures that users can effectively monitor and respond to a diverse range of events, irrespective of the underlying blockchain technology diff --git a/docs/rpc/README.md b/docs/rpc/README.md new file mode 100644 index 0000000..a5cd2ce --- /dev/null +++ b/docs/rpc/README.md @@ -0,0 +1,28 @@ +--- +description: >- + The RPC (Remote Procedure Call) submodule is an essential component in + blockchain development that enables communication and interaction with the + blockchain network. +--- + +# โš™ RPC + +## Overview + +RPC in blockchain development refers to the protocol and mechanism used to connect to a blockchain network and perform operations remotely. It allows developers to interact with the blockchain without running a full node locally. RPC provides a standardised interface to communicate with the blockchain network, making it easier to build decentralised applications (DApps) and interact with smart contracts. + +## Common Use Cases of RPC in Blockchain Development: + +1. Querying Blockchain Data: RPC allows developers to retrieve information from the blockchain network, such as transaction details, account balances, contract data, and block information. This data is crucial for building various applications and services on top of the blockchain. +2. Sending Transactions: RPC enables developers to create and send transactions to the blockchain network. This is essential for initiating cryptocurrency transfers, executing smart contract functions, or interacting with decentralised applications. +3. Deploying Smart Contracts: Through RPC, developers can deploy their smart contracts onto the blockchain network. They can specify the contract's bytecode, constructor parameters, and other relevant details to create a new instance of the smart contract. +4. Interacting with Smart Contracts: RPC allows developers to invoke functions and interact with deployed smart contracts. They can read data from the contract, modify state variables, and trigger specific actions defined in the contract's code. +5. Managing Accounts and Wallets: RPC facilitates the management of user accounts and wallets on the blockchain network. Developers can create new accounts, import existing ones, sign transactions, and manage cryptographic keys securely. + +## Benefits of Using RPC in Blockchain Development: + +1. Simplified Transaction Handling: By utilising RPC, developers can construct and send transactions easily, abstracting away the complexities of cryptography and blockchain protocol intricacies. +2. Seamless Smart Contract Integration: RPC simplifies the process of interacting with smart contracts, enabling developers to build DApps and execute contract functions with ease. +3. Enhanced Flexibility: RPC allows developers to choose between different implementations and configurations of the blockchain network, providing flexibility in deploying and interacting with their applications. + +In conclusion, the RPC submodule plays a crucial role in blockchain development by providing a standardised mechanism for communicating with the blockchain network. It enables developers to query data, send transactions, deploy smart contracts, interact with existing contracts, and manage accounts and wallets efficiently. Utilizing RPC simplifies the development process, enhances flexibility, and empowers developers to build robust and user-friendly decentralized applications on the blockchain. diff --git a/docs/rpc/evm-blockchains/README.md b/docs/rpc/evm-blockchains/README.md new file mode 100644 index 0000000..c042063 --- /dev/null +++ b/docs/rpc/evm-blockchains/README.md @@ -0,0 +1,39 @@ +--- +description: >- + EVM blockchains refer to a specific category of blockchain networks that + implement the Ethereum Virtual Machine (EVM) protocol. +--- + +# EVM Blockchains + +The EVM is a decentralized virtual machine that enables the execution of smart contracts and decentralized applications (DApps) on the blockchain. EVM blockchains are characterized by their ability to execute Ethereum-compatible smart contracts, utilize the same bytecode format, and offer a similar set of functionalities as the Ethereum network. Some examples of EVM blockchains include Ethereum, Binance Smart Chain (BSC), Polygon (MATIC), and many other networks compatible with Ethereum's ecosystem. + +Blockchains like Ethereum (ETH), Celo (CELO), Polygon (MATIC), Binance Smart Chain (BSC), and Harmony (ONE), which do not support sending multiple transactions from multiple addresses at once, there are two options to manage virtual accounts within your app: + +{% content-ref url="ethereum-rpc-documentation/" %} +[ethereum-rpc-documentation](ethereum-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="polygon-rpc-documentation/" %} +[polygon-rpc-documentation](polygon-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="haqq-rpc-documentation/" %} +[haqq-rpc-documentation](haqq-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="optimism-rpc-documentation/" %} +[optimism-rpc-documentation](optimism-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="flare-rpc-documentation/" %} +[flare-rpc-documentation](flare-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="flare-rpc-documentation/" %} +[flare-rpc-documentation](flare-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="horizen-eon-rpc-documentation/" %} +[horizen-eon-rpc-documentation](horizen-eon-rpc-documentation/) +{% endcontent-ref %} diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/README.md new file mode 100644 index 0000000..f8b496c --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Arbitrum RPC documentation + +Arbitrum is a technology suite designed to scale Ethereum. You can use Arbitrum chains to do all things you do on Ethereum โ€” use Web3 apps, deploy smart contracts, etc., but your transactions will be cheaper and faster. Our flagship product โ€” Arbitrum Rollup โ€” is an Optimistic rollup protocol that inherits Ethereum-level security. diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_getbadblocks.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_getbadblocks.md new file mode 100644 index 0000000..8e91172 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_getbadblocks.md @@ -0,0 +1,103 @@ +# debug\_getBadBlocks + +{% hint style="warning" %} +There was Arbitrum hard-fork from Classic to Nitro. As the results of this, you are able to use **debug** methods from block 22 207 818 to the actual one. Other non-debug methods work from genesis block. +{% endhint %} + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE}) + +const result = await tatum.rpc.debugGetBadBlocks() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_getBadBlocks` is an RPC method that provides a list of the most recent bad blocks encountered by the client on the network. This feature is valuable for developers and node operators, as it enables them to identify and address any issues or anomalies related to block validation and synchronization. + +By accessing `debug_getBadBlocks`, they can diagnose potential problems and take appropriate actions to ensure the network's stability and integrity. + +### Parameters + +* This method does not accept any parameters. + +### Return Object + +The output is an array of objects, with each object representing the trace result of a transaction within the block. These objects include essential details such as the transaction hash and a block object, which can be null if no block was found for the transaction: + +* `baseFeePerGas`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `difficulty`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `extraData`: The extra data field of this block. +* `gasLimit`: The maximum gas allowed in this block encoded as hexadecimal. +* `gasUsed`: The total used gas by all transactions in this block encoded as hexadecimal. +* `logsBloom`: The bloom filter for the logs of the block. Null if pending. +* `miner`: The address of the beneficiary to whom the mining rewards were given. +* `mixHash`: A 256-bit hash encoded as hexadecimal. +* nonce: The hash of the generated proof-of-work. Null if pending. +* `number`: The block number of the requested block encoded as hexadecimal. Null if pending. +* `parentHash`: The hash of the parent block. +* `receiptsRoot`: The root of the receipts trie of the block. +* `sha3Uncles`: The SHA3 of the uncles data in the block. +* size: The size of this block in bytes as an Integer value encoded as hexadecimal. +* `stateRoot`: The root of the final state trie of the block. +* timestamp: The Unix timestamp for when the block was collated. +* `transactions`: An array of transaction objects with the following fields: + * `blockHash`: The hash of the block where this log was in. Null when it's a pending log. + * `blockNumber`: The block number where this log was in. Null when it's a pending log. + * `from`: The address of the sender. + * `gas`: The gas provided by the sender, encoded as hexadecimal. + * `gasPrice`: The gas price provided by the sender in wei, encoded as hexadecimal. + * maxFeePerGas: The maximum fee per gas set in the transaction. + * `maxPriorityFeePerGas`: The maximum priority gas fee set in the transaction. + * hash: The hash of the transaction. + * `input`: The data sent along with the transaction. + * nonce: The number of transactions made by the sender before this one encoded as hexadecimal. + * `to`: The address of the receiver. Null when it's a contract creation transaction. + * `transactionIndex`: The integer of the transaction's index position that the log was created from. Null when it's a pending log. + * `value`: The value transferred in wei encoded as hexadecimal. + * `type`: The transaction type. + * `accessList`: A list of addresses and storage keys that the transaction plans to access. + * `chainId`: The chain id of the transaction, if any. +* `transactionsRoot`: The root of the transaction trie of the block. +* `uncles`: An array of uncle hashes. +* `rlp`: The RLP encoded header. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_getBadBlocks", + "params": [] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [] +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..d20f760 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,110 @@ +# debug\_traceBlockByHash + +{% hint style="warning" %} +There was Arbitrum hard-fork from Classic to Nitro. As the results of this, you are able to use **debug** methods from block 22 207 818 to the actual one. Other non-debug methods work from genesis block. +{% endhint %} + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..93266b4 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,108 @@ +# debug\_traceBlockByNumber + +{% hint style="warning" %} +There was Arbitrum hard-fork from Classic to Nitro. As the results of this, you are able to use **debug** methods from block 22 207 818 to the actual one. Other non-debug methods work from genesis block. +{% endhint %} + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.debugTraceBlockByNumber(130690340) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..aa91ff9 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,123 @@ +# debug\_traceCall + +{% hint style="warning" %} +There was Arbitrum hard-fork from Classic to Nitro. As the results of this, you are able to use **debug** methods from block 22 207 818 to the actual one. Other non-debug methods work from genesis block. +{% endhint %} + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..2ebc0dc --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,106 @@ +# debug\_traceTransaction + +{% hint style="warning" %} +There was Arbitrum hard-fork from Classic to Nitro. As the results of this, you are able to use **debug** methods from block 22 207 818 to the actual one. Other non-debug methods work from genesis block. +{% endhint %} + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..667013d --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..4b4b0d3 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..0482260 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..1e4d4fe --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,61 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an JSON-RPC method that allows developers to retrieve the currently configured chain ID of the network they are connected to. The chain ID is a unique identifier for different networks, such as mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..84cf527 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,63 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the JSON-RPC API that allows the client to retrieve the current version of the client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.9.0" +} +``` + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..4975fde --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,71 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const latestBlock = await tatum.rpc.blockNumber() + +console.log(latestBlock) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..4c19d55 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,108 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const balance = await tatum.rpc.getBalance('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an JSON-RPC method that allows you to retrieve the balance of a specified address. This method can be used to query the balance of any address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..bbdc30c --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,137 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumNova, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_NOVA} + +const block = await tatum.rpc.getBlockByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..93b777c --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,136 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<ArbitrumOne>({network: Network.ARBITRUM_ONE}
+
+const res = await tatum.rpc.blockNumber()
+
+console.log(res)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..a301dac --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..d3dc750 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1b4"` (block number 436) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1b4"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..14ad4f6 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,75 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const code = await tatum.rpc.getCode('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the JSON-RPC API, which allows users to interact with the blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..d885bf6 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const logs = await tatum.rpc.getLogs({ address : '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an JSON-RPC method that allows developers to query logs generated by the network, specifically event logs emitted by smart contracts. These logs are an essential part of the ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the network and use the retrieved data to track and react to events happening on the blockchain. diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..d16e182 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,107 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.getProof("0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..0b4d856 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,69 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const response = await tatum.rpc.getStorageAt('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..7850e2d --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x9a9a2a0d69b4ff48f7a2a8a26d135e1dbcbd3c3be3e8a3c90de0bcb104e4c4b4"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..9f8a91e --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0xAD7C5E', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0x316624"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0x316624", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..5304d45 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,92 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const tx = await tatum.rpc.getTransactionByHash('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..0f0cb84 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,74 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.getTransactionCount('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..1c6cdc2 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,129 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const tx = await tatum.rpc.getTransactionReceipt('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Arbitrum.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..b7d645e --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.getUncleCountByBlockHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..1b55bfc --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..43404a7 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ZEN to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..40783d1 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,60 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumNova, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_NOVA} + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an JSON-RPC method used to estimate the average gas price required for transactions in the network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..767f045 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..7415f20 --- /dev/null +++ b/docs/rpc/evm-blockchains/arbitrum-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, ArbitrumOne, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ARBITRUM_ONE} + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/README.md new file mode 100644 index 0000000..01876d5 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Avalanche RPC documentation + +Avalanche is a fully EVM-compatible sidechain and smart contract platform built with massive scalability in mind. Interact with this blockchain network via JSON-RPC methods. diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..2b77e9a --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..33bd555 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,104 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.debugTraceBlockByNumber(35129611) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..e905b07 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,119 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..1d1efa1 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..c3a8ba0 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..32be641 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..0c44863 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..64e7d8b --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,61 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an JSON-RPC method that allows developers to retrieve the currently configured chain ID of the network they are connected to. The chain ID is a unique identifier for different networks, such as mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..ac2cea8 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,63 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the JSON-RPC API that allows the client to retrieve the current version of the client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.9.0" +} +``` + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..4acfc0a --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,69 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..5ae3e72 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,108 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const balance = await tatum.rpc.getBalance('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an JSON-RPC method that allows you to retrieve the balance of a specified address. This method can be used to query the balance of any address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..ab25d65 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,137 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const block = await tatum.rpc.getBlockByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..c7e60d6 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,134 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<AvalancheC>({network: Network.AVALANCHE_C})
+
+const block = await tatum.rpc.getBlockByNumber('latest', true)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..2ec30f0 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..0c5c772 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1b4"` (block number 436) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1b4"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..efa0d0f --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,76 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const code = await tatum.rpc.getCode('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the JSON-RPC API, which allows users to interact with the blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..c751ca3 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const logs = await tatum.rpc.getLogs({ address : '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an JSON-RPC method that allows developers to query logs generated by the network, specifically event logs emitted by smart contracts. These logs are an essential part of the ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the network and use the retrieved data to track and react to events happening on the blockchain. diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..03aca50 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,107 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.getProof("0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..af692fc --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,69 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const response = await tatum.rpc.getStorageAt('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..f58d911 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x9a9a2a0d69b4ff48f7a2a8a26d135e1dbcbd3c3be3e8a3c90de0bcb104e4c4b4"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..6df90e1 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0xAD7C5E', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0x316624"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0x316624", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..e870666 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,92 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const tx = await tatum.rpc.getTransactionByHash('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..31e95cd --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,74 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.getTransactionCount('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..1e1119c --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,129 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const tx = await tatum.rpc.getTransactionReceipt('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.AvalancheC.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..5b960d2 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..693371a --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..fe928d6 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ZEN to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..0578d30 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,60 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an JSON-RPC method used to estimate the average gas price required for transactions in the network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..f46fe22 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..7277792 --- /dev/null +++ b/docs/rpc/evm-blockchains/avalanche-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, AvalancheC, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.AVALANCHE_C}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/README.md new file mode 100644 index 0000000..e39b70a --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# BSC RPC documentation + +JSON-RPC endpoints refers to the network location where a program could transfer its RPC requests to access server data. Once you connect a decentralized application to an RPC endpoint, you can access the functionalities of different operations, which could enable real-time usage of blockchain data. BNB Chain provides several RPC endpoints for connectinto both its Minent and Testnet. In this section, we list the JSON-RPC endpoints that can be used for connecting to BNB Smart Chain. diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_storagerangeat.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_storagerangeat.md new file mode 100644 index 0000000..9a383e0 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_storagerangeat.md @@ -0,0 +1,84 @@ +# debug\_storageRangeAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.debugStorageRangeAt( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +1, '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0', '0x64' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed. + +### Parameters + +The `debug_storageRangeAt` method accepts the following parameters: + +* `blockHash`: The block hash for which the storage range should be retrieved. Example: `"0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82"` +* `txIndex`: The transaction index within the specified block. Example: `1` +* `address`: The contract address for which the storage range should be retrieved. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* `begin`: The beginning of the storage range. Example: `"0x0"` +* `end`: The end of the storage range. Example: `"0x64"` (inclusive) + +### Return Object + +The `debug_storageRangeAt` method returns an object with the following fields: + +* `storage`: An object that contains key-value pairs representing the contract storage, where the key is the storage slot and the value is the stored data. Example: `"0x00..01": "0x00..01"` +* `nextKey`: A key indicating the next storage slot if the requested range is too large, otherwise `null`. Example: `"0x00..02"` or `null` + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "debug_storageRangeAt", + "params": [ + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + 1, + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "0x64" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "nextKey": "0x0000000000000000000000000000000000000000000000000000000000000065" + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..0c7a95f --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..85e8d67 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,110 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.debugTraceBlockByNumber('0x1E3C299' , { + tracer: 'callTracer', + tracerConfig: { + onlyTopCall: true, + timeout: '10', + } +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..cf74015 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,121 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const tatum = await TatumSDK.init({network: Network.EON}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..9561ac1 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..3b7a538 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..eb6b0f7 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..638c21f --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..5b7a0d0 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,61 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an JSON-RPC method that allows developers to retrieve the currently configured chain ID of the network they are connected to. The chain ID is a unique identifier for different networks, such as mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..1fc3784 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,63 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the JSON-RPC API that allows the client to retrieve the current version of the client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.9.0" +} +``` + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..1434202 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,69 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_call.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_call.md new file mode 100644 index 0000000..f6416da --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_call.md @@ -0,0 +1,79 @@ +# eth\_call + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.call({ + "to": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", // Replace with the ERC-20 token contract address, in this case wrapped SOL on Ethereum + "data": "0x70a082310000000000000000000000008894E0a0c962CB723c1976a4421c95949bE2D4E3" // The function signature for balanceOf(address), followed by the Ethereum address (F22981C5bF0A717c98781Af04fdc8213fA789F1C) to query, in this case holder of wrapped SOL tokens +}, "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +Executes a new message call immediately without creating a transaction on the block chain. Often used for executing read-only smart contract functions, for example the `balanceOf` for an ERC-20 contract. + +Top 5 most commonly used use cases for `eth_call`: + +1. **Retrieve Token Balance:** Check an ERC-20 token balance for an address. +2. **Query Contract State:** Get contract data, like a game score or auction status. +3. **Validate Inputs:** Pre-validate function inputs before sending a transaction. +4. **Price Oracles:** Fetch real-time price data for decentralized applications. +5. **Gas Estimation:** Estimate gas costs for future transactions. + +### **Parameters** + +1. `Object` - The transaction call object + +* `from`: `DATA`, 20 Bytes - (optional) The address the transaction is sent from. +* `to`: `DATA`, 20 Bytes - The address the transaction is directed to. +* `gas`: `QUANTITY` - (optional) Integer of the gas provided for the transaction execution. eth\_call consumes zero gas, but this parameter may be needed by some executions. +* `gasPrice`: `QUANTITY` - (optional) Integer of the gasPrice used for each paid gas +* `value`: `QUANTITY` - (optional) Integer of the value sent with this transaction +* `data`: `DATA` - (optional) Hash of the method signature and encoded parameters. For details see [Ethereum Contract ABI in the Solidity documentation(opens in a new tab)](https://docs.soliditylang.org/en/latest/abi-spec.html) + +2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block) + +### Return Object + +`DATA` - the return value of executed contract. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc":"2.0", + "method":"eth_call", + "params":[{ + "to": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", // Replace with the ERC-20 token contract address in this case USDC on Binance Smart Chain + "data": "0x70a082310000000000000000000000008894E0a0c962CB723c1976a4421c95949bE2D4E3" // The function signature for balanceOf(address), followed by the Ethereum address to query in this case holder of USDC tokens + },"latest"], + "id":1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x0000000000000000000000000000000000000000002f798bddfae24274770b92" +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..f231355 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,108 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const balance = await tatum.rpc.getBalance('0x35a84E6896Aa5Ba047221aC405afaF1977A75109') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an JSON-RPC method that allows you to retrieve the balance of a specified address. This method can be used to query the balance of any address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The address of the account or contract whose balance you want to query. + * Example: `"0x35a84E6896Aa5Ba047221aC405afaF1977A75109"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x35a84E6896Aa5Ba047221aC405afaF1977A75109", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..bcd94fd --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,120 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const block = await tatum.rpc.getBlockByHash('0xf6ab52aebd492d20f7d5aef604d3d35111ec3d0ea4387431222429828652c9a1', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0xf6ab52aebd492d20f7d5aef604d3d35111ec3d0ea4387431222429828652c9a1"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0xf6ab52aebd492d20f7d5aef604d3d35111ec3d0ea4387431222429828652c9a1", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "baseFeePerGas": "0x0", + "difficulty": "0x2", + "extraData": "0xd88301020b846765746888676f312e32302e34856c696e7578000000b19df4a2f8b5830d77ffb86082b4f5f252d14a0114894d1a27ffd744abf6ad2b17ca03aee899d30472cd252fa552a55980b1ad815d100d9a0477068407cdac3e6bdf640a2f4ee08441719d7af44a6851f52b751e97a63f73bbda4b5193e065750c33ff685751e60546be875cf84c8401e3babba01c37c7cbb5104d70b946cb41fa58a4d9233ab8fbb5eb3157e4f47e660a418d098401e3babca0dada7f63e1e688bb4c038c65b59ae516095b530eb0aafa6670b25d79826e77fe80faf5f05a0b8058404f73d37dc8817e4756ce0fc98867164735f94604f43bdb3138fd9441d75eff0276f07ca4ae85aeb112e3cfac9b2a432d0e73e08622ff3d2200", + "gasLimit": "0x84fe2c6", + "gasUsed": "0xa41073", + "hash": "0xf6ab52aebd492d20f7d5aef604d3d35111ec3d0ea4387431222429828652c9a1", + "logsBloom": "0x34a61a1c00021592286002548f5e940711b04513241c06a91dea45c892210331814498885820b1614e122a82c472000198c3ce0c23027368b67a74209aa03a2bc4566012215e488c25445149a23d022d607290c5a96438ea00540085c62d460d4f0e00e02b22082420c5193a9518189d08523e4bd3686c1662125a11585805b6c00d4864221b10dc078946a41dc50f18402d9685782202a82d2de9c888ead0b202e8121e7b64aa11684834cd0f944620c5a90d2401868404116059253312526c98231546d1090856b060080f09bf52eca0d50dc3f8bbf074213140cb1621e6fc1971e9375b0083e0c38516d495a6ad04ad51840c023e8548732499d4a2ed25d2", + "miner": "0x9f8ccdafcc39f3c7d6ebf637c9151673cbc36b88", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1e3babd", + "parentHash": "0xdada7f63e1e688bb4c038c65b59ae516095b530eb0aafa6670b25d79826e77fe", + "receiptsRoot": "0xcf29bb7fc17c26f39b86c02b4b08f5b11763e3cc19497b58ef18049978b0c7cc", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x65cb", + "stateRoot": "0x89063043aaf47c7ff87de3e197d3e556c7752fb2e338ec2ab4626d0b60f0f2d8", + "timestamp": "0x65017610", + "totalDifficulty": "0x3c12b38", + "transactions": [], + "transactionsRoot": "0x28caed6a0174dc936da148dcf519eb66ab912c4a94eacc123a05ca66d03c224b", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..d8762f0 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,134 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<BinanceSmartChain>({network: Network.BINANCE_SMART_CHAIN})
+
+const block = await tatum.rpc.getBlockByNumber('latest', true)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..b84e852 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x147" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..8685fe9 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0x1E3C1A1') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1E3C1A1"` (block number 31703457) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0x147"` (327 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1E3C1A1"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x147" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..50e993f --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,76 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const code = await tatum.rpc.getCode('0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the JSON-RPC API, which allows users to interact with the blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte address, formatted as a hex string with a `0x` prefix. + * Example: `"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..1de72fe --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const logs = await tatum.rpc.getLogs({ address : '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an JSON-RPC method that allows developers to query logs generated by the network, specifically event logs emitted by smart contracts. These logs are an essential part of the ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the network and use the retrieved data to track and react to events happening on the blockchain. diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..f6f888b --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,94 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.getProof("0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "address": "0xa41d19f4258a388c639b7ccd938fce3fb7d05e86", + "accountProof": [], + "balance": "0x0", + "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "nonce": "0x0", + "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "storageProof": [{}] + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..8200b1e --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,69 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const response = await tatum.rpc.getStorageAt('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..1d032e7 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,98 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a number in decimal. + * Example: 0 + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91", + 0 + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91", + "blockNumber": "0x1e3c1a1", + "from": "0x071e5581ea04d93336fd6d2557c56f5c6ab2bea8", + "gas": "0x35b63", + "gasPrice": "0x5af993e87", + "hash": "0x7d05b7e686241f7aa0593e30c819fc59deb14154576b9d048820726079cf1c69", + "input": "0x0000000000000000000001edd108f9d850100000000003e7dc5f9076ab0000004e5cb88aaf8227d9b7e61a7555cee07c617941ee0033", + "nonce": "0x14089d", + "to": "0x0000000000016a723d0d576df7dc79ec149ac760", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x0", + "v": "0x93", + "r": "0xbe4a49be222942d61aad6f995b33fe59aefeaf2c8e8d9a3fea595e11ec03810b", + "s": "0x3b22209ddfcc3737de2990195dd9b6bb350f1fb6265e7d06789abaa619467d1e" + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..84de165 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,98 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0xAD7C5E', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0xAD7C5E"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0xAD7C5E", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xee7d93c17d84df49b2923ce6922a6d1d3dd7c9ad9e5a845c53de15309c2722ef", + "blockNumber": "0xad7c5e", + "from": "0xcd22db09c69935c3c660438fec1758f855def472", + "gas": "0xdbba0", + "gasPrice": "0x9502f9000", + "hash": "0x182c841ef47c1505e1e38677b9f1cfea74ad5a380e31e6b05b68279e9d332e99", + "input": "0x095ea7b300000000000000000000000010ed43c718714eb63d5aa57b78b54704e256024effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "nonce": "0xd", + "to": "0x5e12bb6ddd9214923d6c837ddf1ffb9c90f18883", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x0", + "v": "0x94", + "r": "0xa4967df17dd1418b50808e44019335b6ff831e17962c1e143777c2808d7f2cd0", + "s": "0x43bdb946e52562c586ac6bf04e7d4c7e7252d2bfb455d3f5f486f64f34e40c33" + } +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..d5059ef --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,91 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const tx = await tatum.rpc.getTransactionByHash('0xc5e257842e8fb62e286350d4bdddcaf24cb30dae4b8ec25ad3e52f463e16e656') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + jsonrpc: '2.0', + id: 1, + result: { + blockHash: '0x283da208c3429f3c3c38fc2c0a94bc767c9c2197962393cd4d79c6d6f2938b48', + blockNumber: '0x1e3bb30', + from: '0x35a84e6896aa5ba047221ac405afaf1977a75109', + gas: '0x5208', + gasPrice: '0xb2d05e00', + hash: '0xc5e257842e8fb62e286350d4bdddcaf24cb30dae4b8ec25ad3e52f463e16e656', + input: '0x', + nonce: '0x4', + to: '0x8aca17bcb5eed52e9854528d131d830149e9cdc0', + transactionIndex: '0x35', + value: '0x2386f26fc10000', + type: '0x0', + v: '0x94', + r: '0xdb1edfd341493c5309952a880db14f291820940f78cedfe0639a65babe564c5a', + s: '0x334ba27525743ff412e66b07bcb3683d0ed565edbad5a3e30ddd5d7f46233818' + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..2d0db3a --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,74 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.getTransactionCount('0x35a84E6896Aa5Ba047221aC405afaF1977A75109', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The address whose transaction count will be retrieved. + * Example: `"0x35a84E6896Aa5Ba047221aC405afaF1977A75109"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x35a84E6896Aa5Ba047221aC405afaF1977A75109", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..b4c8298 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,108 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const tx = await tatum.rpc.getTransactionReceipt('0xc5e257842e8fb62e286350d4bdddcaf24cb30dae4b8ec25ad3e52f463e16e656') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..67b70d2 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0xd109a2054e3301c446573859bcbdb0fb26107ea1c218d097042b34e3bd8f6d91" + ] +} +``` + +**Response:** + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x0" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..364eb21 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0xAD7C5E"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0xAD7C5E" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..bfd900c --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ZEN to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..e44ddf1 --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,60 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an JSON-RPC method used to estimate the average gas price required for transactions in the network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..76f993d --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..6d9093c --- /dev/null +++ b/docs/rpc/evm-blockchains/bsc-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, BinanceSmartChain, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BINANCE_SMART_CHAIN}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/README.md new file mode 100644 index 0000000..bd9c86a --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/README.md @@ -0,0 +1,11 @@ +# Ethereum RPC documentation + +Ethereum RPC (Remote Procedure Call) is a powerful tool for interacting with the Ethereum blockchain network. It provides developers with a standardised interface to communicate with the Ethereum network, enabling them to retrieve data, send transactions, deploy smart contracts, and more. With Ethereum RPC, developers can build decentralised applications, integrate blockchain functionality into existing systems, and explore the vast ecosystem of Ethereum. + +Getting Started with Ethereum RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/ieMHdz5vqp4" %} +Ethereum RPC +{% endembed %} + +In this video tutorial, we will walk you through the process of getting started with Ethereum RPC using the Tatum SDK. Tatum SDK is a robust blockchain development toolkit that simplifies the interaction with various blockchain networks, including Ethereum. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Ethereum network via RPC, and perform common operations such as retrieving gas fees. Whether you are a beginner or an experienced developer, this tutorial will provide you with the necessary steps to kickstart your web3 app development journey on ethereum. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_storagerangeat.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_storagerangeat.md new file mode 100644 index 0000000..13e653b --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_storagerangeat.md @@ -0,0 +1,84 @@ +# debug\_storageRangeAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.debugStorageRangeAt( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +1, '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0', '0x64' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed. + +### Parameters + +The `debug_storageRangeAt` method accepts the following parameters: + +* `blockHash`: The block hash for which the storage range should be retrieved. Example: `"0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82"` +* `txIndex`: The transaction index within the specified block. Example: `1` +* `address`: The contract address for which the storage range should be retrieved. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* `begin`: The beginning of the storage range. Example: `"0x0"` +* `end`: The end of the storage range. Example: `"0x64"` (inclusive) + +### Return Object + +The `debug_storageRangeAt` method returns an object with the following fields: + +* `storage`: An object that contains key-value pairs representing the contract storage, where the key is the storage slot and the value is the stored data. Example: `"0x00..01": "0x00..01"` +* `nextKey`: A key indicating the next storage slot if the requested range is too large, otherwise `null`. Example: `"0x00..02"` or `null` + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "debug_storageRangeAt", + "params": [ + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + "0x1", + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "0x64" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "nextKey": "0x0000000000000000000000000000000000000000000000000000000000000065" + } +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..8e90cb3 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an Ethereum RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..9d9e0c9 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,112 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0x1b4", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an Ethereum RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..0752340 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.debugTraceTransaction('0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an Ethereum RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/eth_getblockreceipts.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/eth_getblockreceipts.md new file mode 100644 index 0000000..a17d232 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/archival-information/eth_getblockreceipts.md @@ -0,0 +1,154 @@ +# eth\_getBlockReceipts + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.getBlockReceipts(10123321) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockReceipts` method retrieves and returns all transaction receipts for a specific block. Transaction receipts contain essential information related to the execution status and outcomes of individual transactions within the block, including details about the amount of gas used, contract events emitted, and whether the transactions were successful or not. + +By using the `eth_getBlockReceipts`, developers can seek a comprehensive overview of the transactions' results within a particular block. + +### Parameters + +The `eth_getBlockReceipts` method accepts the following parameters: + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` + +### Return Object + +`eth_getBlockReceipts` method provides a detailed set of information for each transaction receipt within a given block. The returned data includes: + +* `blockHash`: The hash of the block (null if pending). +* `blockNumber`: The block number. +* `contractAddress`: The contract address created if the transaction was for contract creation; otherwise, null. +* `cumulativeGasUsed`: The total amount of gas used when this transaction was executed in the block. +* `effectiveGasPrice`: The actual value per gas deducted from the sender account. +* from: The address of the sender. +* `gasUsed`: The amount of gas used by this specific transaction alone. +* `logs`: An array of log objects that generated this transaction, containing: + * `address`: The address from which this log originated. + * topics: In Solidity, the first topic is the hash of the signature of the event, unless the event is declared with the anonymous specifier. + * `data`: It contains one or more 32 Bytes non-indexed arguments of the log. + * `blockNumber`: The block number where this log was in. + * `transactionHash`: The hash of the transaction this log was created from, or null if it's a pending log. + * `transactionIndex`: The integer of the transaction's index position that the log was created fromr null if it's a pending log. + * `blockHash`: The hash of the block where this log was inr null if it's a pending log. + * `logIndex`: The integer of the log index position in the blockr null if it's a pending log. + * `removed`: It is true when the log was removed due to a chain reorganization, and false if it's a valid log. +* `logsBloom`: The bloom filter for light clients to quickly retrieve related logs. +* `status`: It is either 1 (success) or 0 (failure) encoded as a hexadecimal. +* `to`: The address of the receiver. It will be null when the transaction is for contract creation. +* `transactionHash`: The hash of the transaction. +* `transactionIndex`: The index of the transaction within the block. +* `type`: The value type. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc":"2.0", + "method":"eth_getBlockReceipts", + "params":["0x10f5d58"], + "id":1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [ + { + "blockHash": "0xf129ec079e3af6740128dde546e33ea85db2c46dbb7ea35f400a97bf837ec630", + "blockNumber": "0x10f5d58", + "contractAddress": null, + "cumulativeGasUsed": "0x3f14c", + "effectiveGasPrice": "0x174876e800", + "from": "0xcf33ea41c015749f3ced2366364ef611d8d1425d", + "gasUsed": "0x3f14c", + "logs": [ + { + "address": "0xa62894d5196bc44e4c3978400ad07e7b30352372", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cf33ea41c015749f3ced2366364ef611d8d1425d", + "0x000000000000000000000000a62894d5196bc44e4c3978400ad07e7b30352372" + ], + "data": "0x0000000000000000000000000000000000000000000000000002cbb24c4d2f98", + "blockNumber": "0x10f5d58", + "transactionHash": "0x81f1604ea2fa270307707d922d373e2e04069788334b648393aecb8c806ee6c0", + "transactionIndex": "0x0", + "blockHash": "0xf129ec079e3af6740128dde546e33ea85db2c46dbb7ea35f400a97bf837ec630", + "logIndex": "0x0", + "removed": false + }, + { + "address": "0xa62894d5196bc44e4c3978400ad07e7b30352372", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000cf33ea41c015749f3ced2366364ef611d8d1425d", + "0x0000000000000000000000008e83de18b38ddc22166fb5454003a573a53be4ae" + ], + "data": "0x0000000000000000000000000000000000000000000000000114c5f381d9787d", + "blockNumber": "0x10f5d58", + "transactionHash": "0x81f1604ea2fa270307707d922d373e2e04069788334b648393aecb8c806ee6c0", + "transactionIndex": "0x0", + "blockHash": "0xf129ec079e3af6740128dde546e33ea85db2c46dbb7ea35f400a97bf837ec630", + "logIndex": "0x1", + "removed": false + } + ], + "logsBloom": "0x00200000000000000000000080000000008000000000000000000000000000000000000000000000000000000000000102002010880120000000000000200000000000080000000800004008000000200000000000400800000002000020000000000000000000000000000000000000008000000000040000000010000800002000000000000000001020080000812000000000000000080000004000000000020080000000000000000000000000400000000200000000000000000010080000000002000000000000000000000000000000000000101000000002000000004010200000000000000000000000000000001000000000000000000000000000", + "status": "0x1", + "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "transactionHash": "0x81f1604ea2fa270307707d922d373e2e04069788334b648393aecb8c806ee6c0", + "transactionIndex": "0x0", + "type": "0x2" + }, + { + "blockHash": "0xf129ec079e3af6740128dde546e33ea85db2c46dbb7ea35f400a97bf837ec630", + "blockNumber": "0x10f5d58", + "contractAddress": null, + "cumulativeGasUsed": "0xbd884a", + "effectiveGasPrice": "0x48ffe6b8e", + "from": "0xdafea492d9c6733ae3d56b7ed1adb60692c98bc5", + "gasUsed": "0x5208", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0xe688b84b23f322a994a53dbf8e15fa82cdb71127", + "transactionHash": "0x1104ac612589d19b6774ab1d8012c23036ebb5fae828b7a710acc6101b2b34bf", + "transactionIndex": "0x99", + "type": "0x2" + } + ] +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..ac2f08d --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,131 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Ethereum node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGMzLr" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..c40e878 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,78 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running Ethereum node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQgNqZ" %} + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..a606dba --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the Ethereum network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..1addb8d --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,64 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an Ethereum JSON-RPC method that allows developers to retrieve the currently configured chain ID of the Ethereum network they are connected to. The chain ID is a unique identifier for different Ethereum networks, such as Ethereum Mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple Ethereum networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQxzzw" %} + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1" +} +``` + +In this example, the returned chain ID is `0x1`, which corresponds to the Ethereum Mainnet. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..bb67d80 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,66 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the Ethereum JSON-RPC API that allows the client to retrieve the current version of the Ethereum client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the Ethereum client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the Ethereum client software. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQMOEw" %} + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the Ethereum client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the Ethereum client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 67 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "Geth/v1.10.3-stable-c2d2f1a3/linux-amd64/go1.16.4" +} +``` + +In the above example, the Ethereum client software being used is Geth, version 1.10.3, with build information `stable-c2d2f1a3/linux-amd64/go1.16.4`. The `result` field contains the version string. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..d778901 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,70 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the Ethereum blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQdqzY?editors=1011" %} + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the Ethereum blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` Ethereum RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_call.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_call.md new file mode 100644 index 0000000..9c74900 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_call.md @@ -0,0 +1,79 @@ +# eth\_call + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.call({ + "to": "0xD31a59c85aE9D8edEFeC411D448f90841571b89c", // Replace with the ERC-20 token contract address, in this case wrapped SOL on Ethereum + "data": "0x70a08231000000000000000000000000F22981C5bF0A717c98781Af04fdc8213fA789F1C" // The function signature for balanceOf(address), followed by the Ethereum address (F22981C5bF0A717c98781Af04fdc8213fA789F1C) to query, in this case holder of wrapped SOL tokens +}, "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +Executes a new message call immediately without creating a transaction on the block chain. Often used for executing read-only smart contract functions, for example the `balanceOf` for an ERC-20 contract. + +Top 5 most commonly used use cases for `eth_call`: + +1. **Retrieve Token Balance:** Check an ERC-20 token balance for an address. +2. **Query Contract State:** Get contract data, like a game score or auction status. +3. **Validate Inputs:** Pre-validate function inputs before sending a transaction. +4. **Price Oracles:** Fetch real-time price data for decentralized applications. +5. **Gas Estimation:** Estimate gas costs for future transactions. + +### **Parameters** + +1. `Object` - The transaction call object + +* `from`: `DATA`, 20 Bytes - (optional) The address the transaction is sent from. +* `to`: `DATA`, 20 Bytes - The address the transaction is directed to. +* `gas`: `QUANTITY` - (optional) Integer of the gas provided for the transaction execution. eth\_call consumes zero gas, but this parameter may be needed by some executions. +* `gasPrice`: `QUANTITY` - (optional) Integer of the gasPrice used for each paid gas +* `value`: `QUANTITY` - (optional) Integer of the value sent with this transaction +* `data`: `DATA` - (optional) Hash of the method signature and encoded parameters. For details see [Ethereum Contract ABI in the Solidity documentation(opens in a new tab)](https://docs.soliditylang.org/en/latest/abi-spec.html) + +2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block) + +### Return Object + +`DATA` - the return value of executed contract. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc":"2.0", + "method":"eth_call", + "params":[{ + "to": "0xD31a59c85aE9D8edEFeC411D448f90841571b89c", // Replace with the ERC-20 token contract address in this case wrapped SOL on Ethereum + "data": "0x70a08231000000000000000000000000F22981C5bF0A717c98781Af04fdc8213fA789F1C" // The function signature for balanceOf(address), followed by the Ethereum address to query in this case holder of wrapped SOL tokens + },"latest"], + "id":1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x00000000000000000000000000000000000000000000000000001726f9fecc9d" +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..1b1cf91 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,112 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const balance = await tatum.rpc.getBalance('0x742d35Cc6634C0532925a3b844Bc454e4438f44e') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Ethereum.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an Ethereum JSON-RPC method that allows you to retrieve the Ether balance of a specified address. This method can be used to query the balance of any Ethereum address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralised application (DApp). + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQgNWd" %} +Try this feature +{% endembed %} + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The Ethereum address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Ether balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..a779c28 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,148 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const block = await tatum.rpc.getBlockByHash('0x75e58e08a9f3a23bac9788d5077a9365abb5c29ec1aab70891264051624720af', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an Ethereum JSON-RPC method that allows developers to query a specific block in the Ethereum blockchain by its block hash. This method can be used in various scenarios, such as analysing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQNNGq" %} + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x75e58e08a9f3a23bac9788d5077a9365abb5c29ec1aab70891264051624720af"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x75e58e08a9f3a23bac9788d5077a9365abb5c29ec1aab70891264051624720af", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "baseFeePerGas": "0x35ddd12aa", + "difficulty": "0x0", + "extraData": "0xd883010c02846765746888676f312e32302e37856c696e7578", + "gasLimit": "0x1c9c380", + "gasUsed": "0x9426f0", + "hash": "0x75e58e08a9f3a23bac9788d5077a9365abb5c29ec1aab70891264051624720af", + "logsBloom": "0x2734882843000e08f2096070f803a2a854304d0062c40102d01b1002478401820020904c234830800d100600018509900b0022029b0c2e949e95c000153e008250005a18b42888380b00423a590113e611192c2c2144081308321ccdfbe004e40b805841b24a91041e0ddc1630466d0800584d1400181e2482444cd0aa6b025423218b052b405824464e88584013849102801e8109a6862d26010a64289348858a28c0078382eb808e4600a631b09660437a04354c5290822c448400020a09104d94a7e320438530080060201e3a05c431a0c4184aed32140d5d3093584d611e1991600a034148c05f0c443c2a0208086a22d1c1cb689049900ab0114010c202", + "miner": "0xb79743c0968c49a518be9c83bed8f6f69e005c32", + "mixHash": "0x5781d7db87a40a3301d673155ae8d2faa5a87c72dabc4a82fb944175cac5cf59", + "nonce": "0x0000000000000000", + "number": "0x1143497", + "parentHash": "0x41f676300e43cc244d5427b3714a5fc7146e443504c437b1f5bc4b337a06ae2a", + "receiptsRoot": "0xd6c87dabf0ec502567a85c32e77051d83f08b7627f4ed7d85e194eeb1d2b9b54", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x3ef6a", + "stateRoot": "0x4e6df5a0f0181b146d1ff137a7548ab3d67630011f6ea9ea084b9325dda56ff5", + "timestamp": "0x64fcddfb", + "totalDifficulty": "0xc70d815d562d3cfa955", + "transactions": [ + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object], [Object], + [Object], [Object], [Object], [Object] + ], + "transactionsRoot": "0xbe9ed26c6b185a4b6d0b175ba694c9243eb58d06e11aff3258f5167d4ace26e7", + "uncles": [], + "withdrawals": [ + [Object], [Object], + [Object], [Object], + [Object], [Object], + [Object], [Object], + [Object], [Object], + [Object], [Object], + [Object], [Object], + [Object], [Object] + ], + "withdrawalsRoot": "0x365326ed6795e450a8f437c7c30da68254567bbaf755321b2663dcc6777fddcb" + } +} + +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..01edee9 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,139 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const block = await tatum.rpc.getBlockByNumber('latest', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an Ethereum JSON-RPC method that allows developers to query a specific block in the Ethereum blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQGwer" %} + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..ef1bc16 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,70 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is an Ethereum RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +{% embed url="https://codepen.io/tatum-devrel/pen/dyQEEqj" %} + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x86" +} +``` + +In this example, the block with the hash `"0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf"` has a total of 134 transactions (indicated by the hexadecimal value `"0x86"`). diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..13bd04b --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,65 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber(17884144) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` Ethereum JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the Ethereum network, or monitor transaction congestion in certain blocks. + +{% embed url="https://codepen.io/tatum-devrel/pen/WNYBBBr" %} + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: block number 17884144 + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: 17884144 (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": [17884144] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x86" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..8873541 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,78 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const code = await tatum.rpc.getCode('0x742d35Cc6634C0532925a3b844Bc454e4438f44e') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the Ethereum JSON-RPC API, which allows users to interact with the Ethereum blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQbbmV" %} + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte Ethereum address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..3df8114 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,113 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const logs = await tatum.rpc.getLogs({ address : '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an Ethereum JSON-RPC method that allows developers to query logs generated by the Ethereum network, specifically event logs emitted by smart contracts. These logs are an essential part of the Ethereum ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the Ethereum blockchain.\\ + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQooBO" %} + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` Ethereum JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the Ethereum network and use the retrieved data to track and react to events happening on the Ethereum blockchain. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..8543d16 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,111 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.getProof("0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is an Ethereum JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire Ethereum state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + + + +{% embed url="https://codepen.io/tatum-devrel/pen/GRwabgV" %} + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..4ee3cc5 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,71 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const response = await tatum.rpc.getStorageAt('0x742d35Cc6634C0532925a3b844Bc454e4438f44e', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an Ethereum JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQoojM?editors=1111" %} + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..a5aab08 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,105 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf', 1) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Ethereum JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQojOV" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x1"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf", + "0x1" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x2907402477167193008a0cbbaa8073278c48e8b97bf9ed1a2101f6ad2130dbaf", + "blockNumber": "0x110e3f0", + "from": "0xcfdda03e6167ad55392c03d962a9da1bec513a23", + "gas": "0x39dca", + "gasPrice": "0x4601d234d", + "maxFeePerGas": "0x51cad3075", + "maxPriorityFeePerGas": "0x2faf080", + "hash": "0x9272e601263cf89cc3b5d65d33f8d708f9eb547b8d0d419cc0646361a8c8cca2", + "input": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000064d4cec300000000000000000000000000000000000000000000000000000000000000020b0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000085347052c302c70f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000008c130499d33097d4d000d3332e1672f75b431543", + "nonce": "0x29", + "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "transactionIndex": "0x1", + "value": "0xde0b6b3a7640000", + "type": "0x2", + "accessList": [], + "chainId": "0x1", + "v": "0x1", + "r": "0x6e3b191997b04e9b58bc2ada242830a6445ab233ea0971a53f9eceed7850cbfd", + "s": "0x4cd69316c2f5e54d48df588f03d527904e7300ee4477dfaca436844ecb11cbd1", + "yParity": "0x1" + } +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..60e48b4 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,101 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex(10123321, 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Ethereum JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqvRNp" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): either hexadecimal or decimal value + * Example: 10123321 +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal or decimal value. + * Example: 0 + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + 10123321, + 0 + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x103eca282ca064902fa3e15ad705bcf52cff6a5d0e9ad7b077a503268f6aa317", + "blockNumber": "0x9a7839", + "from": "0xcabda7c04a240498636ee0e535e0596b504c66d2", + "gas": "0x5208", + "gasPrice": "0xfd51da9a3", + "hash": "0x93f11750429ae0f792a584b0dca215c52c40b506086ceb16fb3200932939116f", + "input": "0x", + "nonce": "0x22e4", + "to": "0x3cd76d4a67ebd1c88cd8cf613c4551199cccae4d", + "transactionIndex": "0x0", + "value": "0x46bdf53e068dc0000", + "type": "0x0", + "v": "0x1c", + "r": "0x3a7ae13274733eac63e388a0f95568122431134ccbb1f408eedd4f3a579263a0", + "s": "0x5362b2ad9c89e8c0be551a81b77945090351482abe30592f28ae869ff87ad1c5" + } +} + +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..68dcbe1 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,98 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx = await tatum.rpc.getTransactionByHash('0x97696c2014695e851d85a344cbbc6ae8ab9d386de05cb0230fe50b91c044639b') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an Ethereum JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQgZYe" %} + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0x97696c2014695e851d85a344cbbc6ae8ab9d386de05cb0230fe50b91c044639b"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0x97696c2014695e851d85a344cbbc6ae8ab9d386de05cb0230fe50b91c044639b"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xd1d718c5aef254e044928c1afeffd1c62e8c8566075b4ce70102a0185f15fe5b", + "blockNumber": "0x1149605", + "from": "0x0712663d09c8da4fdaa43d3ebd87a03c14ca9a5a", + "gas": "0x7b0c", + "gasPrice": "0x75de7040b", + "maxFeePerGas": "0x93e78c23c", + "maxPriorityFeePerGas": "0x828f156", + "hash": "0x97696c2014695e851d85a344cbbc6ae8ab9d386de05cb0230fe50b91c044639b", + "input": "0x", + "nonce": "0x21b", + "to": "0x698f26578e9955e0ef9f849a778feeadf43658ac", + "transactionIndex": "0x39", + "value": "0x20c0677f05ec0000", + "type": "0x2", + "accessList": [], + "chainId": "0x1", + "v": "0x0", + "r": "0xbe80603b27d91a8d311cc0ab02b549b378f497f71068d84abab2a81c43a3a586", + "s": "0xb0d6771b3a0d3ba57f68b061f9841a9102a8bd8d9b62da4799b98cad0ce30", + "yParity": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..eabdd7e --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,76 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.getTransactionCount('0x742d35Cc6634C0532925a3b844Bc454e4438f44e', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an Ethereum JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +{% embed url="https://codepen.io/tatum-devrel/pen/LYXqZVG" %} + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The Ethereum address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..2cd8799 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,101 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const tx = await tatum.rpc.getTransactionReceipt('0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an Ethereum JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJYNxa" %} + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x75e58e08a9f3a23bac9788d5077a9365abb5c29ec1aab70891264051624720af", + "blockNumber": "0x1143497", + "contractAddress": null, + "cumulativeGasUsed": "0x9382e0", + "effectiveGasPrice": "0x35ef89748", + "from": "0x2b862fe79a56419979e97b95f910b93f6d338e33", + "gasUsed": "0x2b7fe", + "logs": [ + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] + ], + "logsBloom": "0x0..." + "status": "0x1", + "to": "0xb517850510997a34b4ddc8c3797b4f83fad510c4", + "transactionHash": "0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d", + "transactionIndex": "0x4c", + "type": "0x2" + } +} + +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..255d796 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,74 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x827d30e914a3adeefabb9d53f70da87e6e0ed3d02a72e7d9ae9bfd1bf123c7a3') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Ethereum JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Ethereum network and to analyse the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralisation of the Ethereum network. The inclusion of uncles helps prevent centralisation and ensures the mining process remains competitive. + + + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/NWEJRvZ" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x827d30e914a3adeefabb9d53f70da87e6e0ed3d02a72e7d9ae9bfd1bf123c7a3"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x827d30e914a3adeefabb9d53f70da87e6e0ed3d02a72e7d9ae9bfd1bf123c7a3" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..d3d6a0d --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,73 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const result = await tatum.rpc.getUncleCountByBlockNumber(15537345) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Ethereum JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Ethereum network and to analyse the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralisation of the Ethereum network. The inclusion of uncles helps prevent centralisation and ensures the mining process remains competitive. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/vYQPXer" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: 15537345 + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0xED14C1" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..c31ee3e --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,94 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an Ethereum JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard ether transfers + +{% embed url="https://codepen.io/tatum-devrel/pen/KKrJMNb" %} + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ether to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..3808eeb --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,62 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an Ethereum JSON-RPC method used to estimate the average gas price required for transactions in the Ethereum network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOryZa" %} + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..4e64c4e --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,64 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQqMgX" %} + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..334bee5 --- /dev/null +++ b/docs/rpc/evm-blockchains/ethereum-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized Ethereum transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring Ether, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/README.md new file mode 100644 index 0000000..e2b74f5 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Flare RPC documentation + +Flare RPC (Remote Procedure Call) is a powerful tool for interacting with the Flare blockchain network. It provides developers with a standardised interface to communicate with the Flare network, enabling them to retrieve data, send transactions, deploy smart contracts, and more. With Flare RPC, developers can build decentralised applications, integrate blockchain functionality into existing systems, and explore the vast ecosystem of Flare. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_getbadblocks.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_getbadblocks.md new file mode 100644 index 0000000..4786892 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_getbadblocks.md @@ -0,0 +1,99 @@ +# debug\_getBadBlocks + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugGetBadBlocks() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_getBadBlocks` is an RPC method that provides a list of the most recent bad blocks encountered by the client on the network. This feature is valuable for developers and node operators, as it enables them to identify and address any issues or anomalies related to block validation and synchronization. + +By accessing `debug_getBadBlocks`, they can diagnose potential problems and take appropriate actions to ensure the network's stability and integrity. + +### Parameters + +* This method does not accept any parameters. + +### Return Object + +The output is an array of objects, with each object representing the trace result of a transaction within the block. These objects include essential details such as the transaction hash and a block object, which can be null if no block was found for the transaction: + +* `baseFeePerGas`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `difficulty`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `extraData`: The extra data field of this block. +* `gasLimit`: The maximum gas allowed in this block encoded as hexadecimal. +* `gasUsed`: The total used gas by all transactions in this block encoded as hexadecimal. +* `logsBloom`: The bloom filter for the logs of the block. Null if pending. +* `miner`: The address of the beneficiary to whom the mining rewards were given. +* `mixHash`: A 256-bit hash encoded as hexadecimal. +* nonce: The hash of the generated proof-of-work. Null if pending. +* `number`: The block number of the requested block encoded as hexadecimal. Null if pending. +* `parentHash`: The hash of the parent block. +* `receiptsRoot`: The root of the receipts trie of the block. +* `sha3Uncles`: The SHA3 of the uncles data in the block. +* size: The size of this block in bytes as an Integer value encoded as hexadecimal. +* `stateRoot`: The root of the final state trie of the block. +* timestamp: The Unix timestamp for when the block was collated. +* `transactions`: An array of transaction objects with the following fields: + * `blockHash`: The hash of the block where this log was in. Null when it's a pending log. + * `blockNumber`: The block number where this log was in. Null when it's a pending log. + * `from`: The address of the sender. + * `gas`: The gas provided by the sender, encoded as hexadecimal. + * `gasPrice`: The gas price provided by the sender in wei, encoded as hexadecimal. + * maxFeePerGas: The maximum fee per gas set in the transaction. + * `maxPriorityFeePerGas`: The maximum priority gas fee set in the transaction. + * hash: The hash of the transaction. + * `input`: The data sent along with the transaction. + * nonce: The number of transactions made by the sender before this one encoded as hexadecimal. + * `to`: The address of the receiver. Null when it's a contract creation transaction. + * `transactionIndex`: The integer of the transaction's index position that the log was created from. Null when it's a pending log. + * `value`: The value transferred in wei encoded as hexadecimal. + * `type`: The transaction type. + * `accessList`: A list of addresses and storage keys that the transaction plans to access. + * `chainId`: The chain id of the transaction, if any. +* `transactionsRoot`: The root of the transaction trie of the block. +* `uncles`: An array of uncle hashes. +* `rlp`: The RLP encoded header. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_getBadBlocks", + "params": [] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [] +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_storagerangeat.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_storagerangeat.md new file mode 100644 index 0000000..f708ad9 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_storagerangeat.md @@ -0,0 +1,84 @@ +# debug\_storageRangeAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugStorageRangeAt( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +1, '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0', '0x64' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed. + +### Parameters + +The `debug_storageRangeAt` method accepts the following parameters: + +* `blockHash`: The block hash for which the storage range should be retrieved. Example: `"0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82"` +* `txIndex`: The transaction index within the specified block. Example: 1 +* `address`: The contract address for which the storage range should be retrieved. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* `begin`: The beginning of the storage range. Example: `"0x0"` +* `end`: The end of the storage range. Example: `"0x64"` (inclusive) + +### Return Object + +The `debug_storageRangeAt` method returns an object with the following fields: + +* `storage`: An object that contains key-value pairs representing the contract storage, where the key is the storage slot and the value is the stored data. Example: `"0x00..01": "0x00..01"` +* `nextKey`: A key indicating the next storage slot if the requested range is too large, otherwise `null`. Example: `"0x00..02"` or `null` + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "debug_storageRangeAt", + "params": [ + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + "0x1", + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "0x64" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "nextKey": "0x0000000000000000000000000000000000000000000000000000000000000065" + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblock.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblock.md new file mode 100644 index 0000000..250ee94 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblock.md @@ -0,0 +1,99 @@ +# debug\_traceBlock + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugTraceBlock('0xAD7C5E' ,{tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlock` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `debug_traceBlock`, developers can obtain detailed insights into the execution flow of each transaction, allowing for in-depth analysis and debugging + +### Parameters + +* `block` - `String` + * RLP encoded block object. +* `options` (optional): An object containing configuration options for the tracer. + * `tracer`: The tracer object with the following fields: + * `callTracer`: The calltracer keeps track of all call frames, including depth 0 calls, made during a transaction. + * `prestateTracer`: The prestateTracer replays the transaction and tracks every part of the state that occurred during the transaction. + * `tracerConfig`: The object to specify the configurations of the tracer. + * onlyTopCall: When set to true, it traces only the primary (top-level) call and not any sub-calls, eliminating additional processing for each call frame. + +### Return Object + +The return object is an array of all invoked opcodes of all transaction that were included in this block. + +* `type`: The type of the call. +* `from`: The address from which the transaction is sent. +* `to`: The address to which the transaction is directed. +* `value`: The integer value sent with this transaction. +* `gas`: The integer value of the gas provided for the transaction execution. +* `gasUsed`: The integer value of the gas used. +* `input`: The data given at the time of input. +* `output`: The data returned as an output. +* `calls`: A list of sub-calls made during the transaction, including detailed trace information for each sub-call. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlock", + "params": [ + "0x1dc....", + { + "tracer": "callTracer" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..5c8af50 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an Flare RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..5b50a41 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,104 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugTraceBlockByNumber(12689342) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an Flare RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..332a371 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,119 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an Flare RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..e07a578 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an Flare RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..d66fcdf --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..d489ef3 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running Flare node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..8e674fe --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the Flare network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..0ab1df9 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,62 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an Flare JSON-RPC method that allows developers to retrieve the currently configured chain ID of the Flare network they are connected to. The chain ID is a unique identifier for different Flare networks, such as Flare Mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple Flare networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + +In this example, the returned chain ID is `0xe`, which corresponds to the Flare Mainnet. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..3293df5 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,64 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the Flare JSON-RPC API that allows the client to retrieve the current version of the Flare client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the Flare client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the Flare client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the Flare client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the Flare client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.8.15" +} +``` + +In the above example, the Flare client software being used is in version 0.8.18.. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..233cab6 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,70 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const latestBlock = await tatum.rpc.blockNumber() + + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the Flare blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the Flare blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` Flare RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..1110afa --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,108 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const balance = await tatum.rpc.getBalance('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an Flare JSON-RPC method that allows you to retrieve the Flare balance of a specified address. This method can be used to query the balance of any Flare address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The Flare address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..dd3ba25 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,137 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const block = await tatum.rpc.getBlockByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an Flare JSON-RPC method that allows developers to query a specific block in the Flare blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..2569b13 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,138 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const block = await tatum.rpc.getBlockByNumber('latest', true) + + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an Flare JSON-RPC method that allows developers to query a specific block in the Flare blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..e60dfb8 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is an Flare RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..add67b0 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` Flare JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the Flare network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1b4"` (block number 436) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1b4"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..5e8352e --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,76 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const code = await tatum.rpc.getCode('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the Flare JSON-RPC API, which allows users to interact with the Flare blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte Flare address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..2c54bd1 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const logs = await tatum.rpc.getLogs({ address : '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an Flare JSON-RPC method that allows developers to query logs generated by the Flare network, specifically event logs emitted by smart contracts. These logs are an essential part of the Flare ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the Flare blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` Flare JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the Flare network and use the retrieved data to track and react to events happening on the Flare blockchain. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..aa6b49c --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,107 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.getProof("0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is an Flare JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire Flare state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..a6a9e69 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,69 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const response = await tatum.rpc.getStorageAt('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an Flare JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..488f841 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Flare JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x9a9a2a0d69b4ff48f7a2a8a26d135e1dbcbd3c3be3e8a3c90de0bcb104e4c4b4"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..9d97282 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0xAD7C5E', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Flare JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0x316624"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0x316624", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..7f4d0b5 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,92 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const tx = await tatum.rpc.getTransactionByHash('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an Flare JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..4ae4568 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,74 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.getTransactionCount('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an Flare JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The Flare address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..0c8ec15 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,129 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const tx = await tatum.rpc.getTransactionReceipt('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an Flare JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..7154c88 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Flare JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Flare network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Flare network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..fff7e2e --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Flare JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Flare network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Flare network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..869929a --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an Flare JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard Flare transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of Flare to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..ed4d299 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,60 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an Flare JSON-RPC method used to estimate the average gas price required for transactions in the Flare network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..4e9c28e --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..e9e2de5 --- /dev/null +++ b/docs/rpc/evm-blockchains/flare-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Flare, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.FLARE}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized Flare transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring Flare, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/README.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/README.md new file mode 100644 index 0000000..2175088 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/README.md @@ -0,0 +1,11 @@ +# Haqq RPC documentation + +Haqq represents a scalable Proof-of-Stake blockchain with high throughput, offering seamless compatibility and interoperability with Ethereum. It is constructed utilizing the Cosmos SDK framework, leveraging the underlying Tendermint Core consensus engine. + +Haqq provides the capability to operate Ethereum in its original form within a specialized blockchain framework based on Cosmos. This empowers developers to access Ethereum's desired functionalities while concurrently harnessing the advantages of Tendermint's Proof-of-Stake mechanism. Moreover, due to its foundation on the Cosmos SDK, Haqq enables seamless value transfer across the broader Cosmos Ecosystem through the utilization of the Inter Blockchain Communication Protocol (IBC). + +Haqq comprehensively integrates with standard web3 JSON-RPC APIs. + +JSON-RPC functionality is accessible through various communication channels. Haqq extends its support to JSON-RPC over both HTTP and WebSocket connections. The activation of these communication modes can be achieved either via command-line flags or configuration settings within the app.toml file. + +In the Ethereum JSON-RPC ecosystem, a systematic namespace structure is employed. RPC methods are thoughtfully grouped into distinct categories based on their intended functions. Each method name comprises the namespace, an underscore, and the specific method title within the given namespace. For instance, the eth\_call method resides within the eth namespace. diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..32d3009 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,131 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Haqq node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQowQR" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..37d475f --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,78 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running Haqq node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +{% embed url="https://codepen.io/tatum-devrel/pen/mdQNYaK" %} + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..0dbc83b --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,66 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the Haqq network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyvwOK" %} + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..208e889 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,66 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an Haqq JSON-RPC method that allows developers to retrieve the currently configured chain ID of the Haqq network they are connected to. The chain ID is a unique identifier for different Haqq networks, such as Haqq Mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple Haqq networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +{% embed url="https://codepen.io/tatum-devrel/pen/NWEQVzo" %} + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +````json +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x2be3" +} +``` +```` + +In this example, the returned chain ID is `0x2be3`, which corresponds to the Haqq Mainnet. diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..72b2333 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,65 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the Haqq JSON-RPC API that allows the client to retrieve the current version of the Haqq client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the Haqq client software they are using and ensure that it is compatible with their application. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQqajp" %} + +### Parameters + +This method has no parameters. It only retrieves the current version of the Haqq client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the Haqq client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the Haqq client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 67 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "Version dev ()\nCompiled at using Go go1.20.6 (amd64)" +} +``` + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..2f6bcf3 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,71 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the Haqq blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/ZEmwwYX" %} + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the Haqq blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` Haqq RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..8d6fc09 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,110 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const balance = await tatum.rpc.getBalance('0x2c5b9a513be2240e948a631baafb53cc0beacfda') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Haqq.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an Haqq JSON-RPC method that allows you to retrieve the Haqq balance of a specified address. This method can be used to query the balance of any Haqq address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/ZEmwZvp?editors=1111" %} + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The Haqq address of the account or contract whose balance you want to query. + * Example: `"0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Haqq balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..1048f61 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,139 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const block = await tatum.rpc.getBlockByHash('0x300e4057498875ef62a7632c78077d9fa79265e484415d337d1f529ca4660ee6', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an Haqq JSON-RPC method that allows developers to query a specific block in the Haqq blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjegqOb" %} + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..e3fd15b --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,139 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const block = await tatum.rpc.getBlockByNumber('latest', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an Haqq JSON-RPC method that allows developers to query a specific block in the Haqq blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/KKrOLvY" %} + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..97d8926 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,70 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const response = await tatum.rpc.getBlockTransactionCountByHash('0xF07355D9A980F61915B53A74AFCDB89598E54EFCD9DF5A9935D16BC1DC4CFA8F') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is an Haqq RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQVbyY" %} + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xF07355D9A980F61915B53A74AFCDB89598E54EFCD9DF5A9935D16BC1DC4CFA8F"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xF07355D9A980F61915B53A74AFCDB89598E54EFCD9DF5A9935D16BC1DC4CFA8F" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xF07355D9A980F61915B53A74AFCDB89598E54EFCD9DF5A9935D16BC1DC4CFA8F"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..b10c26e --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,65 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const response = await tatum.rpc.getBlockTransactionCountByNumber(7687453) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` Haqq JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the Haqq network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: 7687453 + +{% embed url="https://codepen.io/tatum-devrel/pen/YzRmbaE" %} + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": [7687453] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..b864939 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,77 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const code = await tatum.rpc.getCode('0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the Haqq JSON-RPC API, which allows users to interact with the Haqq blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQXgJV" %} + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte Haqq address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..aa638fa --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,113 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const logs = await tatum.rpc.getLogs({ address : '0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an Haqq JSON-RPC method that allows developers to query logs generated by the Haqq network, specifically event logs emitted by smart contracts. These logs are an essential part of the Haqq ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the Haqq blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjegqMb" %} + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` Haqq JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the Haqq network and use the retrieved data to track and react to events happening on the Haqq blockchain. diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..fc0f0a9 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,109 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const result = await tatum.rpc.getProof("0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is an Haqq JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire Haqq state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQMmVM" %} + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..9dda701 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,71 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const response = await tatum.rpc.getStorageAt('0x742d35Cc6634C0532925a3b844Bc454e4438f44e', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an Haqq JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +{% embed url="https://codepen.io/tatum-devrel/pen/yLQmWjB" %} + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..66ce4fa --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,104 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0xC52DA0AB755168DCB6E38E7B001832F9373BA4EE688F56CFF75C6E928B78BCF3', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Haqq JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQowjp" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0xC52DA0AB755168DCB6E38E7B001832F9373BA4EE688F56CFF75C6E928B78BCF3"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0xC52DA0AB755168DCB6E38E7B001832F9373BA4EE688F56CFF75C6E928B78BCF3", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..81bd11b --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,104 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex(7687453, 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Haqq JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/RwqvOdd" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: 7687453 +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + 7687453, + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..722c355 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,97 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const tx = await tatum.rpc.getTransactionByHash('0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an Haqq JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/MWzLxGd?editors=1111" %} + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xc9a74365087632df3824877d8515f4fca6152148c393d427b5a1f73b6b48216a", + "blockNumber": "0x10a24fe", + "from": "0x1f9090aae28b8a3dceadf281b0f12828e676c326", + "gas": "0x565f", + "gasPrice": "0x4920f718b", + "maxFeePerGas": "0x4920f718b", + "maxPriorityFeePerGas": "0x0", + "hash": "0x06b57a2430c71328be4f86a7bf8bb18cdbe2d55725791733f4eb6151012319a1", + "input": "0x", + "nonce": "0x1c0fa", + "to": "0x388c818ca8b9251b393131c08a736a67ccb19297", + "transactionIndex": "0xc5", + "value": "0x18c6d8afd7453e2", + "type": "0x2", + "accessList": [], + "chainId": "0x1", + "v": "0x0", + "r": "0x9ce24e115c0b85be0c14a6b58fe87f41a5c0179432ec09717edbcd46ff33ab25", + "s": "0x2184449629568a4b3c5420108bf4f5c270d36cf81d11ea7590f010de7bf335a6" + } + +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..975466c --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,76 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const result = await tatum.rpc.getTransactionCount('0x2eAd3B147fc20fB03fd25C71c1677E81714A9Eb5', 'latest') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an Haqq JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/RwqvOmO?editors=1111" %} + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The Haqq address whose transaction count will be retrieved. + * Example: `"0x2eAd3B147fc20fB03fd25C71c1677E81714A9Eb5"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x2eAd3B147fc20fB03fd25C71c1677E81714A9Eb5", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..4f37ebe --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,132 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ} + +const tx = await tatum.rpc.getTransactionReceipt('0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Haqq.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an Haqq JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/XWyOQMN" %} + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xf920dd038c8264244bc7faab54d3f0c1256f992c744a134f0e5886a73107e536" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} + +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..463a140 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,72 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x300e4057498875ef62a7632c78077d9fa79265e484415d337d1f529ca4660ee6') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Haqq JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Haqq network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Haqq network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/xxQMNxz?editors=1111" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..89c4617 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,75 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const result = await tatum.rpc.getUncleCountByBlockNumber(7687453) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Haqq JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Haqq network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Haqq network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + + + +{% embed url="https://codepen.io/Lukas-Kotol/pen/wvQOGYg?editors=1111" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: 7687453 + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + 7687453 + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..6763cee --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,93 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfda", + "to": "0x2C5B9a513bE2240e948a631bAaFB53cc0bEAcfde", + "value": "0xde0b6b3a7640000" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an Haqq JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard ether transfers + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/abQXrEQ" %} + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ISLM to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..9e094a4 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,62 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an Haqq JSON-RPC method used to estimate the average gas price required for transactions in the Haqq network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/OJadYzX" %} + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..3d98862 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,64 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/XWyOwzB" %} + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..17236c5 --- /dev/null +++ b/docs/rpc/evm-blockchains/haqq-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Haqq, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HAQQ}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized Haqq transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring ISLM, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/README.md new file mode 100644 index 0000000..8d43b84 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Horizen EON RPC documentation + +Powered by Horizen, EON is a fully EVM-compatible sidechain and smart contract platform built with massive scalability in mind. Interact with this blockchain network via JSON-RPC methods. diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..575593d --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..ed0f12d --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,104 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.debugTraceBlockByNumber(357368) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..e50c893 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,119 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..7f41b84 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..b41b5fc --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..c8b71b2 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..e9375ce --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..4a27dfa --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,61 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an JSON-RPC method that allows developers to retrieve the currently configured chain ID of the network they are connected to. The chain ID is a unique identifier for different networks, such as mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..9d598b6 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,62 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the JSON-RPC API that allows the client to retrieve the current version of the client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.9.0" +} +``` + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..868c639 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,69 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..661ed90 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,114 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const balance = await tatum.rpc.getBalance('0x99D270f4a42b296fB888f168a5985e1d9839B064') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an JSON-RPC method that allows you to retrieve the balance of a specified address. This method can be used to query the balance of any address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The address of the account or contract whose balance you want to query. + * Example: `"0x99D270f4a42b296fB888f168a5985e1d9839B064"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x99D270f4a42b296fB888f168a5985e1d9839B064", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "BigNumber": { + "s": 1, + "e": 18, + "c": [10611, 3542686313455] + } + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..ce43d96 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,137 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const block = await tatum.rpc.getBlockByHash('0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..a542ebe --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,134 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum'
+  
+const tatum = await TatumSDK.init<HorizenEon>({network: Network.HORIZEN_EON})
+
+const block = await tatum.rpc.getBlockByNumber('latest', true)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..5a31b43 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..e1304d4 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber(371156) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: 371156 + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0x1"` (1 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": [371156] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..470c1b6 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,76 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const code = await tatum.rpc.getCode('0x6eA7d015342b7eb7344F7ebf0150234f41F524d6') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the JSON-RPC API, which allows users to interact with the blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte address, formatted as a hex string with a `0x` prefix. + * Example: `"0x6eA7d015342b7eb7344F7ebf0150234f41F524d6"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x6eA7d015342b7eb7344F7ebf0150234f41F524d6", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..56eee26 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const logs = await tatum.rpc.getLogs({ address : '0x6eA7d015342b7eb7344F7ebf0150234f41F524d6'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an JSON-RPC method that allows developers to query logs generated by the network, specifically event logs emitted by smart contracts. These logs are an essential part of the ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x6eA7d015342b7eb7344F7ebf0150234f41F524d6", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the network and use the retrieved data to track and react to events happening on the blockchain. diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..c6aafa3 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,106 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.getProof("0xBB52B2B91488d60eFb6848bBadd000005A511E5C", +["0x0000000000000000000000000000000000000000000000000000000000000000"], +"latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0xBB52B2B91488d60eFb6848bBadd000005A511E5C"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0xBB52B2B91488d60eFb6848bBadd000005A511E5C", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..a1d8455 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,68 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const response = await tatum.rpc.getStorageAt('0x6eA7d015342b7eb7344F7ebf0150234f41F524d6', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x6eA7d015342b7eb7344F7ebf0150234f41F524d6"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x6eA7d015342b7eb7344F7ebf0150234f41F524d6", + "0x0" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000001" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..84e78f5 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..78aad19 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +iimport { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex(371156, 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: 371156 +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: 0 + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + 371156, + 0 + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..57e6cc7 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,92 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum'
+  
+const tatum = await TatumSDK.init<HorizenEon>({network: Network.HORIZEN_EON})
+
+const tx = await tatum.rpc.getTransactionByHash('0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7')
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6", + "blockNumber": "0x5a9d4", + "transactionIndex": "0x0", + "hash": "0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7", + "type": "0x2", + "nonce": "0x1d8", + "from": "0x8bd5723981d3f96a6544519c4a075f5994919d3a", + "to": "0xa55d9ef16af921b70fed1421c1d298ca5a3a18f1", + "value": "0x0", + "input": "0x3798c7f2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000065082bd900000000000000000000000000000000000000000000000000000000013ebef0000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000003415242000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000344414900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000455534443000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004555344540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000031339e8d000000000000000000000000000000000000000000000000000018a759056108000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000017fc9b3dfb80000000000000000000000000000000000000000000000000000000054572fc0000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000003b9b181f", + "gas": "0x12a68", + "gasPrice": "0x5017ff700", + "maxPriorityFeePerGas": "0x59682f00", + "maxFeePerGas": "0xba43b7400", + "chainId": "0x1ca4", + "v": "0x1c", + "r": "0x75884978fae04ee04de9a2d4fefaaaa4742f4e8f4ccdaf89b01238bafb5292fd", + "s": "0x1f0e92ae5b7f2c8805ebb07900a59a04e73cda12a309021849a5d9ed151d7fd1", + "accessList": [] + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..657d359 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,80 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.getTransactionCount('0xBB52B2B91488d60eFb6848bBadd000005A511E5C', 'latest') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The address whose transaction count will be retrieved. + * Example: `"0xBB52B2B91488d60eFb6848bBadd000005A511E5C"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0xBB52B2B91488d60eFb6848bBadd000005A511E5C", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "BigNumber": { + "s": 1, + "e": 0, + "c": [1] + } + } +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..f80f370 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,109 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum'
+  
+const tatum = await TatumSDK.init<HorizenEon>({network: Network.HORIZEN_EON})
+
+const tx = await tatum.rpc.getTransactionReceipt('0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7')
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Eon.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0xb0ddfcdcc375afce9f365458c5035ca4aaf99f9fe8699522193e16a8718615b6", + "blockNumber": "0x5a9d4", + "transactionIndex": "0x0", + "transactionHash": "0x97d83656ca05890100149be18d0c2a2f94e5337e5e6a643ea78794cd418cdbc7", + "type": "0x2", + "from": "0x8bd5723981d3f96a6544519c4a075f5994919d3a", + "to": "0xa55d9ef16af921b70fed1421c1d298ca5a3a18f1", + "effectiveGasPrice": "0x5017ff700", + "contractAddress": null, + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasUsed": "0x12a68", + "cumulativeGasUsed": "0x12a68", + "status": "0x1" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..6cf2419 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..a1fe945 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,68 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<HorizenEon>({network: Network.HORIZEN_EON})
+
+const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E')
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..b5d43a4 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ZEN to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..70ad25e --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,57 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<HorizenEon>({network: Network.HORIZEN_EON})
+
+const gasPrice = await tatum.rpc.gasPrice()
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an JSON-RPC method used to estimate the average gas price required for transactions in the network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..da5f7a6 --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..3468e0e --- /dev/null +++ b/docs/rpc/evm-blockchains/horizen-eon-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, HorizenEon, Network} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.HORIZEN_EON}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/README.md new file mode 100644 index 0000000..ce6fe03 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Optimism RPC documentation + +Optimism RPC (Remote Procedure Call) is a powerful tool for interacting with the Optimism blockchain network. It provides developers with a standardised interface to communicate with the Ethereum network, enabling them to retrieve data, send transactions, deploy smart contracts, and more. With Optimism RPC, developers can build decentralised applications, integrate blockchain functionality into existing systems, and explore the vast ecosystem of Optimism. diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_getbadblocks.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_getbadblocks.md new file mode 100644 index 0000000..a5eb3ec --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_getbadblocks.md @@ -0,0 +1,99 @@ +# debug\_getBadBlocks + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugGetBadBlocks() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_getBadBlocks` is na RPC method that provides a list of the most recent bad blocks encountered by the client on the network. This feature is valuable for developers and node operators, as it enables them to identify and address any issues or anomalies related to block validation and synchronization. + +By accessing `debug_getBadBlocks`, they can diagnose potential problems and take appropriate actions to ensure the network's stability and integrity. + +### Parameters + +* This method does not accept any parameters. + +### Return Object + +The output is an array of objects, with each object representing the trace result of a transaction within the block. These objects include essential details such as the transaction hash and a block object, which can be null if no block was found for the transaction: + +* `baseFeePerGas`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `difficulty`: The integer representation of the difficulty for this block encoded as hexadecimal. +* `extraData`: The extra data field of this block. +* `gasLimit`: The maximum gas allowed in this block encoded as hexadecimal. +* `gasUsed`: The total used gas by all transactions in this block encoded as hexadecimal. +* `logsBloom`: The bloom filter for the logs of the block. Null if pending. +* `miner`: The address of the beneficiary to whom the mining rewards were given. +* `mixHash`: A 256-bit hash encoded as hexadecimal. +* nonce: The hash of the generated proof-of-work. Null if pending. +* `number`: The block number of the requested block encoded as hexadecimal. Null if pending. +* `parentHash`: The hash of the parent block. +* `receiptsRoot`: The root of the receipts trie of the block. +* `sha3Uncles`: The SHA3 of the uncles data in the block. +* size: The size of this block in bytes as an Integer value encoded as hexadecimal. +* `stateRoot`: The root of the final state trie of the block. +* timestamp: The Unix timestamp for when the block was collated. +* `transactions`: An array of transaction objects with the following fields: + * `blockHash`: The hash of the block where this log was in. Null when it's a pending log. + * `blockNumber`: The block number where this log was in. Null when it's a pending log. + * `from`: The address of the sender. + * `gas`: The gas provided by the sender, encoded as hexadecimal. + * `gasPrice`: The gas price provided by the sender in wei, encoded as hexadecimal. + * maxFeePerGas: The maximum fee per gas set in the transaction. + * `maxPriorityFeePerGas`: The maximum priority gas fee set in the transaction. + * hash: The hash of the transaction. + * `input`: The data sent along with the transaction. + * nonce: The number of transactions made by the sender before this one encoded as hexadecimal. + * `to`: The address of the receiver. Null when it's a contract creation transaction. + * `transactionIndex`: The integer of the transaction's index position that the log was created from. Null when it's a pending log. + * `value`: The value transferred in wei encoded as hexadecimal. + * `type`: The transaction type. + * `accessList`: A list of addresses and storage keys that the transaction plans to access. + * `chainId`: The chain id of the transaction, if any. +* `transactionsRoot`: The root of the transaction trie of the block. +* `uncles`: An array of uncle hashes. +* `rlp`: The RLP encoded header. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_getBadBlocks", + "params": [] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [] +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_storagerangeat.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_storagerangeat.md new file mode 100644 index 0000000..eeec728 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_storagerangeat.md @@ -0,0 +1,84 @@ +# debug\_storageRangeAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugStorageRangeAt( +'0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6', +1, '0x365a2dabcdb56f4f595c3af088b8975c26331448', '0x0', '0x64' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed. + +### Parameters + +The `debug_storageRangeAt` method accepts the following parameters: + +* `blockHash`: The block hash for which the storage range should be retrieved. Example: `"0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82"` +* `txIndex`: The transaction index within the specified block. Example: `1` +* `address`: The contract address for which the storage range should be retrieved. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* `begin`: The beginning of the storage range. Example: `"0x0"` +* `end`: The end of the storage range. Example: `"0x64"` (inclusive) + +### Return Object + +The `debug_storageRangeAt` method returns an object with the following fields: + +* `storage`: An object that contains key-value pairs representing the contract storage, where the key is the storage slot and the value is the stored data. Example: `"0x00..01": "0x00..01"` +* `nextKey`: A key indicating the next storage slot if the requested range is too large, otherwise `null`. Example: `"0x00..02"` or `null` + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "debug_storageRangeAt", + "params": [ + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + "0x1", + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "0x64" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "nextKey": "0x0000000000000000000000000000000000000000000000000000000000000065" + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblock.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblock.md new file mode 100644 index 0000000..f82f6cd --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblock.md @@ -0,0 +1,99 @@ +# debug\_traceBlock + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugTraceBlock('0xAD7C5E' ,{tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlock` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `debug_traceBlock`, developers can obtain detailed insights into the execution flow of each transaction, allowing for in-depth analysis and debugging + +### Parameters + +* `block` - `String` + * RLP encoded block object. +* `options` (optional): An object containing configuration options for the tracer. + * `tracer`: The tracer object with the following fields: + * `callTracer`: The calltracer keeps track of all call frames, including depth 0 calls, made during a transaction. + * `prestateTracer`: The prestateTracer replays the transaction and tracks every part of the state that occurred during the transaction. + * `tracerConfig`: The object to specify the configurations of the tracer. + * onlyTopCall: When set to true, it traces only the primary (top-level) call and not any sub-calls, eliminating additional processing for each call frame. + +### Return Object + +The return object is an array of all invoked opcodes of all transaction that were included in this block. + +* `type`: The type of the call. +* `from`: The address from which the transaction is sent. +* `to`: The address to which the transaction is directed. +* `value`: The integer value sent with this transaction. +* `gas`: The integer value of the gas provided for the transaction execution. +* `gasUsed`: The integer value of the gas used. +* `input`: The data given at the time of input. +* `output`: The data returned as an output. +* `calls`: A list of sub-calls made during the transaction, including detailed trace information for each sub-call. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlock", + "params": [ + "0x1dc....", + { + "tracer": "callTracer" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..274802a --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an Optimism RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbynumber.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..6b25eb1 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,104 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugTraceBlockByNumber(109501394) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an Optimism RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` as `tracerConfig`(optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (required): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "10s"). Default is "5s". + * Example: `tracerConfig: { onlyTopCall: true, timeout: '10', }` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..2c15850 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,119 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0x365a2dabcdb56f4f595c3af088b8975c26331448", + "to": "0x365a2dabcdb56f4f595c3af088b8975c26331449", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0x1b4", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an Optimism RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..2b81c61 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.debugTraceTransaction('0x501bc07b1e3346dabe68c6c0bee7fa52ea59c829396cd621cde0b61829321e58', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an Optimism RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..2feb778 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,129 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Optimism node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..051a4a3 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,76 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running Optimism node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..303ab1a --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,64 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the Optimism network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..5cde644 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,60 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an Optimism JSON-RPC method that allows developers to retrieve the currently configured chain ID of the Optimism network they are connected to. The chain ID is a unique identifier for different Optimism networks, such as Optimism Mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple Optimism networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..9af2b61 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,62 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the Optimism JSON-RPC API that allows the client to retrieve the current version of the Optimism client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the Optimism client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the Optimism client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the Optimism client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the Optimism client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "Geth/v1.10.3-stable-c2d2f1a3/linux-amd64/go1.16.4" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..a32c8a3 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,68 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the Optimism blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the Optimism blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` Optimism RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Optimism JSON-RPC documentation](https://community.optimism.io/docs/developers/build/json-rpc/) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..6ee91bc --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,108 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const balance = await tatum.rpc.getBalance('0x365a2dabcdb56f4f595c3af088b8975c26331448') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Optimism.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an Optimism JSON-RPC method that allows you to retrieve the Ether balance of a specified address. This method can be used to query the balance of any Optimism address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The Optimism address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Ether balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..04f2263 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,137 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const block = await tatum.rpc.getBlockByHash('0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an Optimism JSON-RPC method that allows developers to query a specific block in the Optimism blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..b467b02 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,138 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const block = await tatum.rpc.getBlockByNumber('latest', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs + +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an [Optimism JSON-RPC](https://community.optimism.io/docs/developers/build/json-rpc/) method that allows developers to query a specific block in the Optimism blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..83ca7b8 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,68 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is an Optimism RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..83e1cd6 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,63 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0x66BD5D5') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` Optimism JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the Optimism network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1b4"` (block number 436) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1b4"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..899062d --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,73 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Optimism, Network } from '@tatumio/tatum'
+  
+const tatum = await TatumSDK.init<Optimism>({network: Network.OPTIMISM})
+
+const code = await tatum.rpc.getCode('0xcBA5609AB435969dEF6Ab164c4C0A4165E805783')
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the Optimism JSON-RPC API, which allows users to interact with the Optimism blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte Optimism address, formatted as a hex string with a `0x` prefix. + * Example: `"0xcBA5609AB435969dEF6Ab164c4C0A4165E805783"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0xcBA5609AB435969dEF6Ab164c4C0A4165E805783", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..2f700c0 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,111 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const logs = await tatum.rpc.getLogs({ address : '0x365a2dabcdb56f4f595c3af088b8975c26331448'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an Optimism JSON-RPC method that allows developers to query logs generated by the Optimism network, specifically event logs emitted by smart contracts. These logs are an essential part of the Optimism ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the Optimism blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x365a2dabcdb56f4f595c3af088b8975c26331448"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x365a2dabcdb56f4f595c3af088b8975c26331448"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x365a2dabcdb56f4f595c3af088b8975c26331448", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` Optimism JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the Optimism network and use the retrieved data to track and react to events happening on the Optimism blockchain. diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..590de50 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,107 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.getProof("0x365a2dabcdb56f4f595c3af088b8975c26331448", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is an Optimism JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire Optimism state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..536c6b1 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,70 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const response = await +tatum.rpc.getStorageAt('0xcBA5609AB435969dEF6Ab164c4C0A4165E805783', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an Optimism JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0xcBA5609AB435969dEF6Ab164c4C0A4165E805783"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0xcBA5609AB435969dEF6Ab164c4C0A4165E805783", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000fd6626" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..16e35e8 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,102 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Optimism JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x9a9a2a0d69b4ff48f7a2a8a26d135e1dbcbd3c3be3e8a3c90de0bcb104e4c4b4"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..dc6a1da --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,106 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0x66BD5D5', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an Optimism JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/nader-tatum/pen/WNYbaXQ" %} +Try this function +{% endembed %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0x316624"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0x316624", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..24bd679 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,92 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const tx = await tatum.rpc.getTransactionByHash('0x501bc07b1e3346dabe68c6c0bee7fa52ea59c829396cd621cde0b61829321e58') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an [Optimism JSON-RPC](https://community.optimism.io/docs/developers/build/json-rpc/) method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..e40d080 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,74 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.getTransactionCount('0x365a2dabcdb56f4f595c3af088b8975c26331448', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an Optimism JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The Optimism address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..00148c0 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,126 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+  
+import { TatumSDK, Optimism, Network } from '@tatumio/tatum'
+  
+const tatum = await TatumSDK.init<Optimism>({network: Network.OPTIMISM})
+
+const tx = await tatum.rpc.getTransactionReceipt('0x501bc07b1e3346dabe68c6c0bee7fa52ea59c829396cd621cde0b61829321e58')
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Optimism.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an Optimism JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..8149ef4 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,70 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x00ccb8a97e104e09ebec66f9c58aca7d42df4fbb7cfcf1a9ff4cb7fc08814cd6') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Optimism JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Optimism network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Optimism network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..866edd6 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const result = await tatum.rpc.getUncleCountByBlockNumber('0x66BD5D5') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an Optimism JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Optimism network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the Optimism network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..361a2a0 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,92 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0x365a2dabcdb56f4f595c3af088b8975c26331448", + "to": "0x365a2dabcdb56f4f595c3af088b8975c26331449", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an Optimism JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard ether transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ether to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..22e3d7e --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,60 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an Optimism JSON-RPC method used to estimate the average gas price required for transactions in the Optimism network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..a50e9e6 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,62 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..1530311 --- /dev/null +++ b/docs/rpc/evm-blockchains/optimism-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,62 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Optimism, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.OPTIMISM}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized Optimism transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring Ether, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/README.md new file mode 100644 index 0000000..67e3e92 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/README.md @@ -0,0 +1,11 @@ +# Polygon RPC documentation + +Polygon RPC (Remote Procedure Call) is a crucial tool for developers looking to interact with the Polygon blockchain network. It provides a standardised interface for communication, allowing developers to retrieve data, send transactions, deploy smart contracts, and more. With Polygon RPC, developers can build decentralised applications, integrate blockchain functionality, and explore the diverse ecosystem of Polygon. + +Getting Started with Polygon RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/z5DN8s2qv0g" %} +Polygon RPC +{% endembed %} + +In this video tutorial, we will guide you through the process of getting started with Polygon RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including Polygon. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Polygon network via RPC, and perform common operations such as retrieving balance of an address. Whether you are a beginner or an experienced developer, this tutorial will provide you with the necessary steps to kickstart your web3 app development journey on Polygon. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_storagerangeat.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_storagerangeat.md new file mode 100644 index 0000000..89ccb04 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_storagerangeat.md @@ -0,0 +1,84 @@ +# debug\_storageRangeAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.debugStorageRangeAt( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +1, '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0', '0x64' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed. + +### Parameters + +The `debug_storageRangeAt` method accepts the following parameters: + +* `blockHash`: The block hash for which the storage range should be retrieved. Example: `"0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82"` +* `txIndex`: The transaction index within the specified block. Example: `1` +* `address`: The contract address for which the storage range should be retrieved. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* `begin`: The beginning of the storage range. Example: `"0x0"` +* `end`: The end of the storage range. Example: `"0x64"` (inclusive) + +### Return Object + +The `debug_storageRangeAt` method returns an object with the following fields: + +* `storage`: An object that contains key-value pairs representing the contract storage, where the key is the storage slot and the value is the stored data. Example: `"0x00..01": "0x00..01"` +* `nextKey`: A key indicating the next storage slot if the requested range is too large, otherwise `null`. Example: `"0x00..02"` or `null` + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "debug_storageRangeAt", + "params": [ + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + "0x1", + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "0x64" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "nextKey": "0x0000000000000000000000000000000000000000000000000000000000000065" + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_traceblockbyhash.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..ce6b40f --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,106 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is a Polygon RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracecall.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracecall.md new file mode 100644 index 0000000..a61ab74 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracecall.md @@ -0,0 +1,119 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0x1b4", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is a Polygon RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracetransaction.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..6ec7954 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/debug_tracetransaction.md @@ -0,0 +1,102 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.debugTraceTransaction('0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is a Polygon RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/eth_getblockreceipts.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/eth_getblockreceipts.md new file mode 100644 index 0000000..9a6ef19 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/archival-information/eth_getblockreceipts.md @@ -0,0 +1,139 @@ +# eth\_getBlockReceipts + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.getBlockReceipts(47292218) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockReceipts` method retrieves and returns all transaction receipts for a specific block. Transaction receipts contain essential information related to the execution status and outcomes of individual transactions within the block, including details about the amount of gas used, contract events emitted, and whether the transactions were successful or not. + +By using the `eth_getBlockReceipts`, developers can seek a comprehensive overview of the transactions' results within a particular block. + +### Parameters + +The `eth_getBlockReceipts` method accepts the following parameters: + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` + +### Return Object + +`eth_getBlockReceipts` method provides a detailed set of information for each transaction receipt within a given block. The returned data includes: + +* `blockHash`: The hash of the block (null if pending). +* `blockNumber`: The block number. +* `contractAddress`: The contract address created if the transaction was for contract creation; otherwise, null. +* `cumulativeGasUsed`: The total amount of gas used when this transaction was executed in the block. +* `effectiveGasPrice`: The actual value per gas deducted from the sender account. +* from: The address of the sender. +* `gasUsed`: The amount of gas used by this specific transaction alone. +* `logs`: An array of log objects that generated this transaction, containing: + * `address`: The address from which this log originated. + * topics: In Solidity, the first topic is the hash of the signature of the event, unless the event is declared with the anonymous specifier. + * `data`: It contains one or more 32 Bytes non-indexed arguments of the log. + * `blockNumber`: The block number where this log was in. + * `transactionHash`: The hash of the transaction this log was created from, or null if it's a pending log. + * `transactionIndex`: The integer of the transaction's index position that the log was created fromr null if it's a pending log. + * `blockHash`: The hash of the block where this log was inr null if it's a pending log. + * `logIndex`: The integer of the log index position in the blockr null if it's a pending log. + * `removed`: It is true when the log was removed due to a chain reorganization, and false if it's a valid log. +* `logsBloom`: The bloom filter for light clients to quickly retrieve related logs. +* `status`: It is either 1 (success) or 0 (failure) encoded as a hexadecimal. +* `to`: The address of the receiver. It will be null when the transaction is for contract creation. +* `transactionHash`: The hash of the transaction. +* `transactionIndex`: The index of the transaction within the block. +* `type`: The value type. + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc":"2.0", + "method":"eth_getBlockReceipts", + "params":["0x2a6a150"], + "id":1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [ + { + "blockHash": "0xfb368ca825fdf63ce3bd3c22344e9b50fcb56fc7341cce71192535c2f55ccf93", + "blockNumber": "0x2a6a150", + "contractAddress": null, + "cumulativeGasUsed": "0x5b2a92", + "effectiveGasPrice": "0x26b748cd1d", + "from": "0x0d882c09a3e03aa9afb2967a1eebddd67934f7be", + "gasUsed": "0xf840", + "logs": [ + { + "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000d882c09a3e03aa9afb2967a1eebddd67934f7be", + "0x00000000000000000000000073cc2c7189aa0d63ed0c243d42d3cd5210372067" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000003750280", + "blockNumber": "0x2a6a150", + "transactionHash": "0x21b576878544bc1e8731d6fb120901bc6b7ecc27713f3bf1e2a75118f1fa35e3", + "transactionIndex": "0x36", + "blockHash": "0xfb368ca825fdf63ce3bd3c22344e9b50fcb56fc7341cce71192535c2f55ccf93", + "logIndex": "0xc3", + "removed": false + }, + { + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000000d882c09a3e03aa9afb2967a1eebddd67934f7be", + "0x00000000000000000000000002f70172f7f490653665c9bfac0666147c8af1f5" + ], + "data": "0x0000000000000000000000000000000000000000000000000006c601978b000000000000000000000000000000000000000000000000000932b9349556b3b25c000000000000000000000000000000000000000000000082c4b21c5f77055dc900000000000000000000000000000000000000000000000932b26e93bf28b25c000000000000000000000000000000000000000000000082c4b8e2610e905dc9", + "blockNumber": "0x2a6a150", + "transactionHash": "0x21b576878544bc1e8731d6fb120901bc6b7ecc27713f3bf1e2a75118f1fa35e3", + "transactionIndex": "0x36", + "blockHash": "0xfb368ca825fdf63ce3bd3c22344e9b50fcb56fc7341cce71192535c2f55ccf93", + "logIndex": "0xc4", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000002000000000008000000800000000000200000000110000000000000000000000000000000000000000001000000800000000180000010000000000001000000400000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000002000000000001000000000000100000000000000000100000000000000000008000080000000000000000000000000000000000001000000000100000", + "status": "0x1", + "to": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "transactionHash": "0x21b576878544bc1e8731d6fb120901bc6b7ecc27713f3bf1e2a75118f1fa35e3", + "transactionIndex": "0x36", + "type": "0x2" + } + ] +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_content.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_content.md new file mode 100644 index 0000000..1a4c2a5 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_content.md @@ -0,0 +1,131 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Polygon node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQMmMW?editors=1010" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_inspect.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_inspect.md new file mode 100644 index 0000000..5d2093f --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_inspect.md @@ -0,0 +1,80 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running Polygon node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyOoQz" %} + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + + + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_status.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_status.md new file mode 100644 index 0000000..4621bb3 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/mempool/txpool_status.md @@ -0,0 +1,66 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the Polygon network and analysing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQzOyV" %} + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/eth_chainid.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/eth_chainid.md new file mode 100644 index 0000000..4493b2f --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/eth_chainid.md @@ -0,0 +1,64 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is a Polygon JSON-RPC method that allows developers to retrieve the currently configured chain ID of the Polygon network they are connected to. The chain ID is a unique identifier for different Polygon networks, such as Polygon Mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple Polygon networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +{% embed url="https://codepen.io/tatum-devrel/pen/LYXqMMB" %} + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x89" +} +``` + +In this example, the returned chain ID is `0x89`, which corresponds to the Polygon Mainnet. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/web3_clientversion.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..2dcca6c --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-client-information/web3_clientversion.md @@ -0,0 +1,66 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the Polygon JSON-RPC API that allows the client to retrieve the current version of the Polygon client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the Polygon client software they are using and ensure that it is compatible with their application. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQGqGN" %} + +### Parameters + +This method has no parameters. It only retrieves the current version of the Polygon client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the Polygon client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the Polygon client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 67 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "Geth/v1.10.3-stable-c2d2f1a3/linux-amd64/go1.16.4" +} +``` + +In the above example, the Polygon client software being used is Geth, version 1.10.3, with build information `stable-c2d2f1a3/linux-amd64/go1.16.4`. The `result` field contains the version string. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_blocknumber.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_blocknumber.md new file mode 100644 index 0000000..ad95984 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_blocknumber.md @@ -0,0 +1,70 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the Polygon blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronizing a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions + +{% embed url="https://codepen.io/tatum-devrel/pen/OJadwLg" %} + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the Ethereum blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` Polygon RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getbalance.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getbalance.md new file mode 100644 index 0000000..0be104a --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getbalance.md @@ -0,0 +1,90 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const balance = await tatum.rpc.getBalance('0x742d35Cc6634C0532925a3b844Bc454e4438f44e') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an Polygon JSON-RPC method that allows you to retrieve the MATIC balance of a specified address. This method can be used to query the balance of any Polygon address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralised application (DApp). + + + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQzOWP" %} + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The Polygon address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The MATIC balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbyhash.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..f863f52 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbyhash.md @@ -0,0 +1,141 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const block = await tatum.rpc.getBlockByHash('0x20338a164dfb8f23d067df87fe0fb89a9248b2071ec2e91ac0383f5c0b1fb13d', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an Polygon JSON-RPC method that allows developers to query a specific block in the Polygon blockchain by its block hash. This method can be used in various scenarios, such as analysing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqvGLE?editors=1010" %} +Try this function +{% endembed %} + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x20338a164dfb8f23d067df87fe0fb89a9248b2071ec2e91ac0383f5c0b1fb13d"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x20338a164dfb8f23d067df87fe0fb89a9248b2071ec2e91ac0383f5c0b1fb13d", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbynumber.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..bafebb2 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblockbynumber.md @@ -0,0 +1,139 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const block = await tatum.rpc.getBlockByNumber('latest', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an Polygon JSON-RPC method that allows developers to query a specific block in the Polygon blockchain by its block number. This method can be used in various scenarios, such as analysing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQqjOW" %} + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..07c759f --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,70 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a Polygon RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring network activity or estimating transaction confirmation times. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjexwZp?editors=1111" %} + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..604f639 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,65 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber(47766249) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` Polygon JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyse the transaction activity of a specific block. You can use it to gain insights into network usage, analyse the impact of specific events on the Polygon network, or monitor transaction congestion in certain blocks. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQqZKy" %} + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: 47766249 + +### Return Object + +The returned object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": [47766249] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x33" +} +``` + + + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getcode.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getcode.md new file mode 100644 index 0000000..8f4ffe5 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getcode.md @@ -0,0 +1,78 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const code = await tatum.rpc.getCode('0x4d544035500D7aC1B42329c70eb58E77f8249f0F') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the Polygon JSON-RPC API, which allows users to interact with the Polygon blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analysing contract bytecode for security vulnerabilities + +{% embed url="https://codepen.io/tatum-devrel/pen/NWEoeYW" %} + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte Polygon address, formatted as a hex string with a `0x` prefix. + * Example: `"0x4d544035500D7aC1B42329c70eb58E77f8249f0F"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x4d544035500D7aC1B42329c70eb58E77f8249f0F", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getlogs.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getlogs.md new file mode 100644 index 0000000..9d1eb2b --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getlogs.md @@ -0,0 +1,113 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const logs = await tatum.rpc.getLogs({ address : '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` a method is a Polygon JSON-RPC method that allows developers to query logs generated by the Polygon network, specifically event logs emitted by smart contracts. These logs are an essential part of the Polygon ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralised applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the Polygon blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/OJadrgq" %} + +### Parameters + +The `eth_getLogs` the method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. It can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. It can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. It can be a single address or an array of addresses. + * Example: `"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` the field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` the method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` Polygon JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the Polygon network and use the retrieved data to track and react to events happening on the Polygon blockchain. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getproof.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getproof.md new file mode 100644 index 0000000..8bbe637 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getproof.md @@ -0,0 +1,109 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.getProof("0xE7aFC41f0f99a305935857BA27bee99c4A29AC83", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a Polygon JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire Polygon state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQbvzv" %} + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0xE7aFC41f0f99a305935857BA27bee99c4A29AC83"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0xE7aFC41f0f99a305935857BA27bee99c4A29AC83", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getstorageat.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getstorageat.md new file mode 100644 index 0000000..4a603c9 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getstorageat.md @@ -0,0 +1,71 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const response = await tatum.rpc.getStorageAt('0x0000000000000000000000000000000000001010', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is a Polygon JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/eYQYNzG" %} + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x0000000000000000000000000000000000001010"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x0000000000000000000000000000000000001010", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..67b4e54 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,104 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is a Polygon JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/Martin-Zemanek/pen/wvQvMWR" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x25b4d076c94a987a7ad167f6005a970d4a4d32248b61efbaaf132aa44bc59a61", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..cbe42e3 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,104 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex(47766249, 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is a Polygon JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +{% embed url="https://codepen.io/Martin-Zemanek/pen/xxQxZRq" %} + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: 47766249 +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + 47766249, + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyhash.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..401cdda --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,94 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const tx = await tatum.rpc.getTransactionByHash('0x96d438a206d5cbb23e71b857af01371fcaf33406d2b76fe0eb41eb35a0fac84e') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an Polygon JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analysing historical transaction data. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQxbvd?editors=1111" %} + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0x96d438a206d5cbb23e71b857af01371fcaf33406d2b76fe0eb41eb35a0fac84e"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0x96d438a206d5cbb23e71b857af01371fcaf33406d2b76fe0eb41eb35a0fac84e"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactioncount.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..5f61925 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactioncount.md @@ -0,0 +1,76 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.getTransactionCount('0xE7aFC41f0f99a305935857BA27bee99c4A29AC83', 'latest') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is a Polygon JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQgLMY" %} + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The Polygon address whose transaction count will be retrieved. + * Example: `"0xE7aFC41f0f99a305935857BA27bee99c4A29AC83"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0xE7aFC41f0f99a305935857BA27bee99c4A29AC83", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionreceipt.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..f49132b --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,110 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const tx = await tatum.rpc.getTransactionReceipt('0x45d672978664c0daefd2f99a5868873c31316975ed1d52839c7f52883ac030f0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an Polygon JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJYzvW" %} + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0x45d672978664c0daefd2f99a5868873c31316975ed1d52839c7f52883ac030f0"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0x45d672978664c0daefd2f99a5868873c31316975ed1d52839c7f52883ac030f0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..e885900 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,72 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is a Polygon JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Polygon network and analyzing the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralisation of the Polygon network. The inclusion of uncles helps prevent centralisation and ensures the mining process remains competitive. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQdXQq" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The returned object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..fa05042 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,73 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const result = await tatum.rpc.getUncleCountByBlockNumber(10123321) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is a Polygon JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the Polygon network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralisation of the Polygon network. The inclusion of uncles helps prevent centralisation and ensures the mining process remains competitive. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQNRRv" %} + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/README.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_estimategas.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_estimategas.md new file mode 100644 index 0000000..f66be26 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_estimategas.md @@ -0,0 +1,96 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is a Polygon JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to predict the gas fees better and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard ether transfers + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOrGBQ" %} +Try this function +{% endembed %} + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ether to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_gasprice.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_gasprice.md new file mode 100644 index 0000000..930cf19 --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_gasprice.md @@ -0,0 +1,70 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is a Polygon JSON-RPC method used to estimate the average gas price required for transactions in the Polygon network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQbbBM" %} + +### Parameters + +The `eth_gasPrice` method does not require any parameters. However, the transaction object should include the following fields: + +* **`from`** (optional): The sender's Polygon address. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional): The recipient's Polygon address. Example: `"0x5aeda56215b167893e80b4fe645ba6d5bab767de"` +* **`gas`** (optional): The maximum amount of gas to be used for the transaction. Example: `"0x76c0"` +* **`gasPrice`** (optional): The gas price in wei for each unit of gas. Example: `"0x9184e72a000"` +* **`value`** (optional): The amount of ether to be sent in the transaction in wei. Example: `"0x9184e72a"` +* **`data`** (optional): The input data associated with the transaction, typically used for contract calls. Example: `"0xd46e8dd67c5d32be8058bb8eb970870f072445675"` +* `nonce` (optional): The transaction count for the sender's address. Example: `"0x1"` + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..54a7cad --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,64 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQddOV" %} + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_sendrawtransaction.md b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..aabec8c --- /dev/null +++ b/docs/rpc/evm-blockchains/polygon-rpc-documentation/transaction/eth_sendrawtransaction.md @@ -0,0 +1,66 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Polygon, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.POLYGON}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized Polygon transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring Ether, interacting with smart contracts, or deploying new contracts. + +{% embed url="https://codepen.io/tatum-devrel/pen/OJaddPP" %} +Try this function +{% endembed %} + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/solana-rpc-documentation/README.md b/docs/rpc/solana-rpc-documentation/README.md new file mode 100644 index 0000000..16b676f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/README.md @@ -0,0 +1,9 @@ +# Solana RPC documentation + +Solana RPC (Remote Procedure Call) is a crucial tool for developers looking to interact with the Solana blockchain network. It provides a standardized interface for communication, allowing developers to retrieve data, send transactions, deploy smart contracts, and more. Solana RPC plays a vital role in building decentralised applications, integrating blockchain functionality, and exploring the rich ecosystem of Solana. + +Getting Started with Solana RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/bYBqj_1_97I" %} + +In this video tutorial, we will guide you through the process of getting started with Solana RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including Solana. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Solana network via RPC, and perform common operations such as getMultipleAccounts. diff --git a/docs/rpc/solana-rpc-documentation/account-information/README.md b/docs/rpc/solana-rpc-documentation/account-information/README.md new file mode 100644 index 0000000..2c279f9 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/README.md @@ -0,0 +1,2 @@ +# Account information + diff --git a/docs/rpc/solana-rpc-documentation/account-information/getaccountinfo.md b/docs/rpc/solana-rpc-documentation/account-information/getaccountinfo.md new file mode 100644 index 0000000..791a8ec --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getaccountinfo.md @@ -0,0 +1,90 @@ +# getAccountInfo + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getAccountInfo('ChkH4bTk7c5NSGbxvXx89yY2oU7rFJsr3Cq1gPNCCPVe') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAccountInfo` RPC method is used to fetch and retrieve specific and detailed information about a particular account on the Solana blockchain. This information includes the current state of the account, its associated data, and the account's current balance. + +This method could be used in scenarios where detailed account data is required, for example, to verify transactions, check account balances, or to review the account's history. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQErrY" %} + +### Parameters + +The `getAccountInfo` method accepts two parameters: + +* `accountPubkey`(string, required): The public key of the account for which information is to be fetched. + * Example: `"ChkH4bTk7c5NSGbxvXx89yY2oU7rFJsr3Cq1gPNCCPVe"` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `encoding` (string, optional): Encoding format for Account data + * Values: `base58` `base64` `base64+zstd` `jsonParsed` + +### Return object + +The `getAccountInfo` method returns an object containing the following fields: + +* `context`: An object containing details about the context in which the account information was fetched. + * `slot`: The slot at which the data was fetched. +* `value`: An object containing the account's information. + * `owner`: The public key of the account's owner. + * `lamports`: The account's current balance. + * `data`: data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + * `executable`: Whether the account is marked as executable. + * `rentEpoch`: The rent epoch value of the account. + * `size`: The data size of the account + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getAccountInfo", + "params": [ + "ChkH4bTk7c5NSGbxvXx89yY2oU7rFJsr3Cq1gPNCCPVe", + { + "commitment": "finalized", + "encoding": "base64" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "context": { + "slot": 123456 + }, + "value": { + "owner": "Base58('11111111111111111111111111111111')", + "lamports": 1000000, + "data": "Base64('...')", + "executable": false, + "rentEpoch": 20, + "size": 120 + } + } +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/getbalance.md b/docs/rpc/solana-rpc-documentation/account-information/getbalance.md new file mode 100644 index 0000000..253e85b --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getbalance.md @@ -0,0 +1,66 @@ +# getBalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBalance('8Ew6iQXcTRHAUNNu3X9VBn1g1bJkXEZJ9gFD2AGKtdPB') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBalance` RPC method is used to retrieve the current balance of a specified account on the Solana blockchain. It's a straightforward and efficient way to monitor and keep track of account balances. + +This method is typically used in scenarios where you need to check the available balance before initiating a transaction or for accounting purposes in a wallet application. + +### Parameters + +The `getBalance` method requires one parameter: + +* (string, required) Pubkey of account to query, as base-58 encoded string + * Example: `"8Ew6iQXcTRHAUNNu3X9VBn1g1bJkXEZJ9gFD2AGKtdPB"` + +### Return object + +The `getBalance` method returns an object containing the following fields: + +* `context`: An object containing details about the context in which the balance was fetched. + * `slot`: The slot at which the data was fetched. +* `value`: The current balance of the account, in lamports. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getBalance", + "params": [ + "8Ew6iQXcTRHAUNNu3X9VBn1g1bJkXEZJ9gFD2AGKtdPB", + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "context": { + "slot": 194573649 + }, + "value": 2484257209 + } +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/getlargestaccounts.md b/docs/rpc/solana-rpc-documentation/account-information/getlargestaccounts.md new file mode 100644 index 0000000..a67915d --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getlargestaccounts.md @@ -0,0 +1,70 @@ +# getLargestAccounts + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getLargestAccounts() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getLargestAccounts` method returns the 20 largest accounts by lamport balance. This method may cache results for up to two hours. + +### Parameters + +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `filter` (string, optional): Filters the results by account type. Possible values are `circulating` or `nonCirculating`. + +### Return Object + +The result field will be an `RpcResponse` JSON object with a `value` field equal to an array of objects, each containing: + +* `address`: Base-58 encoded address of the account. +* `lamports`: Number of lamports in the account. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getLargestAccounts" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 54 + }, + "value": [ + { + "lamports": 999974, + "address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ" + }, + { + "lamports": 42, + "address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL" + }, + // ...additional accounts... + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/getmultipleaccounts.md b/docs/rpc/solana-rpc-documentation/account-information/getmultipleaccounts.md new file mode 100644 index 0000000..7f36836 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getmultipleaccounts.md @@ -0,0 +1,111 @@ +# getMultipleAccounts + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const accounts = [ + "GPHrLJNBeFDkHEChoN6CyHFLroen7jVU3HBmJQXvqGQa", + "4DBehwe4U1gHaE575LZVnjN1MfyPSyWjidadRJoQcyAR", + ]; + +const res = await tatum.rpc.getMultipleAccounts(accounts) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getMultipleAccounts` RPC method fetches information about multiple accounts. This is handy when you need to retrieve data about multiple accounts simultaneously, such as for a portfolio management application or a multi-account wallet. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQBVOJ?editors=1011" %} + +### Parameters + +The `getMultipleAccounts` method accepts an array of public keys and an optional `GetMultipleAccountsOptions` object: + +* `publicKeys`(array of strings, required): An array of public keys of the accounts to be fetched. + * Example: `["accountPubkey1", "accountPubkey2"]` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot to include in the response. + * Example: `1000` + * `dataSlice` (object, optional): The range of data to include in the response. + * `offset` (number, optional): The starting index of the data slice. + * Example: `0` + * `length` (number, optional): The length of the data slice. + * Example: `100` + * `encoding` (string, optional): The encoding for the account data. + * Values: `base58` `base64` `base64+zstd` `jsonParsed` + +### Return object + +The result will be a JSON object with `value` equal to an array of: + +* `null` - if the account at that Pubkey doesn't exist, or +* `object` - a JSON object containing: + * `data`: `[string, encoding]|object` - data associated with the account, either as encoded binary data or JSON format `{program: state}` - depending on encoding parameter + * `executable`: A boolean indicating whether the account is executable. + * `lamports`: The current balance of the account, in lamports. + * `owner`: The public key of the account's owner. + * `rentEpoch:`The epoch at which this account will next owe rent, as u64 + * `size:`The data size of the account + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getMultipleAccounts", + "params": [ + ["accountPubkey1", "accountPubkey2"], + { + "commitment": "finalized", + "minContextSlot": 1000, + "dataSlice": { "offset": 0, "length": 100 }, + "encoding": "base64" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "result":{ + "context":{ + "slot":123456 + }, + "value":[ + { + "owner": "Base58('11111111111111111111111111111111')", + "lamports": 1000000, + "data": "Base64('...')", + "executable": false, + "rentEpoch": 20, + "size": 120 + }, + { + "owner": "Base58('11111111111111111111111111111111')", + "lamports": 1000000, + "data": "Base64('...')", + "executable": false, + "rentEpoch": 20, + "size": 120 + } + ] + } +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/getprogramaccounts.md b/docs/rpc/solana-rpc-documentation/account-information/getprogramaccounts.md new file mode 100644 index 0000000..9717216 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getprogramaccounts.md @@ -0,0 +1,111 @@ +# getProgramAccounts + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getProgramAccounts('BPFLoaderUpgradeab1e11111111111111111111111') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getProgramAccounts` RPC method retrieves all accounts owned by a specific program on the Solana blockchain. This method can be useful when monitoring the state of a program or tracking the accounts associated with a particular smart contract. + +Currently pagination is not supported. Requests to `getProgramAccounts` should include the `dataSlice` and/or `filters` parameters to improve response time and return only intended results. + +### Parameters + +The `getProgramAccounts` method accepts a program ID and an optional object: + +* `programId`(string, required): Pubkey of program, as base-58 encoded string + * Example: `"BPFLoaderUpgradeab1e11111111111111111111111"` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at + * Example: `123456` + * `withContext` (boolean, optional): Whether to wrap the result in an RpcResponse JSON object + * Example: `true` + * `encoding` (string, optional): The encoding format for the returned Account data + * Example: `base58` `base64` `base64+zstd` `jsonParsed` + * `dataSlice` (object, optional): Limit the returned account data using the provided \`offset: number\` and \`length: number\` fields; + * only available for "base58", "base64" or "base64+zstd" encodings. + * Example: `{ offset: 0, length: 100 }` + * `filters` (array, optional): An array of filter objects to filter the accounts based on certain conditions. + * Example: `[{ memcmp: { offset: 0, bytes: "base64" } }` + +### Return object + +The `getProgramAccounts` method returns an array of objects, each containing the following fields: + +* `pubkey`: The public key of the account. +* `account`: An object containing: + * `data`: The account's data, encoded according to the requested format. + * `executable`: Whether the account is executable. + * `lamports`: The account's current balance. + * `owner`: The account's owner public key. + * `rentEpoch`: The epoch at which the account will owe rent again. + * `size`: The data size of the account + +If `withContext` is set to true, the response will also include a `context` object: + +* `context`: An object containing details about the context in which the data was fetched. + * `slot`: The slot at which the data was fetched. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getProgramAccounts", + "params": [ + "BPFLoaderUpgradeab1e11111111111111111111111", + { + "commitment": "finalized", + "minContextSlot": 123456, + "withContext": true, + "encoding": "base64", + "dataSlice": { "offset": 0, "length": 100 }, + "filters": [{ "memcmp": { "offset": 0, "bytes": "base64" } }] + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "context": { + "slot": 123456 + }, + "value": [ + { + "pubkey": "9ehXDD5bnhSpFVRf99veikjgq8VajtRH7e3D9aVPLqYd", + "account": { + "data": "base64 encoded data", + "executable": false, + "lamports": 10000, + "owner": "BPFLoaderUpgradeab1e11111111111111111111111", + "rentEpoch": 10 + "size": 120 + } + } + //... more accounts + ] + } +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountbalance.md b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountbalance.md new file mode 100644 index 0000000..83b0b0f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountbalance.md @@ -0,0 +1,85 @@ +# getTokenAccountBalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getTokenAccountBalance('DhzDoryP2a4rMK2bcWwJxrE2uW6ir81ES8ZwJJPPpxDN') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTokenAccountBalance` method provides the ability to fetch the current balance of a given SPL Token account. It is used when you want to know the amount of tokens held in a specific token account. The token account is specified by its public key. + +{% embed url="https://codepen.io/tatum-devrel/pen/KKrEzqq" %} + +### Parameters + +This method accepts two parameters: + +* `pubkey` (string, required): Pubkey of Token account to query, as base-58 encoded string + * Example: `"DhzDoryP2a4rMK2bcWwJxrE2uW6ir81ES8ZwJJPPpxDN"` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + +### Return object + +The `getTokenAccountBalance` method returns an object containing the following fields: + +* `value`: An object containing: + * `amount`: The raw balance without decimals, a string representation of number + * `decimals`: Number of base 10 digits to the right of the decimal place + * `uiAmount`: Number or null. The balance, using mint-prescribed decimals **DEPRECATED** + * `uiAmountString`: The balance as a string, using mint-prescribed decimals + +If `withContext` is set to true, the response will also include a `context` object: + +* `context`: An object containing details about the context in which the data was fetched. + * `slot`: The slot at which the data was fetched. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountBalance", + "params": [ + "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + { + "commitment": "finalized", + "encoding": "base64" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "context": { + "slot": 123456 + }, + "value": { + "amount": "10000", + "decimals": 6, + "uiAmount": 0.01, + "uiAmountString": "0.01" + } + } +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbydelegate.md b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbydelegate.md new file mode 100644 index 0000000..637784d --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbydelegate.md @@ -0,0 +1,120 @@ +# getTokenAccountsByDelegate + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const delegate = "GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa"; + +const res = await tatum.rpc.getTokenAccountsByDelegate(delegate) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTokenAccountsByDelegate` method returns all SPL Token accounts by a specified delegate. This can be useful when you need to retrieve all token accounts associated with a specific delegate address, typically in situations where you are managing or auditing the accounts managed by a particular delegate. + +### Parameters + +* `delegate` (string, required): Pubkey of account delegate to query, as base-58 encoded string + * Example: `"GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa"` +* `config`(object, optional): An optional object containing either of the following: + * `mint`(string): Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string + * Example: `{ mint: 'So11111111111111111111111111111111111111112' }` + * `programId` (string): Pubkey of the Token program that owns the accounts, as base-58 encoded string + * Example: `{ programId: 'So11111111111111111111111111111111111111112' }` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at + * Example: `1000` + * `dataSlice` (object, optional): limit the returned account data using the provided `offset` (number) and `length` (number) fields; only available for `base58`, `base64` or `base64+zstd` encodings. + * Example: `{ "offset": 0, "length": 100 }` + * `encoding` (string, optional): The encoding for the account data. + * Values: `base58` `base64` `base64+zstd` `jsonParsed` + +### Return object + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: + +* `pubkey`: Public key of the account. +* `account`: A JSON object, with the following sub fields: + * `executable`: Whether the account is executable. + * `owner`: Base-58 encoded Pubkey of the program this account has been assigned to + * `lamports`: Number of lamports in the account. + * `data`: Token state data associated with the account, either as encoded binary data or in JSON format `{program: state}` + * `rentEpoch`: The epoch at which the account will next owe rent. + * `size`: The data size of the account + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountsByDelegate", + "params": [ + "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "account": { + "data": { + "program": "spl-token", + "parsed": { + "info": { + "tokenAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "delegatedAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "state": "initialized", + "isNative": false, + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", + "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD" + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 1726080, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 4, + "space": 165 + }, + "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp" + } + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbyowner.md b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbyowner.md new file mode 100644 index 0000000..bc9dc87 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/gettokenaccountsbyowner.md @@ -0,0 +1,131 @@ +# getTokenAccountsByOwner + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network, Encoding } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getTokenAccountsByOwner( + 'GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa', + { + mint: '1YDQ35V8g68FGvcT85haHwAXv1U7XMzuc4mZeEXfrjE', + }, + { encoding: Encoding.JsonParsed } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTokenAccountsByOwner` method retrieves all SPL token accounts owned by a specified address on the Solana blockchain. It allows you to fetch a list of token accounts associated with a particular owner. This method is useful for querying the token holdings of a specific address and performing operations related to token management. + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQZpaB" %} + +### Parameters + +* `ownerAddress` (string, required): The address of the owner for whom to retrieve token accounts. + * Example: `'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn'` +* `config`(object, optional): An optional object containing either of the following: + * `mint`(string): Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string + * Example: `{ mint: 'So11111111111111111111111111111111111111112' }` + * `programId` (string): Pubkey of the Token program that owns the accounts, as base-58 encoded string + * Example: `{ programId: 'So11111111111111111111111111111111111111112' }` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at + * Example: `1000` + * `dataSlice` (object, optional): limit the returned account data using the provided `offset` (number) and `length` (number) fields; only available for `base58`, `base64` or `base64+zstd` encodings. + * Example: `{ "offset": 0, "length": 100 }` + * `encoding` (string, optional): The encoding for the account data. + * Values: `base58` `base64` `base64+zstd` `jsonParsed` + +### Return object + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: + +* `pubkey`: Public key of the account. +* `account`: A JSON object, with the following sub fields: + * `executable`: Whether the account is executable. + * `owner`: Base-58 encoded Pubkey of the program this account has been assigned to + * `lamports`: Number of lamports in the account. + * `data`: Token state data associated with the account, either as encoded binary data or in JSON format `{program: state}` + * `rentEpoch`: The epoch at which the account will next owe rent. + * `size`: The data size of the account + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountsByOwner", + "params": [ + 'GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa', + { + mint: '1YDQ35V8g68FGvcT85haHwAXv1U7XMzuc4mZeEXfrjE', + }, + { encoding: 'jsonParsed'}, + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "account": { + "data": { + "program": "spl-token", + "parsed": { + "accountType": "account", + "info": { + "tokenAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "delegatedAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "state": "initialized", + "isNative": false, + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", + "owner": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 1726080, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 4, + "space": 165 + }, + "pubkey": "C2gJg6tKpQs41PRS1nC8aw3ZKNZK3HQQZGVrDFDup5nx" + } + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/account-information/getvoteaccounts.md b/docs/rpc/solana-rpc-documentation/account-information/getvoteaccounts.md new file mode 100644 index 0000000..06f1282 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/account-information/getvoteaccounts.md @@ -0,0 +1,85 @@ +# getVoteAccounts + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getVoteAccounts({ votePubkey: 'beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar' }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQReoZ" %} + +### Overview + +The `getVoteAccounts` method is used to fetch the current list of vote accounts and their associated stake in the network. This is particularly useful when you want to understand the current validators in the Solana network and their voting records. It can be used in situations where you need to analyse the active participation in the network's consensus protocol. + +### Parameters + +* `options` (object, optional): Configuration object containing the following fields: + * `commitment`(string, optional): Specifies the confirmation level of data to be fetched. + * Example: `"confirmed"` + * `votePubkey` (string, optional): Specifies the public key of the vote account to fetch. + * Example: `"beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar"` + * `keepUnstakedDelinquents` (boolean, optional): Do not filter out delinquent validators with no stake + * Example: `true` + * `delinquentSlotDistance` (number, optional): Specify the number of slots behind the tip that a validator must fall to be considered delinquent. **NOTE:** For the sake of consistency between ecosystem products, _it is not recommended that this argument be specified._ + * Example: `10` + +### Return object + +The result field will be a JSON object of `current` and `delinquent` accounts, each containing an array of JSON objects with the following sub fields: + +* `votePubkey:`Vote account address, as base-58 encoded string +* `nodePubkey:` Validator identity, as base-58 encoded string +* `activatedStake:` The stake, in lamports, delegated to this vote account and active in this epoch +* `epochVoteAccount:` Whether the vote account is staked for this epoch +* `commission:` Percentage (0-100) of rewards payout owed to the vote account +* `lastVote:` Most recent slot voted on by this vote account +* `epochCredits:` Latest history of earned credits for up to five epochs, as an array of arrays containing: `[epoch, credits, previousCredits]`. +* `rootSlot:` Current root slot for this vote account + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountsByOwner", + "params": [{votePubkey: 'beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar'}] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "current": [ + { + "commission": 0, + "epochVoteAccount": true, + "epochCredits": [ + [1, 64, 0], + [2, 192, 64] + ], + "nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", + "lastVote": 147, + "activatedStake": 42, + "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" + } + ], + "delinquent": [] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/README.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/README.md new file mode 100644 index 0000000..df379ba --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/README.md @@ -0,0 +1,2 @@ +# Ledger and block information + diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblock.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblock.md new file mode 100644 index 0000000..8c713cc --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblock.md @@ -0,0 +1,167 @@ +# getBlock + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const slotNumber = 430 + +const config = { + encoding: "jsonParsed", + transactionDetails: "full", + rewards: false, + maxSupportedTransactionVersion: 0, +} + +const res = await tatum.rpc.getBlock(slotNumber, config) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlock` method returns identity and transaction information about a confirmed block in the ledger. It provides detailed data about each transaction within the block, including pre and post transaction balances, transaction status, fees charged, and more. + +This method is essential for blockchain explorers or any application that needs to track and represent blockchain transaction data. For instance, it could be used by a wallet application to show transaction details or by a network analytics tool for data gathering and analysis. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQOzGR" %} + +### Parameters + +This method takes the following parameters: + +* `slot` (number, required): Slot number +* `options` (object, optional): This object can contain the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `encoding` (string, optional): Encoding format for each returned transaction. The default is `json`. Other possible values include: `jsonParsed`, `base58`, `base64`. + * `transactionDetails` (string, optional): Level of transaction detail to return. The default is `full`. Other possible values include: `accounts`, `signatures`, `none`. + * `maxSupportedTransactionVersion` (number, optional): The max transaction version to return in responses. + * `rewards` (bool, optional): Whether to populate the `rewards` array. The default includes rewards. + +### Return Object + +The method returns a JSON object that includes detailed information about the block and the transactions it contains. If the specified block is not confirmed, the result will be `null`. + +The returned JSON object includes the following fields: + +* `blockhash`: The blockhash of this block, as base-58 encoded string. +* `previousBlockhash`: The blockhash of this block's parent, as base-58 encoded string. If the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111". +* `parentSlot`: The slot index of this block's parent. +* `transactions`: An array of JSON objects containing detailed transaction information. This field is present if "full" transaction details are requested. + * `transaction:` Transaction object, either in JSON format or encoded binary data, depending on encoding parameter + * `meta:` Transaction status metadata object, containing `null` or: + * `err:` Error if transaction failed, null if transaction succeeded. TransactionError definitions + * `fee:` Fee this transaction was charged, as u64 integer + * `preBalances:` Array of numbers representing account balances from before the transaction was processed + * `postBalances:` Array of numbers representing account balances after the transaction was processed + * `innerInstructions:` List of inner instructions or `null` if inner instruction recording was not enabled during this transaction + * `preTokenBalances:` List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + * `postTokenBalances:` List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + * `logMessages:` Array of string log messages or `null` if log message recording was not enabled during this transaction + * `rewards:` Transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: + * `pubkey:` The public key, as base-58 encoded string, of the account that received the reward + * `lamports:` Number of reward lamports credited or debited by the account + * `postBalance:` Account balance in lamports after the reward was applied + * `rewardType:` Type of reward: "fee", "rent", "voting", "staking" + * `commission:` Vote account commission when the reward was credited, only present for voting and staking rewards + * DEPRECATED: `status:` Transaction status + * `"Ok":` Transaction was successful + * `"Err":` Transaction failed with TransactionError + * `loadedAddresses:` Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. + * `writable:` Ordered list of base-58 encoded addresses for writable loaded accounts + * `readonly:`Ordered list of base-58 encoded addresses for readonly loaded accounts + * `returnData:` The most-recent return data generated by an instruction in the transaction, with the following fields: + * `programId:` The program that generated the return data, as base-58 encoded Pubkey + * `data:` The return data itself, as base-64 encoded binary data + * `computeUnitsConsumed:` Number of compute units consumed by the transaction + * `version:` Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. +* `signatures`: An array of signatures strings, corresponding to the transaction order in the block. This field is present if "signatures" are requested for transaction details. +* `rewards`: Block-level rewards, present if rewards are requested. +* `blockTime`: Estimated production time, as Unix timestamp (seconds since the Unix epoch). +* `blockHeight`: The number of blocks beneath this block. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getBlock", + "params": [ + 430, + { + "encoding": "json", + "maxSupportedTransactionVersion": 0, + "transactionDetails": "full", + "rewards": false + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "blockHeight": 428, + "blockTime": null, + "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", + "parentSlot": 429, + "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", + "transactions": [ + { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "logMessages": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "rewards": null, + "status": { + "Ok": null + } + }, + "transaction": { + "message": { + "accountKeys": [ + "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", + "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", + "SysvarS1otHashes111111111111111111111111111", + "SysvarC1ock11111111111111111111111111111111", + "Vote111111111111111111111111111111111111111" + ], + "header": { + "numReadonlySignedAccounts": 0, + "numReadonlyUnsignedAccounts": 3, + "numRequiredSignatures": 1 + }, + "instructions": [ + { + "accounts": [1, 2, 3, 0], + "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", + "programIdIndex": 4 + } + ], + "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" + }, + "signatures": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" + ] + } + } + ] + }, + "id": 1 +}js +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockcommitment.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockcommitment.md new file mode 100644 index 0000000..9130e84 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockcommitment.md @@ -0,0 +1,69 @@ +# getBlockCommitment + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlockCommitment(5) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockCommitment` method returns the commitment for a particular block. Commitment in Solana refers to the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1. + +This method is crucial for understanding the level of consensus or agreement about a block in the network, as it indicates how much of the network's total stake has confirmed the block. It can be used by blockchain explorers to show the confirmation status of transactions and by network monitors to track the progress of the blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJoKEX" %} + +### Parameters + +This method takes the following parameter: + +* `number` (required): The block number, identified by Slot. + +### Return Object + +The method returns a JSON object that includes detailed information about the block's commitment and the total active stake in the current epoch. If the specified block is not known, the `commitment` field will be `null`. + +The returned JSON object includes the following fields: + +* `commitment`: Commitment, comprising either: + * `` - Unknown block. + * `` - Commitment, an array of integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1. +* `totalStake`: The total active stake, in lamports, of the current epoch. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getBlockCommitment", + "params": [5] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "commitment": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 10, 32 + ], + "totalStake": 42 + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockheight.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockheight.md new file mode 100644 index 0000000..e9518af --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockheight.md @@ -0,0 +1,57 @@ +# getBlockHeight + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlockHeight() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockHeight` method returns the current block height of the node. Block height refers to the number of blocks preceding the current one in the blockchain. + +This method is beneficial for understanding the current status of the blockchain, as it provides the most recent block number processed by the node. It can be used for monitoring the progress of the blockchain, troubleshooting node synchronisation issues, and determining the confirmation status of a transaction by comparing its block number with the current block height. + +{% embed url="https://codepen.io/tatum-devrel/pen/ZEmPppb?editors=1111" %} + +### Parameters + +`options` (object, optional): This object can contain the following fields: + +* `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` +* `minContextSlot` (number, optional): This field can be used to specify the minimum slot that the request can be evaluated at. + +### Return Object + +The method returns a single number, representing the current block height. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getBlockHeight" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1233, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockproduction.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockproduction.md new file mode 100644 index 0000000..4f259ac --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockproduction.md @@ -0,0 +1,73 @@ +# getBlockProduction + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlockProduction() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockProduction` method provides information about the recent block production from the current or previous epoch. This can be used to monitor the performance and activity of validators on the Solana network. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJoKde?editors=1011" %} + +### Parameters + +* `options` (object, optional): This object can contain the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `identity` (string, optional): Only return results for this validator identity (base-58 encoded). + * `range` (object, optional): Slot range to return block production for. + * `firstSlot` (number): First slot to return block production information for (inclusive). + * `lastSlot` (number, optional): Last slot to return block production information for (inclusive). + +### Return Object + +The result will be a JSON object with value equal to object with the following fields: + +* `byIdentity` (object): A dictionary of validator identities, as base-58 encoded strings. The value is a two-element array containing the number of leader slots and the number of blocks produced. +* `range` (object): Block production slot range with fields `firstSlot` and `lastSlot` indicating the first and last slot of block production information respectively. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getBlockProduction" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 9887 + }, + "value": { + "byIdentity": { + "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [9888, 9886] + }, + "range": { + "firstSlot": 0, + "lastSlot": 9887 + } + } + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocks.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocks.md new file mode 100644 index 0000000..9fcc85b --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocks.md @@ -0,0 +1,54 @@ +# getBlocks + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlocks(5,10) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlocks` method returns a list of confirmed blocks between two specified slots. This can be useful when needing to examine a specific range of blocks for transaction analysis, data verification, or other blockchain analysis tasks. + +### Parameters + +* `endSlot` (number, required): This is the upper limit of the slot range from which blocks are to be returned. +* `startSlot` (number, optional): This is the lower limit of the slot range. If not provided, the method will return blocks from the start of the blockchain to the `endSlot`. Note that `startSlot` must be no more than 500,000 blocks lower than the `end_slot`. +* `options` (object, optional): This object can contain the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` Note that `processed` is not supported. + +### Return Object + +The method returns an array of integers, each representing a confirmed block between `startSlot` and either `endSlot` (if provided) or the latest confirmed block, inclusive. The maximum range allowed is 500,000 slots. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getBlocks", + "params": [5, 10] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [5, 6, 7, 8, 9, 10], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockswithlimit.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockswithlimit.md new file mode 100644 index 0000000..e03aff3 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblockswithlimit.md @@ -0,0 +1,56 @@ +# getBlocksWithLimit + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlocksWithLimit(5, 3) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlocksWithLimit` method returns a list of confirmed blocks starting at a given slot and up to a specified limit. This can be helpful when you need to retrieve a specific number of recent blocks for transaction analysis or blockchain data verification purposes. + +### Parameters + +This method requires and optionally accepts the following parameters: + +* `startSlot` (number, required): This is the slot from which the method will start returning blocks. +* `limit` (number, optional): This is the number of blocks to be returned starting from the `startSlot`. If not provided, the method will return all blocks from the `startSlot` to the end of the blockchain. Note that `limit` must be no more than 500,000 blocks higher than the `startSlot`. +* `options` (object, optional): This object can contain the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` Note that `processed` is not supported. + +### Return Object + +The method returns an array of integers, each representing a confirmed block starting from the `startSlot` and up to the `limit` blocks, inclusive. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id":1, + "method":"getBlocksWithLimit", + "params":[5, 3] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [5, 6, 7], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocktime.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocktime.md new file mode 100644 index 0000000..104616d --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getblocktime.md @@ -0,0 +1,56 @@ +# getBlockTime + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getBlockTime(5) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockTime` method returns the estimated production time of a block. Each validator in the Solana network reports their UTC time to the ledger at regular intervals by intermittently adding a timestamp to a vote for a specific block. A requested block's time is then calculated from the stake-weighted mean of these vote timestamps recorded on the ledger in a set of recent blocks. + +This method is useful in understanding when a particular block was produced, which is essential for various analysis and audit purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQZwRy?editors=1111" %} + +### Parameters + +* `blockNumber` (number, required): This is the number of the block for which you want to retrieve the production time. The block number is identified by its slot. + +### Return Object + +The method returns an integer or null: + +* If the production time of the block is available, the method returns the estimated production time as a Unix timestamp (seconds since the Unix epoch). +* If the production time of the block is not available, the method returns null. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", "id":1, + "method": "getBlockTime", + "params":[5] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1574721591, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getfirstavailableblock.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getfirstavailableblock.md new file mode 100644 index 0000000..cfeb3e5 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getfirstavailableblock.md @@ -0,0 +1,51 @@ +# getFirstAvailableBlock + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getFirstAvailableBlock() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getFirstAvailableBlock` method returns the slot of the lowest confirmed block that has not been purged from the ledger. This method is useful when you want to start parsing the ledger from the oldest available data, or when you want to check how far back the data in your node goes. This can be critical in scenarios where historical block data is required for backtracking transactions or auditing purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzxjvK" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The method returns an integer representing the slot of the oldest confirmed block that has not been purged from the ledger. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getFirstAvailableBlock" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 250000, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getgenesishash.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getgenesishash.md new file mode 100644 index 0000000..44deed4 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getgenesishash.md @@ -0,0 +1,51 @@ +# getGenesisHash + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getGenesisHash() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getGenesisHash` method returns the genesis hash of the Solana network. The genesis hash is an important piece of information in the blockchain world. It is the initial block or the very first block in a blockchain. The genesis hash can be used for various use cases such as to verify the integrity of data, as a reference point in the blockchain, and for debugging purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQvaVV" %} + +### Parameters + +None + +### Return Object + +* Returns a string, which is a Hash as base-58 encoded string. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getGenesisHash" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": "GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC", + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/gethighestsnapshotslot.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/gethighestsnapshotslot.md new file mode 100644 index 0000000..abb85f8 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/gethighestsnapshotslot.md @@ -0,0 +1,71 @@ +# getHighestSnapshotSlot + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getHighestSnapshotSlot() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getHighestSnapshotSlot` method provides the highest slot information for which the node has snapshots. It determines the highest full snapshot slot and, if available, the highest incremental snapshot slot based on the full snapshot slot. + +This method can be used in a variety of scenarios, including managing data storage and synchronisation of blockchain data. By knowing the highest snapshot slot, developers can estimate the amount of data that needs to be downloaded to sync a new node, or to ensure the node is up to date with the current state of the blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzxjEK" %} + +### Parameters + +None + +### Return Object + +When the node has a snapshot, this method returns a JSON object with the following fields: + +* `full`: The highest full snapshot slot. +* `incremental`: The highest incremental snapshot slot based on the full snapshot slot, if available. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getHighestSnapshotSlot" +} +``` + +### JSON-RPC Response Example + +Here is an example response when the node has a snapshot: + +```json +{ + "jsonrpc": "2.0", + "result": { + "full": 100, + "incremental": 110 + }, + "id": 1 +} +``` + +In case the node does not have a snapshot, the response would be: + +```json +{ + "jsonrpc": "2.0", + "error": { "code": -32008, "message": "No snapshot" }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getlatestblockhash.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getlatestblockhash.md new file mode 100644 index 0000000..6dd48ee --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getlatestblockhash.md @@ -0,0 +1,70 @@ +# getLatestBlockhash + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getLatestBlockhash({commitment: 'processed'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getLatestBlockhash` method returns the latest blockhash of the ledger. The blockhash is essential for transaction processing to ensure transaction uniqueness and to provide cryptographic security for the ledger. This method is critical in scenarios where the latest blockhash is needed for transaction signing or to confirm the most recent state of the blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQXdVd?editors=1111" %} + +### Parameters + +* `options` (object, optional): This object can contain the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + +### Return Object + +The method returns a `RpcResponse` JSON object with `value` field set to a JSON object including: + +* `blockhash`: The latest blockhash as a base-58 encoded string. +* `lastValidBlockHeight` : The last block height at which the blockhash will be valid. + +### JSON-RPC Request Example + +```json +{ + "id":1, + "jsonrpc":"2.0", + "method":"getLatestBlockhash", + "params":[ + { + "commitment":"processed" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 2792 + }, + "value": { + "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", + "lastValidBlockHeight": 3090 + } + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getleaderschedule.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getleaderschedule.md new file mode 100644 index 0000000..8f77e4f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getleaderschedule.md @@ -0,0 +1,71 @@ +# getLeaderSchedule + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getLeaderSchedule({ + identity: '4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F' +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getLeaderSchedule` method returns the leader schedule for an epoch. This method is useful for understanding the rotation of leadership among the validators, which is key in maintaining a decentralized and secure network. The schedule can be fetched for a specific epoch, or for the current epoch if no parameter is specified. + +### Parameters + +* `slot` (number, optional): Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched. +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `identity` (string, optional): Only return results for this validator identity (base-58 encoded). + +### Return Object + +The method returns one of the two following values: + +* `null` - If requested epoch is not found. +* `object` - The result field will be a dictionary of validator identities, as base-58 encoded strings, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch). + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getLeaderSchedule", + "params": [ + null, + { + "identity": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63 + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslot.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslot.md new file mode 100644 index 0000000..66863b5 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslot.md @@ -0,0 +1,54 @@ +# getSlot + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getSlot() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSlot` method returns the slot that has reached the given or default commitment level. Slots are a fundamental concept in the Solana blockchain, representing the passing of time in the ledger. This method is helpful for tracking the progress of the blockchain and can be used in numerous cases, such as determining the current state of the ledger, or for timekeeping purposes in a DApp. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQEwvZ" %} + +### Parameters + +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + +### Return Object + +The method returns an integer, representing the current slot that has reached the given or default commitment level. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getSlot" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1234, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleader.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleader.md new file mode 100644 index 0000000..bcd5252 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleader.md @@ -0,0 +1,54 @@ +# getSlotLeader + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getSlotLeader() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSlotLeader` method returns the identity of the node that is currently the leader of the slot. In the Solana network, a slot leader is responsible for producing blocks for the network during their assigned slot time. This method could be used to monitor the network's operation or for analysis of network activity. + +{% embed url="https://codepen.io/tatum-devrel/pen/WNYmGze" %} + +### Parameters + +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + +### Return Object + +The method returns a string that represents the Node identity Pubkey as a base-58 encoded string. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getSlotLeader" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": "ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS", + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleaders.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleaders.md new file mode 100644 index 0000000..09ef6fe --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/getslotleaders.md @@ -0,0 +1,62 @@ +# getSlotLeaders + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getSlotLeaders(100,10) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSlotLeaders` method returns an array of the slot leaders for a given slot range. In the Solana network, a slot leader is responsible for producing blocks for the network during their assigned slot time. This method could be used to monitor the network's operation, for analysis of network activity, or to understand which nodes have been assigned to produce blocks in the upcoming slots. + +### Parameters + +* `startSlot` (number, optional) +* `limit` (number, optional): Integer between 1 and 5,000. + +### Return Object + +The method returns an array of strings that represents an array of Node identity public keys as base-58 encoded strings. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id": 1, + "method": "getSlotLeaders", + "params": [100, 10] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP", + "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP" + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/ledger-and-block-information/minimumledgerslot.md b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/minimumledgerslot.md new file mode 100644 index 0000000..fca7b25 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/ledger-and-block-information/minimumledgerslot.md @@ -0,0 +1,53 @@ +# minimumLedgerSlot + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.minimumLedgerSlot() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `minimumLedgerSlot` method returns the lowest slot number that the node has information about in its ledger. This is useful when tracking the node's ledger history, such as for auditing, ledger analysis, or understanding the node's data retention policies. + +Note: This value may change over time if the node is configured to purge older ledger data, meaning that older data may no longer be accessible. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJoKBw" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The method returns an integer that represents the minimum ledger slot number. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"minimumLedgerSlot" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1234, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/README.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/README.md new file mode 100644 index 0000000..1e63ffc --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/README.md @@ -0,0 +1,2 @@ +# Miscellaneous API calls + diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getclusternodes.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getclusternodes.md new file mode 100644 index 0000000..f46055b --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getclusternodes.md @@ -0,0 +1,67 @@ +# getClusterNodes + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getClusterNodes() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getClusterNodes` method returns information about all the nodes participating in the cluster. This method can be used for network analysis, monitoring, and audit purposes. For example, you can use it to track the versions of software running on various nodes, identify the public keys of nodes, or determine the network addresses for various services. + +{% embed url="https://codepen.io/tatum-devrel/pen/YzRgGjO" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The method returns an array of JSON objects, each containing the following fields: + +* `pubkey`: Node's public key, as base-58 encoded string. +* `gossip`: Gossip network address for the node. +* `tpu`: TPU network address for the node. +* `rpc`: JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled. +* `version`: The software version of the node, or `null` if the version information is not available. +* `featureSet`: The unique identifier of the node's feature set. +* `shredVersion`: The shred version the node has been configured to use. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getClusterNodes" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "gossip": "10.239.6.48:8001", + "pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ", + "rpc": "10.239.6.48:8899", + "tpu": "10.239.6.48:8856", + "version": "1.0.0 c375ce1f" + } + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochinfo.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochinfo.md new file mode 100644 index 0000000..4a07ac8 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochinfo.md @@ -0,0 +1,67 @@ +# getEpochInfo + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getEpochInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getEpochInfo` method returns information about the current epoch on the Solana network. This includes the current slot, block height, epoch number, slot index, the number of slots in this epoch, and the total number of transactions processed without error since genesis. This data can be essential for developers and operators of Solana nodes to understand the current state of the network and to track its progress over time. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjezRzL" %} + +### Parameters + +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + +### Return Object + +The result field will be an object with the following fields: + +* `absoluteSlot`: The current slot. +* `blockHeight`: The current block height. +* `epoch`: The current epoch. +* `slotIndex`: The current slot relative to the start of the current epoch. +* `slotsInEpoch`: The number of slots in this epoch. +* `transactionCount`: Total number of transactions processed without error since genesis. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getEpochInfo" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "absoluteSlot": 166598, + "blockHeight": 166500, + "epoch": 27, + "slotIndex": 2790, + "slotsInEpoch": 8192, + "transactionCount": 22661093 + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochschedule.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochschedule.md new file mode 100644 index 0000000..c9d0aca --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getepochschedule.md @@ -0,0 +1,65 @@ +# getEpochSchedule + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getEpochSchedule() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getEpochSchedule` method returns the epoch schedule information from this cluster's genesis config. This includes the maximum number of slots in each epoch, the number of slots before the beginning of an epoch to calculate a leader schedule for that epoch, whether epochs start short and grow, the first normal-length epoch, and the first normal slot. This data can be useful for planning and understanding the progression of epochs in the Solana network. + +{% embed url="https://codepen.io/Night-Shift-Dev/pen/XWyKMyP" %} +Try this Feature +{% endembed %} + +### Parameters + +None + +### Return Object + +The result field will be an object with the following fields: + +* `slotsPerEpoch`: The maximum number of slots in each epoch. +* `leaderScheduleSlotOffset`: The number of slots before beginning of an epoch to calculate a leader schedule for that epoch. +* `warmup`: Whether epochs start short and grow. +* `firstNormalEpoch`: The first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM\_SLOTS\_PER\_EPOCH). +* `firstNormalSlot`: MINIMUM\_SLOTS\_PER\_EPOCH \* (2.pow(firstNormalEpoch) - 1). + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getEpochSchedule" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "firstNormalEpoch": 8, + "firstNormalSlot": 8160, + "leaderScheduleSlotOffset": 8192, + "slotsPerEpoch": 8192, + "warmup": true + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/gethealth.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/gethealth.md new file mode 100644 index 0000000..8f13223 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/gethealth.md @@ -0,0 +1,79 @@ +# getHealth + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getHealth() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getHealth` method is used to monitor the current health of the node. This method can be beneficial for maintenance and troubleshooting purposes. For instance, you may use this method to check the health status of your node periodically or to validate if a newly set up node is functioning correctly. + +Please note that if one or more `--known-validator` arguments are provided to `solana-validator`, "ok" is returned when the node is within `HEALTH_CHECK_SLOT_DISTANCE` slots of the highest known validator; otherwise, an error is returned. If no known validators are provided, "ok" is always returned. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJoKVb" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +If the node is healthy, it returns "ok". If the node is unhealthy, a JSON RPC error response is returned. The specifics of the error response are unstable and may change in the future. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getHealth" +} +``` + +### JSON-RPC Response Examples + +* Healthy node response: + + ```json + { "jsonrpc": "2.0", "result": "ok", "id": 1 } + ``` +* Unhealthy node response (generic): + + ```json + { + "jsonrpc": "2.0", + "error": { + "code": -32005, + "message": "Node is unhealthy", + "data": {} + }, + "id": 1 + } + ``` +* Unhealthy node response (if additional information is available): + + ```json + { + "jsonrpc": "2.0", + "error": { + "code": -32005, + "message": "Node is behind by 42 slots", + "data": { + "numSlotsBehind": 42 + } + }, + "id": 1 + } + ``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getidentity.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getidentity.md new file mode 100644 index 0000000..7b10d70 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getidentity.md @@ -0,0 +1,57 @@ +# getIdentity + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getIdentity() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getIdentity` method is used to retrieve the identity pubkey for the current node. This pubkey represents a unique identifier for the node in the Solana network. + +Use cases for this method might include retrieving the identity of a node for tracking or monitoring purposes, or validating the identity of a node in scenarios where only certain nodes are trusted for certain operations. + +{% embed url="https://codepen.io/tatum-devrel/pen/PoxLGdg" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The result field will be a JSON object with the following fields: + +* `identity`: The identity pubkey of the current node as a base-58 encoded string. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getIdentity" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN" + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxretransmitslot.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxretransmitslot.md new file mode 100644 index 0000000..9ec8c0f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxretransmitslot.md @@ -0,0 +1,51 @@ +# getMaxRetransmitSlot + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getMaxRetransmitSlot() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getMaxRetransmitSlot` method returns the highest slot number seen from the retransmit stage. This can be useful for monitoring the progress of the network or for determining the highest slot number that has been processed by a specific node. + +{% embed url="https://codepen.io/Night-Shift-Dev/pen/abQZJGR" %} + +### Parameters + +None + +### Return Object + +The method returns a value representing the highest slot number observed in the retransmit stage. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getMaxRetransmitSlot" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1234, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxshredinsertslot.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxshredinsertslot.md new file mode 100644 index 0000000..001182c --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getmaxshredinsertslot.md @@ -0,0 +1,51 @@ +# getMaxShredInsertSlot + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getMaxShredInsertSlot() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getMaxShredInsertSlot` method returns the highest slot number observed after a shred insert. This can be useful for monitoring the highest slot number that a specific node has processed after the shred insert stage, providing insights into the node's synchronisation status. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQEwQy" %} + +### Parameters + +None + +### Return Object + +The method returns a value representing the highest slot number observed after a shred insert. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getMaxShredInsertSlot" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 1234, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getminimumbalanceforrentexemption.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getminimumbalanceforrentexemption.md new file mode 100644 index 0000000..bcc4499 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getminimumbalanceforrentexemption.md @@ -0,0 +1,55 @@ +# getMinimumBalanceForRentExemption + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getMinimumBalanceForRentExemption(50) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getMinimumBalanceForRentExemption` method returns the minimum balance required to make an account rent exempt. This is useful when setting up a new account or assessing the cost of maintaining an account in a rent-free state. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQBEMp" %} + +### Parameters + +* `dataSize` (number, optional): The account's data length. +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + +### Return Object + +The result field will be a number indicating the minimum lamports required in the account to remain rent free. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getMinimumBalanceForRentExemption", + "params": [50] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 500, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentperformancesamples.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentperformancesamples.md new file mode 100644 index 0000000..2ffac33 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentperformancesamples.md @@ -0,0 +1,89 @@ +# getRecentPerformanceSamples + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getRecentPerformanceSamples(limit) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getRecentPerformanceSamples` method returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window. This data can be used to monitor network performance and understand the activity within the Solana network. + +{% embed url="https://codepen.io/Night-Shift-Dev/pen/poQbeqp" %} + +### Parameters + +* `limit` (usize, optional): The number of samples to return (maximum 720). + +### Return Object + +The result will be an array of objects with the following fields: + +* `slot`: Slot in which sample was taken at. +* `numTransactions`: Number of transactions in sample. +* `numSlots`: Number of slots in sample. +* `samplePeriodSecs`: Number of seconds in a sample window. +* `numNonVoteTransaction`: Number of non-vote transactions in sample. + +Note: `numNonVoteTransaction` is present starting with v1.15. To get the number of voting transactions, compute: numTransactions - numNonVoteTransaction. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method":"getRecentPerformanceSamples", + "params": [4] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "numSlots": 126, + "numTransactions": 126, + "numNonVoteTransaction": 1, + "samplePeriodSecs": 60, + "slot": 348125 + }, + { + "numSlots": 126, + "numTransactions": 126, + "numNonVoteTransaction": 1, + "samplePeriodSecs": 60, + "slot": 347999 + }, + { + "numSlots": 125, + "numTransactions": 125, + "numNonVoteTransaction": 0, + "samplePeriodSecs": 60, + "slot": 347873 + }, + { + "numSlots": 125, + "numTransactions": 125, + "numNonVoteTransaction": 0, + "samplePeriodSecs": 60, + "slot": 347748 + } + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentprioritizationfees.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentprioritizationfees.md new file mode 100644 index 0000000..c99d23a --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getrecentprioritizationfees.md @@ -0,0 +1,82 @@ +# getRecentPrioritizationFees + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const accounts = ['CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY'] + +const res = await tatum.rpc.getRecentPrioritizationFees(accounts) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getRecentPrioritizationFees` method returns a list of prioritization fees from recent blocks. This method can be used to determine the fees required to prioritize transactions for faster processing. + +{% embed url="https://codepen.io/Night-Shift-Dev/pen/oNQLZJr" %} + +### Parameters + +* `accountAddresses` (array, optional): An array of account addresses (up to a maximum of 128 addresses), as base-58 encoded strings. + + **Note**: If this parameter is provided, the response will reflect a fee to land a transaction locking all of the provided accounts as writable. + +### Return Object + +The result is an array of objects with the following fields: + +* `slot`: The slot in which the fee was observed. +* `prioritizationFee`: The per-compute-unit fee paid by at least one successfully landed transaction, specified in increments of 0.000001 lamports. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getRecentPrioritizationFees", + "params": [ + ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"] + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "slot": 348125, + "prioritizationFee": 0 + }, + { + "slot": 348126, + "prioritizationFee": 1000 + }, + { + "slot": 348127, + "prioritizationFee": 500 + }, + { + "slot": 348128, + "prioritizationFee": 0 + }, + { + "slot": 348129, + "prioritizationFee": 1234 + } + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getsupply.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getsupply.md new file mode 100644 index 0000000..5aef858 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getsupply.md @@ -0,0 +1,71 @@ +# getSupply + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getSupply() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSupply` method returns information about the current supply of lamports in the Solana network. It provides insights into the distribution of lamports, such as the total supply, the amount in circulation, and the amount that is not circulating. This can be useful for anyone interested in the macroeconomics of the Solana network or in tracking the circulation of lamports over time. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJoKoj?editors=1011" %} + +### Parameters + +* `options` (object, optional): A configuration object containing: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * `excludeNonCirculatingAccountsList` (bool, optional): If true, the returned array of non-circulating accounts will be empty. + +### Return Object + +The result field will be a JSON object containing: + +* `total`: Total supply in lamports. +* `circulating`: Circulating supply in lamports. +* `nonCirculating`: Non-circulating supply in lamports. +* `nonCirculatingAccounts`: An array of account addresses of non-circulating accounts, as strings. If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getSupply" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": { + "circulating": 16000, + "nonCirculating": 1000000, + "nonCirculatingAccounts": [ + "FEy8pTbP5fEoqMV1GdTz83byuA8EKByqYat1PKDgVAq5", + "9huDUZfxoJ7wGMTffUE7vh1xePqef7gyrLJu9NApncqA", + "3mi1GmwEE3zo2jmfDuzvjSX9ovRXsDUKHvsntpkhuLJ9", + "BYxEJTDerkaRWBem3XgnVcdhppktBXa2HbkHPKj2Ui4Z" + ], + "total": 1016000 + } + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getversion.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getversion.md new file mode 100644 index 0000000..1a9ad82 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/getversion.md @@ -0,0 +1,56 @@ +# getVersion + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getVersion` method is used to retrieve the current Solana version running on the node. This information can be useful for troubleshooting, compatibility checks, or for understanding the node's capabilities based on its version. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQPXVV" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The result field will be a JSON object with the following fields: + +* `solana-core`: The software version of `solana-core`. +* `feature-set`: The unique identifier of the current software's feature set. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "jsonrpc": "2.0", + "id": 1, + "method": "getVersion" +} +``` + +### JSON-RPC Response Example + +```json +jsonCopy code{ + "jsonrpc": "2.0", + "result": { + "solana-core": "1.15.0" + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/requestairdrop.md b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/requestairdrop.md new file mode 100644 index 0000000..9c72297 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/miscellaneous-api-calls/requestairdrop.md @@ -0,0 +1,53 @@ +# requestAirdrop + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.SOLANA_DEVNET}) + +const res = await tatum.rpc.requestAirdrop('G35uLP74uj4eCSfMs17ePKtK1ThuH8JKebAP1T2y6CYw',1000000000) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `requestAirdrop` method is used to request an airdrop of lamports to a specific Pubkey. This is particularly useful for testing or development environments where you need to distribute tokens for various accounts for testing purposes. + +### Parameters + +* `pubkey` (string, required): The public key of the account that will receive the lamports, represented as a base-58 encoded string. +* `lamports` (integer, required): The number of lamports to airdrop. + +### Return Object + +The result is a string representing the transaction signature of the airdrop, as a base-58 encoded string. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "requestAirdrop", + "params": [ + "G35uLP74uj4eCSfMs17ePKtK1ThuH8JKebAP1T2y6CYw", + 1000000000 + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/README.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/README.md new file mode 100644 index 0000000..c0efcf5 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/README.md @@ -0,0 +1,2 @@ +# Token and Stake information + diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationgovernor.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationgovernor.md new file mode 100644 index 0000000..e180d5c --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationgovernor.md @@ -0,0 +1,65 @@ +# getInflationGovernor + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getInflationGovernor() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getInflationGovernor` method is used to retrieve the current inflation governor in the Solana blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQRMVO?editors=1011" %} + +### Parameters + +* `options` (object, optional): Configuration object containing the following fields: + * `commitment`(string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + +### Return Object + +The method returns a JSON object with the following fields: + +* `initial`: The initial inflation percentage from time 0. +* `terminal`: Terminal inflation percentage. +* `taper`: Rate per year at which inflation is lowered. The rate reduction is derived using the target slot time in the genesis config. +* `foundation`: Percentage of total inflation allocated to the foundation. +* `foundationTerm`: Duration of foundation pool inflation in years. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getInflationGovernor" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "foundation": 0.05, + "foundationTerm": 7, + "initial": 0.15, + "taper": 0.15, + "terminal": 0.015 + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationrate.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationrate.md new file mode 100644 index 0000000..84a6aab --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationrate.md @@ -0,0 +1,61 @@ +# getInflationRate + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getInflationRate() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getInflationRate` method is used to retrieve the specific inflation values for the current epoch in the Solana blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQPXOp" %} + +### Parameters + +No parameters are required for this method. + +### Return Object + +The method returns a JSON object with the following fields: + +* `total`: Total inflation rate. +* `validator`: Inflation allocated to validators. +* `foundation`: Inflation allocated to the foundation. +* `epoch`: The epoch for which these values are valid. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getInflationRate" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "epoch": 100, + "foundation": 0.001, + "total": 0.149, + "validator": 0.148 + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationreward.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationreward.md new file mode 100644 index 0000000..31a237c --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getinflationreward.md @@ -0,0 +1,80 @@ +# getInflationReward + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const addresses = ["Address1", "Address2", "Address3"] +const config = { + epoch: 2 +} + +const res = await tatum.rpc.getInflationReward(addresses, config) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getInflationReward` method returns the inflation or staking reward for a list of addresses for a particular epoch on the Solana blockchain. + +### Parameters + +* An array of addresses (array of strings, optional): These are the addresses to query, as base-58 encoded strings. +* A configuration object (optional): This object can contain the following fields: + * `commitment` (string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `epoch` (number, optional): An epoch for which the reward occurs. If omitted, the previous epoch will be used. + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + +### Return Object + +The method returns a JSON array where each object represents the reward details for the corresponding address in the input array. Each object has the following fields: + +* `epoch`: The epoch for which the reward occurred. +* `effectiveSlot`: The slot in which the rewards are effective. +* `amount`: The reward amount in lamports. +* `postBalance`: The post-balance of the account in lamports. +* `commission` : The vote account commission when the reward was credited. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getInflationReward", + "params": [ + [ + "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", + "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2" + ], + {"epoch": 2} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "amount": 2500, + "effectiveSlot": 224, + "epoch": 2, + "postBalance": 499999442500 + }, + null + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeactivation.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeactivation.md new file mode 100644 index 0000000..50af066 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeactivation.md @@ -0,0 +1,76 @@ +# getStakeActivation + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const pubkey = "CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT" +const config = { + epoch: 4 +} + +const res = await tatum.rpc.getStakeActivation(pubkey, config) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getStakeActivation` method returns epoch activation information for a stake account on the Solana blockchain. + +### Parameters + +This method takes the following parameters: + +* A string (required): This is the pubkey of the stake account to query, as a base-58 encoded string. + * Example: `"CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT"` +* A configuration object (optional): This object can contain the following fields: + * `commitment` (string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + * `epoch` (number, optional): The epoch for which to calculate activation details. If this parameter is not provided, it defaults to the current epoch. + +### Return Object + +The method returns a JSON object that includes the following fields: + +* `state`: The activation state of the stake account. This can be 'active', 'inactive', 'activating', or 'deactivating'. +* `active`: The stake that is active during the epoch. +* `inactive`: The stake that is inactive during the epoch. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getStakeActivation", + "params": [ + "CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT", + { + "epoch": 4 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "active": 124429280, + "inactive": 73287840, + "state": "activating" + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeminimumdelegation.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeminimumdelegation.md new file mode 100644 index 0000000..f61c748 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/getstakeminimumdelegation.md @@ -0,0 +1,61 @@ +# getStakeMinimumDelegation + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getStakeMinimumDelegation() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getStakeMinimumDelegation` method is an essential component of Solana's staking process. It returns the minimum delegation amount, expressed in lamports, that is required to stake on the Solana network. The staking process is an integral part of Solana's Proof of Stake consensus mechanism, where stakeholders are rewarded for their participation in securing the network. + +This method is commonly used by wallets and staking services to inform their users about the minimum amount required for staking. By delegating a certain amount of Solana tokens, participants can earn staking rewards and contribute to the network's security. The minimum delegation amount is set by the network to prevent spam and maintain a high level of network performance. + +{% embed url="https://codepen.io/tatum-devrel/pen/YzRgGyY?editors=1010" %} + +### Parameters + +This method takes the following parameters: + +* A configuration object (optional): This object can contain the following fields: + * `commitment` (string, optional): The level of commitment desired for the query. + +### Return Object + +The return object contains a `bool` value of the minimum delegation amount for staking, in lamports. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc":"2.0", + "id":1, + "method": "getStakeMinimumDelegation" +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 501 + }, + "value": 1000000000 + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokenlargestaccounts.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokenlargestaccounts.md new file mode 100644 index 0000000..5f06ee7 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokenlargestaccounts.md @@ -0,0 +1,87 @@ +# getTokenLargestAccounts + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getTokenLargestAccounts() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTokenLargestAccounts` method is a valuable resource for analyzing the distribution of a particular SPL (Solana Program Library) Token in the network. This method returns the 20 largest accounts of a specific SPL Token type. + +The primary use case for this method is to gain insights into the distribution of a particular token. For instance, token issuers might want to monitor the distribution of their tokens and identify the largest holders. + +Another use case is for research and analysis purposes. Data providers, exchange platforms, or individuals might use this information to study market behavior, make predictions, or develop trading strategies based on the ownership concentration of a specific token. + +### Parameters + +This method takes the following parameters: + +* `pubkey` (string, required): A string that represents the Pubkey of the token Mint to query, as base-58 encoded string. +* A configuration object (optional): This object can contain the following fields: + * `commitment` (string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + +### Return Object + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects containing: + +* `address`: The address of the token account. +* `amount`: The raw token account balance without decimals, a string representation of u64. +* `decimals`: The number of base 10 digits to the right of the decimal place. +* `uiAmount`: The token account balance, using mint-prescribed decimals. Note: This field is deprecated. +* `uiAmountString`: The token account balance as a string, using mint-prescribed decimals. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenLargestAccounts", + "params": [ + "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "address": "FYjHNoFtSQ5uijKrZFyYAxvEr87hsKXkXcxkcmkBAf4r", + "amount": "771", + "decimals": 2, + "uiAmount": 7.71, + "uiAmountString": "7.71" + }, + { + "address": "BnsywxTcaYeNUtzrPxQUvzAWxfzZe3ZLUJ4wMMuLESnu", + "amount": "229", + "decimals": 2, + "uiAmount": 2.29, + "uiAmountString": "2.29" + } + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokensupply.md b/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokensupply.md new file mode 100644 index 0000000..0d51d3d --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/token-and-stake-information/gettokensupply.md @@ -0,0 +1,80 @@ +# getTokenSupply + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const tokenMintPubkey = "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + +const res = await tatum.rpc.getTokenSupply(tokenMintPubkey, config) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTokenSupply` method returns the total supply of a specific SPL (Solana Program Library) Token in the network. + +This method is especially useful for token issuers or traders who want to keep track of the total token supply for market analysis or supply management. + +Another use case for this method is for financial services applications or DeFi protocols, where it is important to know the total supply of a token to calculate various financial metrics such as market capitalisation or liquidity. + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQRMxx" %} + +### Parameters + +This method takes the following parameters: + +* `pubkey` (string, required): A string that represents the Pubkey of the token Mint to query. +* `options` (object, optional): This object can contain the following fields: + * `commitment` (string, optional): Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + +### Return Object + +The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: + +* `amount`: The raw total token supply without decimals, a string representation of u64. +* `decimals`: The number of base 10 digits to the right of the decimal place. +* `uiAmount`: The total token supply, using mint-prescribed decimals. Note: This field is deprecated. +* `uiAmountString`: The total token supply as a string, using mint-prescribed decimals. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenSupply", + "params": [ + "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": { + "amount": "100000", + "decimals": 2, + "uiAmount": 1000, + "uiAmountString": "1000" + } + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/README.md b/docs/rpc/solana-rpc-documentation/transactions/README.md new file mode 100644 index 0000000..30549c3 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/README.md @@ -0,0 +1,2 @@ +# Transactions + diff --git a/docs/rpc/solana-rpc-documentation/transactions/getfeeformessage.md b/docs/rpc/solana-rpc-documentation/transactions/getfeeformessage.md new file mode 100644 index 0000000..6f64333 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/getfeeformessage.md @@ -0,0 +1,64 @@ +# getFeeForMessage + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const message = { + // Message content goes here... +} +const res = await tatum.rpc.getFeeForMessage(message) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getFeeForMessage` method is used to estimate the transaction fee for a given message. This is very useful when you are preparing to send a transaction and you want to estimate the transaction cost. This can be used in situations where you need to validate whether a user has enough funds to cover the transaction fee or to provide an estimate of the cost to the user. + +### Parameters + +* `message`(string, required): Base-64 encoded Message for which the fee should be estimated. + * Example: "`AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA`" +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at + * Example: `1000` + +### Return Object + +The result will be a JSON object with `value` equal to Fee corresponding to the message at the specified blockhash + +### JSON-RPC Request Example + +```json +{ + "id":1, + "jsonrpc":"2.0", + "method":"getFeeForMessage", + "params":[ + "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA", + { + "commitment":"processed" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { "context": { "slot": 5068 }, "value": 5000 }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/getsignaturesforaddress.md b/docs/rpc/solana-rpc-documentation/transactions/getsignaturesforaddress.md new file mode 100644 index 0000000..411cf5f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/getsignaturesforaddress.md @@ -0,0 +1,86 @@ +# getSignaturesForAddress + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const address = 'H8UvHwUaXKmHyr1UzEy1y5F5KjU6kGXMDFddxEjqJ2Sn' +const options = {limit: 10} // optional + +const res = await tatum.rpc.getSignaturesForAddress(address, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSignaturesForAddress` method fetches the signatures for confirmed transactions that include the given address in their `accountKeys` list. Returns signatures backwards in time from the provided signature or most recent confirmed block. This is especially useful for tracking the transaction history of an address, auditing transactions, or for debugging purposes. + +### Parameters + +* `address`(string, required): The address for which to fetch the transaction signatures. + * Example: `"H8UvHwUaXKmHyr1UzEy1y5F5KjU6kGXMDFddxEjqJ2Sn"` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at + * Example: `1000` + * `limit`(number, optional): The maximum number of signatures to return (between 1 and 1,000). + * Example: `10` + * `before`(string, optional): Start searching backwards from this transaction signature. If not provided the search starts from the top of the highest max confirmed block. + * Example: `"5Z7dVQaRBAjBjJZVhdJygdAEyRm3N8D1BQot9aJuthFU"` + * `until`(string, optional): Search until this transaction signature, if found before limit reached + * Example: `"5Z7dVQaRBAjBjJZVhdJygdAEyRm3N8D1BQot9aJuthFU"` + +### Return Object + +An array of ``, ordered from **newest** to **oldest** transaction, containing transaction signature information with the following fields: + +* `signature`: The transaction's signature as base-58 encoded string. +* `slot`: The slot in which the transaction was processed. +* `err`: Error if transaction failed, null if transaction succeeded. +* `memo:` Memo associated with the transaction, null if no memo is present +* `blockTime:` Estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available. +* `confirmationStatus:` The transaction's cluster confirmation status; Either `processed`, `confirmed`, or `finalized`. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getSignaturesForAddress", + "params": [ + "Vote111111111111111111111111111111111111111", + { + "limit": 1 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "err": null, + "memo": null, + "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", + "slot": 114, + "blockTime": null + } + // More signatures... + ], + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/getsignaturestatuses.md b/docs/rpc/solana-rpc-documentation/transactions/getsignaturestatuses.md new file mode 100644 index 0000000..965cb5f --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/getsignaturestatuses.md @@ -0,0 +1,92 @@ +# getSignatureStatuses + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const signatures = ['4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh'] // list of transaction signatures +const options = {searchTransactionHistory: true} // optional + +const res = await tatum.rpc.getSignatureStatuses(signatures, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getSignatureStatuses` method fetches the processing statuses of a list of transactions, identified by their signatures. This is especially useful for tracking the status of transactions, whether they are being processed, confirmed or finalised. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQErNL" %} + +### Parameters + +* `signatures`: (Array of strings, required) An array of transaction signatures to fetch the statuses of. + * Example: `["4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh"]` +* `options` (object, optional): Configuration object containing the following fields: + * `searchTransactionHistory` (bool, optional): if `true` - a Solana node will search its ledger cache for any signatures not found in the recent status cache + * Example: `true` + +### Return Object + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, consisting of either: + +* `null` Unknown transaction, or +* `object` + * `slot:` The slot the transaction was processed + * `confirmations:` Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster + * `err:` Error if transaction failed, null if transaction succeeded. + * `confirmationStatus:` The transaction's cluster confirmation status; Either `processed`, `confirmed`, or `finalized`. + * DEPRECATED: `status:` Transaction status object + * `"Ok":` Transaction was successful + * `"Err":` Transaction failed with TransactionError + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getSignatureStatuses", + "params": [ + [ + "4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh" + ], + { + "searchTransactionHistory": true + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 82 + }, + "value": [ + { + "slot": 48, + "confirmations": null, + "err": null, + "status": { + "Ok": null + }, + "confirmationStatus": "finalized" + }, + null + ] + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/gettransaction.md b/docs/rpc/solana-rpc-documentation/transactions/gettransaction.md new file mode 100644 index 0000000..7bbdea6 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/gettransaction.md @@ -0,0 +1,138 @@ +# getTransaction + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const signature = '4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh' // transaction signature + +const res = await tatum.rpc.getTransaction(signature) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTransaction` method retrieves the details of a specific transaction, identified by its signature. This method can be used to fetch transaction details such as the addresses involved, the amount transacted, the block in which the transaction was included, and so forth. + +### Parameters + +* `signature`(string): Transaction signature, as base-58 encoded string + * Example: `"4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh"` +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `maxSupportedTransactionVersion` (number): Set the max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and any versioned transaction will prompt the error. + * Example: `1` + * `encoding` (string, optional): The encoding for the account data. + * Values: `base58` `base64` `jsonParsed` + +### Return Object + +* `null` If transaction is not found or not confirmed +* `object` If transaction is confirmed, an object with the following fields: + * `slot:` The slot this transaction was processed in + * `transaction:` Transaction object, either in JSON format or encoded binary data, depending on encoding parameter + * `blockTime:` Estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available + * `meta:` Transaction status metadata object: + * `err:` Error if transaction failed, null if transaction succeeded. + * `fee:` Fee this transaction was charged, as u64 integer + * `preBalances:` Array of u64 account balances from before the transaction was processed + * `postBalances:` Array of u64 account balances after the transaction was processed + * `innerInstructions:` List of inner instructions or `null` if inner instruction recording was not enabled during this transaction + * `preTokenBalances:` List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + * `postTokenBalances:` List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + * `logMessages:` Array of string log messages or `null` if log message recording was not enabled during this transaction + * DEPRECATED: `status:` Transaction status + * `"Ok":` Transaction was successful + * `"Err":` Transaction failed with TransactionError + * `rewards:` Transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: + * `pubkey:` The public key, as base-58 encoded string, of the account that received the reward + * `lamports:`Number of reward lamports credited or debited by the account, as a i64 + * `postBalance:` Account balance in lamports after the reward was applied + * `rewardType:` Type of reward: currently only "rent", other types may be added in the future + * `commission:` Vote account commission when the reward was credited, only present for voting and staking rewards + * `loadedAddresses:` Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. + * `writable:` Ordered list of base-58 encoded addresses for writable loaded accounts + * `readonly:` Ordered list of base-58 encoded addresses for readonly loaded accounts + * `returnData:` The most-recent return data generated by an instruction in the transaction, with the following fields: + * `programId:` The program that generated the return data, as base-58 encoded Pubkey + * `data:` The return data itself, as base-64 encoded binary data + * `computeUnitsConsumed:` Number of compute units consumed by the transaction + * `version:` Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTransaction", + "params": [ + "4CgnQtRfnUekfn21meTyHYvoAc6pBYK3DhimeiZL6a6o2QXMTHqDomninDkaZLmSfdiEzZfyfLGN4mrDvs8HmnBh", + { + "encoding": "jsonParsed" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "rewards": [], + "status": { + "Ok": null + } + }, + "slot": 430, + "transaction": { + "message": { + "accountKeys": [ + "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", + "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", + "SysvarS1otHashes111111111111111111111111111", + "SysvarC1ock11111111111111111111111111111111", + "Vote111111111111111111111111111111111111111" + ], + "header": { + "numReadonlySignedAccounts": 0, + "numReadonlyUnsignedAccounts": 3, + "numRequiredSignatures": 1 + }, + "instructions": [ + { + "accounts": [1, 2, 3, 0], + "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", + "programIdIndex": 4 + } + ], + "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" + }, + "signatures": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" + ] + } + }, + "blockTime": null, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/gettransactioncount.md b/docs/rpc/solana-rpc-documentation/transactions/gettransactioncount.md new file mode 100644 index 0000000..f7d75b5 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/gettransactioncount.md @@ -0,0 +1,55 @@ +# getTransactionCount + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const res = await tatum.rpc.getTransactionCount() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTransactionCount` method retrieves the current transaction count from the ledger. This can be used to track the number of transactions processed by the network. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQJroJ?editors=1111" %} + +### Parameters + +* `options` (object, optional): Configuration object containing the following fields: + * `commitment` (string, optional): Specifies the confirmation level of data to be fetched. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot`: (number, optional) The minimum slot that the request can be evaluated at. + * Example: `5` + +### Return Object + +The method returns a number indicating the current transaction count from the ledger. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTransactionCount", +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": 268, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/isblockhashvalid.md b/docs/rpc/solana-rpc-documentation/transactions/isblockhashvalid.md new file mode 100644 index 0000000..a1faa96 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/isblockhashvalid.md @@ -0,0 +1,71 @@ +# isBlockhashValid + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network, Commitment } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const blockhash = 'J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW' +const options = { + commitment: Commitment.Processed, + minContextSlot: 5 +} // optional + +const res = await tatum.rpc.isBlockhashValid(blockhash, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `isBlockhashValid` method evaluates the validity of a specified blockhash. This can be used to confirm if a blockhash is still valid on the network. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQPKoW" %} + +### Parameters + +* `blockhash`(string, required): The blockhash of the block to evaluate, as a base-58 encoded string. + * Example: `'J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW'` +* `options`: (object, optional) Configuration object containing the following fields: + * `commitment`: (string, optional) Specifies the level of commitment to apply when fetching data. + * Values: `finalized` `confirmed` `processed` + * `minContextSlot`: (number, optional) The minimum slot that the request can be evaluated at. + * Example: `5` + +### Return Object + +The return object contains a `bool` value indicating if the blockhash is still valid. + +### JSON-RPC Request Example + +```json +{ + "id": 45, + "jsonrpc": "2.0", + "method": "isBlockhashValid", + "params": [ + "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW", {"commitment":"processed"} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 2483 + }, + "value": false + }, + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/sendtransaction.md b/docs/rpc/solana-rpc-documentation/transactions/sendtransaction.md new file mode 100644 index 0000000..2bee264 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/sendtransaction.md @@ -0,0 +1,81 @@ +# sendTransaction + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const transaction = '4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT' +const options = { + encoding: Encoding.Base58, + skipPreflight: false, + preflightCommitment: Commitment.Finalized, + maxRetries: 5, + minContextSlot: 10 +} // optional + +const res = await tatum.rpc.sendTransaction(transaction, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `sendTransaction` method is used to submit a fully signed transaction to the cluster for processing. This method does not alter the transaction in any way; it relays the transaction created by clients to the node as-is. A successful response from this method does not guarantee the transaction is processed or confirmed by the cluster. + +While the rpc service will reasonably retry to submit it, the transaction could be rejected if transaction's `recent_blockhash` expires before it lands. + +Use `getSignatureStatuses` to ensure a transaction is processed and confirmed. + +Before submitting, the following preflight checks are performed: + +1. The transaction signatures are verified +2. The transaction is simulated against the bank slot specified by the preflight commitment. On failure an error will be returned. Preflight checks may be disabled if desired. It is recommended to specify the same commitment and preflight commitment to avoid confusing behaviour. + +The returned signature is the first signature in the transaction, which is used to identify the transaction (transaction id). This identifier can be easily extracted from the transaction data before submission. + +### Parameters + +* `transaction`(string, required): Fully-signed Transaction, as an encoded string. + * Example: `'4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT'` +* `options` (object, optional): An object containing various options for the request. + * `encoding` (string, optional): Encoding used for the transaction data. + * Values: `base58` (_slow_, **DEPRECATED**), or `base64`. + * `skipPreflight` (boolean, optional): If "true", skip the preflight transaction checks. + * `preflightCommitment`(string, optional): Commitment level to use for preflight. + * Values: `finalised` `confirmed` `processed` + * `maxRetries`(number, optional): Maximum number of times for the RPC node to retry sending the transaction to the leader. + * `minContextSlot` (number, optional): Set the minimum slot at which to perform preflight transaction checks. + +### Return Object + +The method returns a base-58 encoded `string` value which is the first Transaction Signature embedded in the transaction. This is used to identify the transaction. + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "sendTransaction", + "params": [ + "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb", + "id": 1 +} +``` diff --git a/docs/rpc/solana-rpc-documentation/transactions/simulatetransaction.md b/docs/rpc/solana-rpc-documentation/transactions/simulatetransaction.md new file mode 100644 index 0000000..357ffe5 --- /dev/null +++ b/docs/rpc/solana-rpc-documentation/transactions/simulatetransaction.md @@ -0,0 +1,111 @@ +# simulateTransaction + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Solana, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.SOLANA }) + +const transaction = 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=' + +const options = { + encoding: 'base64' +} // optional + +const res = await tatum.rpc.simulateTransaction(transaction, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `simulateTransaction` method is used to simulate sending a transaction without actually submitting it to the cluster. This can be useful for debugging and testing purposes. + +### Parameters + +* `transaction`: (string, required) Transaction, as an encoded string. The transaction must have a valid blockhash, but is not required to be signed. +* `options` (object, optional): Configuration object containing various options for the request. This includes: + * `commitment` (string, optional): Commitment level to simulate the transaction at. Default is 'finalized'. + * Values: `finalised` `confirmed` `processed` + * `sigVerify` (boolean, optional): If `true`, the transaction signatures will be verified. This conflicts with `replaceRecentBlockhash`. + * `replaceRecentBlockhash` (boolean, optional): If `true`, the transaction's recent blockhash will be replaced with the most recent blockhash. This conflicts with `sigVerify`. + * `minContextSlot` (number, optional): The minimum slot that the request can be evaluated at. + * `encoding` (string, optional): Encoding used for the transaction data. Values can be `base58` or `base64`. Default is `base58`. + * `accounts` (object, optional): Accounts configuration object. This includes: + * `addresses`: (array of strings, optional) An array of accounts to return, as base-58 encoded strings. + * `encoding`: (string, optional) Encoding for returned Account data. Values can be `base64`, `base58`, `base64+zstd`, `jsonParsed`. + +### Return Object + +The method returns an `RpcResponse` object with `value` set to a JSON object with the following fields: + +* `err`: Error if transaction failed, null if transaction succeeded. +* `logs`: Array of log messages the transaction instructions output during execution. Null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) +* `accounts`: Array of accounts with the same length as the `accounts.addresses` array in the request. Each Account object resolves to either: + * `null` - If the account doesn't exist or if `err` is not null + * `object` - Otherwise, a JSON object containing: + * `lamports:` Number of lamports assigned to this account, as a u64 + * `owner:` Base-58 encoded Pubkey of the program this account has been assigned to + * `data:` Data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + * `executable:` Boolean indicating if the account contains a program (and is strictly read-only) + * `rentEpoch:` The epoch at which this account will next owe rent, as u64 +* `unitsConsumed`: The number of compute budget units consumed during the processing of this transaction. +* `returnData`: The most-recent return data generated by an instruction in the transaction + + with the following fields: + + * `programId:` The program that generated the return data, as base-58 encoded Pubkey + * `data:` The return data itself, as base-64 encoded binary data + +### JSON-RPC Request Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "simulateTransaction", + "params": [ + "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=", + { + "encoding": "base64" + } + ] +} + +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 218 + }, + "value": { + "err": null, + "accounts": null, + "logs": [ + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri invoke [1]", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri consumed 2366 of 1400000 compute units", + "Program return: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri KgAAAAAAAAA=", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" + ], + "returnData": { + "data": ["Kg==", "base64"], + "programId": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" + }, + "unitsConsumed": 2366 + } + }, + "id": 1 +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/README.md b/docs/rpc/tron-rpc-documentation/README.md new file mode 100644 index 0000000..652a9c9 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/README.md @@ -0,0 +1,9 @@ +# TRON RPC documentation + +Tron RPC (Remote Procedure Call) is an essential tool for developers looking to interact with the Tron blockchain network. It provides a standardised interface for communication, enabling developers to retrieve data, send transactions, deploy smart contracts, and more. Tron RPC plays a vital role in building decentralised applications, integrating blockchain functionality, and exploring the possibilities offered by the Tron network. + +Getting Started with Tron RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/aSwbLcUCrfk" %} + +In this video tutorial, we will guide you through the process of getting started with Tron RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including Tron. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Tron network via RPC, and perform common operations such as retrieving Transaction by ID. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/README.md new file mode 100644 index 0000000..4e11e05 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/README.md @@ -0,0 +1,2 @@ +# API calls for account methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/accountpermissionupdate.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/accountpermissionupdate.md new file mode 100644 index 0000000..c2a446e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/accountpermissionupdate.md @@ -0,0 +1,183 @@ +# accountpermissionupdate + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, TronPermission, AccountPermissionUpdateOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const owner: TronPermission = { + type: 0, + permissionName: "owner", + threshold: 1, + operations: "", + keys: [ + { + address: "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + weight: 1 + } + ] +} + +const active: TronPermission = { + "type": 2, + "permission_name": "active0", + "threshold": 2, + "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000", + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + }, + { + "address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "weight": 1 + } + ] +} + +const res = await tatum.rpc.accountPermissionUpdate('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', [active], owner, { + visible: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `accountPermissionUpdate` method is used to update an account's permissions on the TRON network. These permissions include the owner permission, account witness permissions, and a list of active permissions. The response is an unsigned transaction, with the transaction type being `AccountPermissionUpdateContract`. + +### Parameters + +* `ownerAddress` (string): The address of the owner. +* `actives` (TronPermission\[]): An array of active permissions for the account. +* `owner` (TronPermission): The owner permission for the account. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +Each `TronPermission` object has the following properties: + +* `type` (number): The permission type. +* `permissionName` (string): The permission name. +* `threshold` (number): The threshold. +* `operations` (string): The operations the permission has. +* `keys` (Array<{ address: string, weight: number }>): An array of objects that represent the addresses and their respective weights that jointly own the permission. Up to 5 keys are allowed. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `AccountPermissionUpdateContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): The owner's account address. +* `owner` (Permission): The owner permission of the account. +* `witness` (Permission): Account witness permissions. +* `actives` (Permission\[]): List of active permissions for the account. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "actives": [ + { + "type": 2, + "permission_name": "active0", + "threshold": 2, + "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000", + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + }, + { + "address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "weight": 1 + } + ] + } + ], + "owner": { + "type": 0, + "permission_name": "owner", + "threshold": 1, + "operations": "", + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + } + ] + }, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "f0fcda10229a8e289666c4d4c8756ad86e6df84966226bd9bc98e1607a4826b0", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner": { + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + } + ], + "threshold": 1, + "permission_name": "owner" + }, + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "actives": [ + { + "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000", + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + }, + { + "address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "weight": 1 + } + ], + "threshold": 2, + "type": "Active", + "permission_name": "active0" + } + ] + }, + "type_url": "type.googleapis.com/protocol.AccountPermissionUpdateContract" + }, + "type": "AccountPermissionUpdateContract" + } + ], + "ref_block_bytes": "aeab", + "ref_block_hash": "90861e40e6675e8e", + "expiration": 1684491273000, + "timestamp": 1684491216214 + }, + "raw_data_hex": "0a02aeab220890861e40e6675e8e40a886849c83315aea01082e12e5010a3c747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e745065726d697373696f6e557064617465436f6e747261637412a4010a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12241a056f776e657220013a190a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e1001226508021a0761637469766530200232207fff1fc0037e00000000000000000000000000000000000000000000000000003a190a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e10013a190a154198927ffb9f554dc4a453c64b2e553a02d6df514b100170d6ca809c8331" +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/createaccount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/createaccount.md new file mode 100644 index 0000000..643fe1a --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/createaccount.md @@ -0,0 +1,97 @@ +# createaccount + +### How to use it + +The `createAccount` method allows you to create a new TRON account by using an already activated account. Here's an example of how to use this method with the Tatum SDK: + +
// yarn add @tatumcom/js
+
+import { TatumSDK, Tron, Network } from '@tatumcom/js'
+
+const tatum = await TatumSDK.init<Tron>({network: Network.TRON})
+
+const res = await tatum.rpc.createAccount('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 'TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y', {
+  visible: true,
+})
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+ +### Overview + +The `createAccount` method allows the creation of new accounts on the TRON blockchain network. This method utilizes an already activated account to create a new account. It is essential to note that the expiration time of the HTTP API creation transaction is one minute. This means you need to complete the signing and broadcast of the transaction within one minute after the creation. + +Use cases for this method include creating new users or creating a new account for different operations within your application. + +### Parameters + +The `createAccount` method takes the following parameters: + +* `owner_address` (string): The address of the activated account used to create the new account. It should be converted to a hex string. +* `account_address` (string): The address of the new account to be created. This should also be converted to a hex string and should be calculated in advance. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): This field indicates whether the address is in base58 format or not. + * `permission_id` (integer, optional): This field is used for multi-signature operations. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `TransferContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): The address of the transaction initiator. +* `account_address` (string): The address of the activated account. +* `type` (integer): The account type. External account type is 0 and this field will not be displayed in the return value. + +### HTTP Request Example + +Below is an example of an HTTP request for the `createAccount` method: + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "account_address": "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y", + "visible": true +} +``` + +### HTTP Response Example + +The response from the `createAccount` method will return the transaction details for creating a new account. Below is an example of a successful response: + +```json +{ + "result": true, + "txid": "08a8c7d7a67f6a8a60c2020c9f22033877fa5b8877662d16f5f2c368465046fb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "account_address": "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y" + }, + "type_url": "type.googleapis.com/protocol.AccountCreateContract" + }, + "type": "AccountCreateContract" + } + ], + "ref_block_bytes": "4df2", + "ref_block_hash": "6eb26e5ebc0a6922", + "expiration": 1623332388000, + "timestamp": 1623332327858 + }, + "signature": [ + "da2d3cff56f3b43c430fe5a3e8a67a8e1e5c3402a5a64a6e1e19e45a223bd50a1a4e8c6275db608dfc6c60bc86b4b69053c5e1af37e2714d1bea716d2a66c04a00" + ], + "raw_data_hex": "0a024df2220c6eb26e5ebc0a69228c928afbef8c2d5a65080112640a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74437265617465436f6e747261637412330a1541ef67873a4a8a6154c92020ef5a102a202e6a567bd121541b9a9c9c081a8f4e2926ac24d30070f8bf8c2d" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccount.md new file mode 100644 index 0000000..a23f61c --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccount.md @@ -0,0 +1,115 @@ +# getaccount + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js + +import { TatumSDK, Tron, Network } from '@tatumcom/js' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const account = await tatum.rpc.getAccount('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAccount` method is used to query information about an account on the TRON network. It provides details including TRX balance, TRC-10 balances, stake information, vote information, permissions, and more. + +{% embed url="https://codepen.io/tatum-devrel/pen/oNQOmqa" %} + +### Parameters + +* `address` (string): The account address to be queried. It should be converted to a hex string. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Determines whether the address is in base58 format. Default is false. + +### Return Object + +* `account_name` (string): The name of the account. The account name can be modified once through the `wallet/updateaccount` interface. +* `address` (string): Account address. +* `create_time` (int64): Account creation time, i.e. account activation time on the TRON network. +* `balance` (int64): TRX balance of the account. +* `frozen` (object): Contains two properties - `frozen_balance` (int64) which is the total amount of TRX staked by the account to obtain bandwidth in Stake 1.0, and `expire_time` (int64) which is the expiration time of the stake operation performed by the account to obtain bandwidth. The account can perform the unstake operation after this time. +* `delegated_frozen_balance_for_bandwidth` (int64): Total amount of TRX staked by the account for others to get bandwidth in Stake 1.0. +* `acquired_delegated_frozen_balance_for_bandwidth` (int64): Total amount of TRX staked by other accounts for this account to get bandwidth in Stake 1.0. +* `account_resource` (object): Contains information about the account's resources, including `frozen_balance_for_energy` (object) with `frozen_balance` (int64) and `expire_time` (int64), `delegated_frozen_balance_for_energy` (int64), `acquired_delegated_frozen_balance_for_energy` (int64), `delegated_frozenV2_balance_for_energy` (int64), `acquired_delegated_frozenV2_balance_for_energy` (int64), `energy_window_size` (int64), `energy_usage` (int64), and `latest_consume_time_for_energy` (int64). +* `delegated_frozenV2_balance_for_bandwidth` (int64): Total amount of TRX staked by the account for others to get bandwidth in Stake 2.0. +* `acquired_delegated_frozenV2_balance_for_bandwidth` (int64): Total amount of TRX staked by other accounts for this account to get bandwidth in Stake 2.0. +* `frozenV2` (FreezeV2\[]): In Stake 2.0, the total amount of TRX staked to obtain various types of resources does not include the delegated TRX. +* `unfrozenV2` (UnFreezeV2\[]): In Stake 2.0, each unstaking information. One of the unstaking information contains three fields: `type` (resource type), `unfreeze_amount` (the amount of unstaked TRX), `unfreeze_expire_time` (the start timestamp when the unstaked TRX can be withdrawn, in ms). +* `net_usage` (int64): The amount of bandwidth used by the account. +* `free_net_usage` (int64): The amount of free bandwidth used by the account. +* `net_window_size` (int64): The number of block times required for bandwidth obtained by stake to fully recover. +* `free_asset_net_usageV2` (map\): The amount of trc10's free bandwidth used by this account. +* `votes` (Vote): The number of votes for each Super Representative. +* `latest_opration_time` (int64): The last operation time. +* `latest_consume_time` (int64): The last time the account consumed bandwidth. +* `latest_consume_free_time` (int64): The last time the account consumed free bandwidth. + +### HTTP Request Example + +The HTTP request body for invoking this method is: + +```json +{ + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +A successful response might look like: + +```json +{ + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "balance": 2000000000, + "create_time": 1637411046000, + "net_window_size": 28800, + "account_resource": { + "energy_window_size": 28800 + }, + "owner_permission": { + "permission_name": "owner", + "threshold": 1, + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + } + ] + }, + "active_permission": [ + { + "type": "Active", + "id": 2, + "permission_name": "active", + "threshold": 1, + "operations": "7fff1fc0033e0300000000000000000000000000000000000000000000000000", + "keys": [ + { + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "weight": 1 + } + ] + } + ], + "frozenV2": [ + {}, + { + "type": "ENERGY" + }, + { + "type": "TRON_POWER" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccountbalance.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccountbalance.md new file mode 100644 index 0000000..b5bac87 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/getaccountbalance.md @@ -0,0 +1,78 @@ +# getaccountbalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, AccountIdentifier, BlockIdentifier, VisibleOption } from '@tatumio/tatum' +import BigNumber from "bignumber.js"; + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const accountIdentifier: AccountIdentifier = { + address: "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm" +} + +const blockIdentifier: BlockIdentifier = { + hash: "0000000000010c4a732d1e215e87466271e425c86945783c3d3f122bfa5affd9", + number: new BigNumber(68682) +} + +const res = await tatum.rpc.getAccountBalance(accountIdentifier, blockIdentifier, { + visible: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAccountBalance` method is used to retrieve an account's balance at a specific block on the TRON network. This is particularly useful when you need to audit the state of an account at a particular point in time or to verify a transaction's execution result against the blockchain state at a given block. + +### Parameters + +* `accountIdentifier` (AccountIdentifier): An object that represents the account identifier which includes: + * `address` (string): The account address. +* `blockIdentifier` (BlockIdentifier): An object that represents the block identifier which includes: + * `hash` (string): The block hash. + * `number` (number): The block number. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +### Return Object + +The method returns a JSON object that contains the following properties: + +* `balance` (integer): The balance of the account. +* `block_identifier.hash` (string): The block hash. +* `block_identifier.number` (integer): The block number. + +### HTTP Request Example + +```json +{ + "account_identifier": { + "address": "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm" + }, + "block_identifier": { + "hash": "0000000000010c4a732d1e215e87466271e425c86945783c3d3f122bfa5affd9", + "number": 68682 + }, + "visible": true +} +``` + +### HTTP Response ExampleThe response will be a JSON object representing the balance and block information: + +```json +{ + "balance": 100000, + "block_identifier": { + "hash": "0000000000010c4a732d1e215e87466271e425c86945783c3d3f122bfa5affd9", + "number": 68682 + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/updateaccount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/updateaccount.md new file mode 100644 index 0000000..310817a --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-methods/updateaccount.md @@ -0,0 +1,87 @@ +# updateaccount + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleAndPermissionIdOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.updateAccount('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', '0x7570646174654e616d6531353330383933343635353139', { + visible: true, + permissionId: 1 +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `updateAccount` method is used to modify the name of a TRON account. It's a powerful feature for personalizing and organizing accounts. After successfully updating, the response would be an unsigned transaction JSON object. The transaction type is `AccountUpdateContract`. + +### Parameters + +* `ownerAddress` (string): The account address to be modified. It should be converted to a hex string. +* `accountName` (string): The name of the account. It should be converted to a hex string. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + * `permissionId` (integer, optional): Optional parameter used for multi-signature accounts. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `AccountUpdateContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): The address of the transaction initiator. +* `account_name` (string): The account name. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "account_name": "0x7570646174654e616d6531353330383933343635353139", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "a00fd4a6fbb6dd42061b184cfd9bbbcd4faae5cf94c06dedb1c55c7b168c37cb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "account_name": "0x7570646174654e616d6531353330383933343635353139", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" + }, + "type_url": "type.googleapis.com/protocol.AccountUpdateContract" + }, + "type": "AccountUpdateContract" + } + ], + "ref_block_bytes": "ad91", + "ref_block_hash": "c7f32299fd0bae0e", + "expiration": 1684490307000, + "timestamp": 1684490248394 + }, + "raw_data_hex": "0a02ad912208c7f32299fd0bae0e40b88bc99b83315a8301080a127f0a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74557064617465436f6e747261637412490a30307837353730363436313734363534653631366436353331333533333330333833393333333433363335333533313339121541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e70cac1c59b8331" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/README.md new file mode 100644 index 0000000..856a257 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/README.md @@ -0,0 +1,3 @@ +# API calls for account resource methods + +### diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/delegateresource.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/delegateresource.md new file mode 100644 index 0000000..d47472a --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/delegateresource.md @@ -0,0 +1,98 @@ +# delegateresource + +### How to use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, BigNumber, TronStakeType } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.delegateResource('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 'TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', new BigNumber(1000000), TronStakeType.BANDWIDTH, false) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `delegateResource` method enables the delegation of bandwidth or energy resources to other accounts in TRON's Stake2.0. This could be useful for supporting specific operations of receiver accounts or to participate in staking and earn rewards. + +### Parameters + +Here are the parameters for the `delegateResource` method: + +* `ownerAddress` (string): The address of the account that is delegating the resources. Default format is hexString. +* `receiverAddress` (string): The address of the account that will receive the delegated resources. +* `balance` (integer): The amount of TRX staked for resources to be delegated, unit is sun. +* `resource` (string): The type of resource to delegate, either 'BANDWIDTH' or 'ENERGY'. +* `lock` (boolean): Determines whether the delegation is locked. If set to true, the delegated resources cannot be undelegated within 3 days. If the owner delegates the same type of resources using the lock to the same address, the lock time will be reset to 3 days. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Determines whether the address is in base58 format. + * `permissionId` (integer, optional): Used for multi-signature transactions. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `DelegateResourceContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: The address of the account that delegated the resources. +* `resource`: The type of delegated resource. +* `receiver_address`: The address of the account that received the delegated resources. +* `balance`: The amount of TRX staked for resources that were delegated. +* `lock`: Indicates whether the delegation was locked. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "receiver_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "balance": 1000000, + "resource": "BANDWIDTH", + "lock": false, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "txID": "3d0a235547b08f9d5e1d465f6d7dc28da6436a8d9c3b768d1a989cac7e5c94cf", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "receiver_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "balance": 1000000, + "resource": "BANDWIDTH", + "lock": false, + }, + "type_url": "type.googleapis.com/protocol.DelegateResourceContract" + }, + "type": "DelegateResourceContract" + } + ], + "ref_block_bytes": "4a1b", + "ref_block_hash": "4dc3c8c4476d5d56", + "expiration": 1582208742000, + "timestamp": 1582208686873, + "fee_limit": 1000000000 + }, + "raw_data_hex": "0a024a1b22084dc3c8c4476d5d5640c8fcaf8d2d5a2e5a680801126a0a3074..." +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalance.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalance.md new file mode 100644 index 0000000..945d243 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalance.md @@ -0,0 +1,99 @@ +# freezebalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, TronStakeType, BigNumber, FreezeAccountOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const ownerAddress = 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g' +const frozenBalance = new BigNumber(10000000) +const frozenDuration = 3 +const resource = TronStakeType.ENERGY + +const res = await tatum.rpc.freezeBalance(ownerAddress, frozenBalance, frozenDuration, resource, { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `freezeBalance` method is used to stake TRX to obtain resources. The interface has been deprecated, consider using `FreezeBalanceV2` instead. The owner of the address can lock a certain amount of TRX for a certain period to gain resources such as bandwidth and energy. + +### Parameters + +* `owner_address` (string): The owner address (default in hexString format). +* `frozen_balance` (integer): The amount of TRX to stake (unit is in sun). +* `frozen_duration` (integer): The lock-up duration for this stake, currently only 3 days are accepted. +* `resource` (string): The type of TRX stake, either 'BANDWIDTH' or 'ENERGY'. +* `options` (object, optional): This optional parameter contains the following properties: + * `receiver_address` (string, optional): Optional parameter for the address that will receive the resource (default in hexString format). + * `permission_id` (integer, optional): for multi-signature use. + * `visible` (boolean, optional): Defaults to false. Whether addresses are in base58check format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is FreezeBalanceContract, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `frozen_duration`: The lock-up duration for this stake +* `frozen_balance`: The amount of TRX to stake (unit is in sun). +* `owner_address`: The owner address. +* `resource`: The type of TRX stake, either 'BANDWIDTH' or 'ENERGY'. + +### HTTP Request Example + +```json +{ + "owner_address": "4100776428620856AE1D71562812B734E356B68551", + "frozen_balance": 10000000, + "frozen_duration": 3, + "resource": "ENERGY" +} +``` + +### HTTP Response Example + +```json +{ + "visible": false, + "txID": "efb6ff6dba6e5998d7258a63436e4717428892f02df2adb6deea8550d36e5e34", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "resource": "ENERGY", + "frozen_duration": 3, + "frozen_balance": 10000000, + "owner_address": "4100776428620856ae1d71562812b734e356b68551" + }, + "type_url": "type.googleapis.com/protocol.FreezeBalanceContract" + }, + "type": "FreezeBalanceContract" + } + ], + "ref_block_bytes": "3041", + "ref_block_hash": "3d1b89e6c7c34b52", + "expiration": 1649176881000, + "timestamp": 1649176821557 + }, + "raw_data_hex": "0a02304122083d1b89e6c7c34b5240e8cee8d4ff2f5a5a080b12560a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e6365436f6e747261637412200a154100776428620856ae1d71562812b734e356b685511080ade2041803500170b5fee4d4ff2f" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalancev2.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalancev2.md new file mode 100644 index 0000000..35d8181 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/freezebalancev2.md @@ -0,0 +1,68 @@ +# freezebalancev2 + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.freezeBalanceV2('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 10000000, 'ENERGY', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `freezeBalanceV2` method is a feature of Stake2.0 on the TRON blockchain. It allows you to stake a specific amount of TRX to obtain bandwidth or energy, and in return, you receive an equivalent amount of TRON Power (TP) according to the staked amount. This method can be useful in various use cases, such as securing network resources or participating in network governance by voting with TRON Power. + +### Parameters + +* `ownerAddress`(string): The account address in default hexString format. +* `frozenBalance`(integer): The amount of TRX to stake, in sun units. +* `resource`(string): The type of TRX stake, either 'BANDWIDTH' or 'ENERGY'. +* `options` (object, optional): This optional parameter contains the following properties: + * `permissionId`(integer, optional): This is used for multi-signature transactions. + * `visible`(string, optional):. Default is false. This parameter indicates whether addresses are in base58check format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is FreezeBalanceV2Contract, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: The account address. +* `resource`: The resource type. +* `frozen_balance`: The staked amount in sun units. + + + +### HTTP Request Example + +Here is an example of a CURL request to the `freezeBalanceV2` method: + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "frozenBalance": 1000000, + "resource": "BANDWIDTH", + "visible": true +} +``` + +### HTTP Response Example + +The response to a successful request is a `200 OK` status code, and it returns the transaction object. If the request fails, you will receive a `400 Bad Request` status code with an error message. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountnet.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountnet.md new file mode 100644 index 0000000..9a78394 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountnet.md @@ -0,0 +1,65 @@ +# getaccountnet + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleOption } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const address = 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g' + +const res = await tatum.rpc.getAccountNet(address, { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAccountNet` method is used to query bandwidth information of a specific account on the TRON network. This method can be useful for assessing an account's remaining network capacity. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqOvyO" %} + +### Parameters + +* `address` (string): The address of the account whose bandwidth information is to be queried. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +### Return Object + +The method returns a JSON object that contains the following properties: + +* `freeNetUsed` (integer): Free bandwidth used. +* `freeNetLimit` (integer): Total free bandwidth. +* `NetUsed` (integer): Used amount of bandwidth obtained by staking. +* `NetLimit` (integer): Total bandwidth obtained by staking. +* `TotalNetLimit` (integer): Total bandwidth can be obtained by staking by the whole network. +* `TotalNetWeight` (integer): Total TRX staked for bandwidth by the whole network. +* `assetNetUsed` (map\): The amount of free bandwidth of each TRC10 asset used by the account. +* `assetNetLimit` (map\): The amount of free bandwidth for each TRC10 asset in the account. + +### HTTP Request Example + +```json +{ + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "freeNetLimit": 1500, + "TotalNetLimit": 43200000000, + "TotalNetWeight": 84593524300 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountresource.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountresource.md new file mode 100644 index 0000000..5af29b3 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getaccountresource.md @@ -0,0 +1,72 @@ +# getaccountresource + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleOption } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const address = 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g' + +const res = await tatum.rpc.getAccountResources(address, { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAccountResources` method is used to query resource information (such as bandwidth, energy) of a specific account on the TRON network. This method can be useful for assessing an account's remaining computational and storage capacity. + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQbPvG" %} + +### Parameters + +* `address` (string): The address of the account whose resources are to be queried. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +### Return Object + +* `freeNetUsed` (integer): Free bandwidth used. +* `freeNetLimit` (integer): Total free bandwidth. +* `NetUsed` (integer): Used amount of bandwidth obtained by staking. +* `NetLimit` (integer): Total bandwidth obtained by staking. +* `TotalNetLimit` (integer): Total bandwidth can be obtained by staking by the whole network. +* `TotalNetWeight` (integer): Total TRX staked for bandwidth by the whole network. +* `totalTronPowerWeight` (integer): The total amount of voting rights obtained by the whole network. +* `tronPowerLimit` (integer): TRON Power (vote). +* `tronPowerUsed` (integer): TRON Power (vote) used. +* `EnergyUsed` (integer): Energy used. +* `EnergyLimit` (integer): Total energy obtained by staking. +* `TotalEnergyLimit` (integer): Total energy can be obtained by staking by the whole network. +* `TotalEnergyWeight` (integer): Total TRX staked for energy by the whole network. +* `assetNetUsed` (map\): The amount of free bandwidth of each TRC10 asset used by the account. +* `assetNetLimit` (map\): The amount of free bandwidth for each TRC10 asset in the account. + +### HTTP Request Example + +```json +{ + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "freeNetLimit": 1500, + "TotalNetLimit": 43200000000, + "TotalNetWeight": 84593524300, + "TotalEnergyLimit": 50000000000000, + "TotalEnergyWeight": 12189370443 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getavailableunfreezecount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getavailableunfreezecount.md new file mode 100644 index 0000000..eaeb660 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getavailableunfreezecount.md @@ -0,0 +1,53 @@ +# getavailableunfreezecount + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAvailableUnfreezeCount('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAvailableUnfreezeCount` method is used to retrieve the remaining times of executing the unstake operation in Stake 2.0 on the TRON blockchain. Stake 2.0 supports unstaking in batches, but it imposes a limit of 32 unstake operations that can be executed simultaneously. This means that when a user initiates the first unstake operation, they can only initiate another 31 unstake operations until the TRX of the first unstaking arrives and is ready to be withdrawn to their account. This limitation is in place to prevent malicious attacks. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjeVxBB" %} + +### Parameters + +* `ownerAddress` (string): The owner address for which to retrieve the remaining times of available unstaking. Default is in hexadecimal format. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Whether the address is in base58 format. + +### Return Object + +* `count`: The remaining times of available unstaking. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "count": 32 +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcandelegatedmaxsize.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcandelegatedmaxsize.md new file mode 100644 index 0000000..d332383 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcandelegatedmaxsize.md @@ -0,0 +1,61 @@ +# getcandelegatedmaxsize + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.TRON }) + +const res = await tatum.rpc.getCanDelegatedMaxSize('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 0, { + visible: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getCanDelegatedMaxSize` method is used to query the amount of delegatable resources share of the specified resource type for a given address on the TRON blockchain. The unit of measurement for the amount is sun. This method is part of the Stake2.0 functionality. + +Use cases for this method include: + +* Determining the amount of delegatable bandwidth or energy resources for an address. +* Calculating the available resources for delegation before initiating a delegation transaction. + +{% embed url="https://codepen.io/tatum-devrel/pen/zYMXeJR" %} + +### Parameters + +1. `ownerAddress` (string): The owner address for which the delegatable resource share needs to be queried. It should be provided as a hexadecimal string. +2. `type` (integer): The resource type to query. Use `0` for bandwidth and `1` for energy. +3. `options` (object, optional): Additional options for the method. + * `visible` (boolean, optional): Whether the address is in base58 format. Defaults to `true`. + +### Return Object + +The `getCanDelegatedMaxSize` method returns the following object: + +* `max_size`: The amount of delegatable resource share in sun. + +Note: If the delegating transaction has a memo, it would consume more bandwidth. Therefore, the actual delegatable share might be less than the value returned by this API. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "type": 0, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "max_size": 12311 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcanwithdrawunfreezeamount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcanwithdrawunfreezeamount.md new file mode 100644 index 0000000..158642d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getcanwithdrawunfreezeamount.md @@ -0,0 +1,61 @@ +# getcanwithdrawunfreezeamount + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Tron, Network } from '@tatumcom/js'; + +const tatum = await TatumSDK.init({ network: Network.TRON }); + +const res = await tatum.rpc.getCanWithdrawUnfreezeAmount('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', { + timestamp: 1667977444000, + visible: true, +}); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getCanWithdrawUnfreezeAmount` method allows you to retrieve the withdrawable balance for a specified owner address at a specific timestamp. This method is primarily used in the Stake 2.0 protocol on the TRON blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGEMON" %} + +Use Cases: + +* Calculating the available balance that can be withdrawn by an owner address in the Stake 2.0 protocol. +* Providing real-time balance information to users or applications. + +### Parameters + +* `ownerAddress` (string): The owner address for which the withdrawable balance needs to be retrieved. (Default: hexString) +* `options` (object, optional): This optional parameter contains the following properties: + * `timestamp` (integer, optional): The query cutoff timestamp in milliseconds. + * `visible` (boolean, optional): parameter to indicate whether the address is in base58 format. + +### Return Object + +The `getCanWithdrawUnfreezeAmount` method returns the following object: + +* `amount`: The withdrawable balance in TRX, where the unit is sun. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "timestamp": 1667977444000, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "amount": 1000000 +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresource.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresource.md new file mode 100644 index 0000000..ff57422 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresource.md @@ -0,0 +1,68 @@ +# getdelegatedresource + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleOption } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getDelegatedResource('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 'TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getDelegatedResource` method retrieves all resources delegations during the stake1.0 phase from one account to another. It is useful when you need to assess the resources that an address delegates to a target address. The `fromAddress` parameter can be retrieved from the GetDelegatedResourceAccountIndex API. + +{% embed url="https://codepen.io/tatum-devrel/pen/ZEmZwRJ" %} + +### Parameters + +* `fromAddress` (string, required): The energy from address. Default is hexString. +* `toAddress` (string, required): The target address for the energy delegation information. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Defaults to false. Whether addresses are in base58 format. + +### Return Object + +The return object is a list of `DelegatedResource` objects. Each `DelegatedResource` object contains: + +* `from` (string): Delegate account +* `to` (string): Resource receiving account +* `frozen_balance_for_bandwidth` (integer): Bandwidth delegate share +* `frozen_balance_for_energy` (integer): Energy delegate share +* `expire_time_for_bandwidth` (integer): Deadline of this delegate bandwidth's lock period +* `expire_time_for_energy` (integer): Deadline of this delegate energy's lock period + +### HTTP Request Example + +```json +{ + "fromAddress": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "toAddress": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "visible": true +} +``` + +### HTTP Response Example + +```json +[ + { + "from": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "frozen_balance_for_bandwidth": 2000, + "frozen_balance_for_energy": 3000, + "expire_time_for_bandwidth": 1672448400000, + "expire_time_for_energy": 1675040400000 + } +] +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindex.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindex.md new file mode 100644 index 0000000..1ba8c16 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindex.md @@ -0,0 +1,56 @@ +# getdelegatedresourceaccountindex + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getDelegatedResourceAccountIndex('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +`getDelegatedResourceAccountIndex` is a method provided by TRON RPC allowing you to query the resource delegation by an account during stake1.0 phase. Essentially, this allows you to list all addresses that have delegated resources to a specific account. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQMbrM" %} + +### Parameters + +* `value` (string): Address, default hexString. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional) - Whether the address is in base58 format. + +### Return Object + +* `account` (string) - account address. +* `fromAccounts` (string\[]) - A list of account addresses which delegate resource to this account. +* `toAccounts` (string\[]) - A list of account addresses which receive resources delegated by this account. + +### HTTP Request Example + +```json +{ + "value": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "account": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" +} +``` + +Please note that the addresses in `fromAccounts` and `toAccounts` will vary based on the resources delegated to and from the account. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindexv2.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindexv2.md new file mode 100644 index 0000000..f1ddd7b --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourceaccountindexv2.md @@ -0,0 +1,63 @@ +# getdelegatedresourceaccountindexv2 + +## TRON RPC Method: getDelegatedResourceAccountIndexV2 + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getDelegatedResourceAccountIndexV2('TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +`getDelegatedResourceAccountIndexV2` is an RPC method provided by TRON's API. It is used in the context of TRON's Stake2.0 system to query the resource delegation index by an account. It returns two lists: one is the list of addresses the account has delegated its resources to (`toAccounts`), and the other is the list of addresses that have delegated resources to the account (`fromAccounts`). + +Some potential use cases include: + +1. Checking the status of resource delegations for a specific account. +2. Understanding the delegation relationships of an account. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQBGxe" %} + +### Parameters + +* `value:` (string): The account address. By default, it is in hexString format. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +### Return Object + +The returned object includes the following fields: + +* `account` - The account address. +* `fromAccounts` - The list of addresses that have delegated resources to the account. +* `toAccounts` - The list of addresses the account has delegated its resources to. + +### HTTP Request Example + +```json +{ + "value": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "account": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourcev2.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourcev2.md new file mode 100644 index 0000000..8eee1ad --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/getdelegatedresourcev2.md @@ -0,0 +1,72 @@ +# getdelegatedresourcev2 + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getDelegatedResourceV2('fromAddress', 'toAddress', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +`getDelegatedResourceV2` is an RPC method provided by TRON's API. In the context of TRON's Stake2.0 system, it is used to query detailed information about the resource share delegated from one address to another. + +Some potential use cases might include: + +1. Checking the status of resource sharing between addresses. +2. Assessing the delegation history between two addresses. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQMbzM" %} + +### Parameters + +* `fromAddress` (string): - The address from which resources are delegated. By default, it is in hexString format. +* `toAddress` (string): - The address to which resources are delegated. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Optional parameter to specify whether the address is in base58 format. + +### Return Object + +The returned object includes a `delegatedResource` list. Each item in the list includes the following fields: + +* `from` (string): The owner's address. +* `to` (string): The recipient's address. +* `frozen_balance_for_bandwidth` (integer): The amount of TRX staked for bandwidth delegated from the `from` address to the `to` address. +* `frozen_balance_for_energy` (integer): The amount of TRX staked for energy delegated from the `from` address to the `to` address. +* `expire_time_for_bandwidth` (integer): The lock-up period deadline for bandwidth delegation. If no lock is specified when delegating resources, this field will not be displayed in the returned result and the value will be 0. +* `expire_time_for_energy` (integer): The lock-up period deadline for energy delegation. If no lock is specified when delegating resources, this field will not be displayed in the returned result and the value will be 0. + +### HTTP Request Example + +
{
+  "fromAddress": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
+  "toAddress": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1",
+  "visible": true
+}
+
+ +### HTTP Response Example + +```json +[ + { + "from": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "frozen_balance_for_bandwidth": 1000, + "frozen_balance_for_energy": 1000, + "expire_time_for_bandwidth": 1597463006000, + "expire_time_for_energy": 1597463006000 + } +] +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/undelegateresource.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/undelegateresource.md new file mode 100644 index 0000000..9d53c44 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/undelegateresource.md @@ -0,0 +1,100 @@ +# undelegateresource + +### How to use it + +You can interact with the `unDelegateResource` method using the Tatum SDK. Here is an example on how you can do it: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, BigNumber, TronStakeType, VisibleAndPermissionIdOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.unDelegateResource('TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', 'TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', new BigNumber(1000000), TronStakeType.BANDWIDTH, true, { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `unDelegateResource` method allows for cancelling the delegation of bandwidth or energy resources to other accounts in Stake2.0 on the TRON blockchain. This could be useful in scenarios where the original owner needs to reclaim staked resources. + +### Parameters + +The `unDelegateResource` method accepts the following parameters: + +* `ownerAddress` (string): The account address of the owner. By default, it should be in the hexString format. +* `receiverAddress` (string): The address of the account that is receiving the resource. +* `balance` (integer): The amount of TRX staked for resources to be delegated. The unit is sun. Example: 1000000 +* `resource` (TronStakeType): The type of resource, can either be 'BANDWIDTH' or 'ENERGY' +* `lock` (boolean): This parameter signifies whether the resources should be locked or not. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): This parameter signifies whether the address is in base58 format. + * `permissionId` (integer, optional): This parameter is used for multi-signature purpose. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `UnDelegateResourceContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: The address of the account that delegated the resources. +* `resource`: The type of delegated resource. +* `receiver_address`: The address of the account that received the delegated resources. +* `balance`: The amount of TRX staked for resources that were delegated. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "receiver_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "balance": 1000000, + "resource": "BANDWIDTH", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "txID": "3d0a235547b08f9d5e1d465f6d7dc28da6436a8d9c3b768d1a989cac7e5c94cf", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "receiver_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "balance": 1000000, + "resource": "BANDWIDTH", + "lock": false, + }, + "type_url": "type.googleapis.com/protocol.UnDelegateResource" + }, + "type": "UnDelegateResource" + } + ], + "ref_block_bytes": "4a1b", + "ref_block_hash": "4dc3c8c4476d5d56", + "expiration": 1582208742000, + "timestamp": 1582208686873, + "fee_limit": 1000000000 + }, + "raw_data_hex": "0a024a1b22084dc3c8c4476d5d5640c8fcaf8d2d5a2e5a680801126a0a3074..." +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalance.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalance.md new file mode 100644 index 0000000..ae0dd36 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalance.md @@ -0,0 +1,90 @@ +# unfreezebalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, TronStakeType, UnFreezeAccountOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const ownerAddress = 'TZZyXU3pYgKkcc6RBVYHzY1JRLyPeN5BWy' + +const res = await tatum.rpc.unfreezeBalance(ownerAddress, TronStakeType.ENERGY, { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `unfreezeBalance` method is used to unstake previously staked TRX and release the obtained bandwidth or energy and TP. This operation will automatically cancel all votes. + +### Parameters + +* `owner_address` (string): The owner address (default in hexString format). +* `resource` (string): The type of TRX stake, either 'BANDWIDTH' or 'ENERGY'. +* `options` (object, optional): This optional parameter contains the following properties: + * `receiver_address` (string, optional): Optional parameter for the address that will lose the resource (default in hexString format). + * `permission_id` (integer, optional): For multi-signature use. + * `visible` (boolean, optional): Defaults to false. Whether addresses are in base58 format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulentl +* `txID` - transaction id + +Since the transaction type is `UnfreezeBalanceContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: The owner address. +* `resource`: The type of TRX stake, either 'BANDWIDTH' or 'ENERGY'. +* `receiver_address`: The address that will lose the resource. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "resource": "BANDWIDTH", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": false, + "txID": "efb6ff6dba6e5998d7258a63436e4717428892f02df2adb6deea8550d36e5e34", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "resource": "BANDWIDTH", + "owner_address": "4100776428620856ae1d71562812b734e356b68551" + }, + "type_url": "type.googleapis.com/protocol.UnfreezeBalanceContract" + }, + "type": "UnfreezeBalanceContract" + } + ], + "ref_block_bytes": "3041", + "ref_block_hash": "3d1b89e6c7c34b52", + "expiration": 1649176881000, + "timestamp": 1649176821557 + }, + "raw_data_hex": "0a02304122083d1b89e6c7c34b5240e8cee8d4ff2f5a5a080b12560a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e6365436f6e747" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalancev2.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalancev2.md new file mode 100644 index 0000000..085845c --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/unfreezebalancev2.md @@ -0,0 +1,97 @@ +# unfreezebalancev2 + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' +import { BigNumber } from 'bignumber.js' +import { TronStakeType } from '@tatumio/tatum/dist/src/blockchain' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.unfreezeBalanceV2( + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + new BigNumber(1000000), + TronStakeType.BANDWIDTH, + { visible: true } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `unfreezeBalanceV2` method is used to unlock TRX staked at the Stake 2.0 stage. After unstaking, the user needs to wait for 14 days before they can withdraw the funds. The method also withdraws any unclaimed voting rewards to the account, and if previously unstaked funds have passed the lock-up period, it also withdraws them at the same time. The voting reward withdrawn and the amount of funds withdrawn can be queried through the `gettransactioninfobyid` API. + +### Parameters + +The `unfreezeBalanceV2` method accepts the following parameters: + +* `ownerAddress` (string): The account address +* `unfreeze_balance` (BigNumber): The amount of TRX to unstake, in sun +* `resource` (string): The resource type: 'BANDWIDTH' or 'ENERGY' +* `options` (object, optional): An object that can have the following properties: + * `visible` (boolean): Whether the address is in base58 format + * `permissionId` (integer): For multi-signature use, optional + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is UnFreezeBalanceV2Contract, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: The account address +* `resource`: The resource type +* `unfreeze_balance`: The unstake amount, unit is sun + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "unfreeze_balance": 1000000, + "resource": "BANDWIDTH", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "txID": "3d0a235547b08f9d5e1d465f6d7dc28da6436a8d9c3b768d1a989cac7e5c94cf", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "unfreeze_balance": 1000000, + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "resource": "BANDWIDTH" + }, + "type_url": "type.googleapis.com/protocol.UnfreezeBalanceContract" + }, + "type": "UnfreezeBalanceContract" + } + ], + "ref_block_bytes": "4a1b", + "ref_block_hash": "4dc3c8c4476d5d56", + "expiration": 1582208742000, + "timestamp": 1582208686873, + "fee_limit": 1000000000 + }, + "raw_data_hex": "0a024a1b22084dc3c8c4476d5d5640c8fcaf8d2d5a2e5a680801126a0a3074..." +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/withdrawexpireunfreeze.md b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/withdrawexpireunfreeze.md new file mode 100644 index 0000000..0a4e04d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-account-resource-methods/withdrawexpireunfreeze.md @@ -0,0 +1,85 @@ +# withdrawexpireunfreeze + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.TRON }) + +const res = await tatum.rpc.withdrawExpireUnfreeze('ra5nK24KXen9AHvsdFTKHSANinZseWnPcX', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +Withdraw unfrozen balance in Stake 2.0. This method allows users to retrieve their funds after executing the `/wallet/unfreezebalancev2` transaction and waiting for a certain number of days. The number of days is determined by a network parameter. + +Note: Stake 2.0 supports multiple partial unstakes. When calling this API, all unstaked funds that have passed the lock-up period will be withdrawn at once. + +### Parameters + +* `ownerAddress` (string): Owner address in hexadecimal format. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Specifies whether the address is in base58 format. + * `permissionId` (integer, optional): Used for multi-signature scenarios. + +### Return Object + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is WithdrawExpireUnfreezeContract, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Account address. + +### HTTP Request Example + +```bash +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "txID": "3d0a235547b08f9d5e1d465f6d7dc28da6436a8d9c3b768d1a989cac7e5c94cf", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" + }, + "type_url": "type.googleapis.com/protocol.WithdrawExpireUnfreezeContract" + }, + "type": "WithdrawExpireUnfreezeContract" + } + ], + "ref_block_bytes": "4a1b", + "ref_block_hash": "4dc3c8c4476d5d56", + "expiration": 1582208742000, + "timestamp": 1582208686873, + "fee_limit": 1000000000 + }, + "raw_data_hex": "0a024a1b22084dc3c8c4476d5d5640c8fcaf8d2d5a2e5a680801126a0a3074..." +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/README.md new file mode 100644 index 0000000..3921206 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/README.md @@ -0,0 +1,2 @@ +# API calls for address utility methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/validateaddress.md b/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/validateaddress.md new file mode 100644 index 0000000..14af3ce --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-address-utility-methods/validateaddress.md @@ -0,0 +1,67 @@ +# validateaddress + +### How to use it + +Below is an example of how to use the `validateAddress` method with the Tatum SDK: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +// Call validateAddress RPC method +const res = await tatum.rpc.validateAddress('TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `validateAddress` method is used to validate the format of a given TRON blockchain address. It verifies if the address is in the correct format, i.e., base58checksum, hexString, or base64 format, and returns a result indicating whether the format is correct or not, along with a message specifying the address format type or an error message. + +### Try the call + +{% embed url="https://codepen.io/tatum-devrel/pen/zYMXepP" %} + +### Parameters + +This method accepts the following parameters: + +* `address` (string): This is a required parameter. The address should be in base58checksum, hexString, or base64 format. +* `visible` (boolean): Specifies the visibility of the address. It can be set to either true or false. (Optional) + +### Return Object + +This method returns an object with the following parameters: + +* `result` (boolean): Indicates whether the address format is correct. +* `message` (string): Provides the address format type or an error message if the format is incorrect. + +### HTTP Request Example + +```bash +{ + "address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "visible": true +} +``` + +### HTTP Response Example + +A successful HTTP response returns a status code of 200 and a JSON body similar to the following example: + +```json +{ + "result": true, + "message": "Base58check format" +} +``` + +In case of an error, the HTTP response returns a status code of 400 with a body containing an error message. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/README.md new file mode 100644 index 0000000..feb85fd --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/README.md @@ -0,0 +1,2 @@ +# API calls for query the network methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getbandwidthprices.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getbandwidthprices.md new file mode 100644 index 0000000..033cd96 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getbandwidthprices.md @@ -0,0 +1,47 @@ +# getbandwidthprices + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getBandwidthPrices() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBandwidthPrices()` method is used to retrieve historical bandwidth unit prices on the TRON blockchain. Bandwidth is an essential resource in the TRON network used for performing transactions. This method will return all historical prices, where each unit price change is separated by a comma. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQeMNy" %} + +### Parameters + +This method doesn't require any parameters. + +### Return Object + +* `prices`: A string that represents all historical bandwidth unit price information. Each unit price change is separated by a comma. Before the colon is the millisecond timestamp, and after the colon is the bandwidth unit price in sun. + +### HTTP Request Example + +```shell +{} +``` + +### HTTP Response Example + +```json +{ + "prices": "1613713487000:100,1613799887000:200,1613886287000:150" +} +``` + +In this example, the first bandwidth unit price change was at timestamp `1613713487000` with a price of `100` sun, the second at timestamp `1613799887000` with a price of `200` sun, and so on. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblock.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblock.md new file mode 100644 index 0000000..6c85286 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblock.md @@ -0,0 +1,282 @@ +# getblock + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getBlock('1000000', { + detail: false, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlock` method allows you to query block header information or entire block information according to block height or block hash. This can be particularly useful in situations where you need to inspect the contents of a particular block in the TRON blockchain for transaction verification or data analysis. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqOvez" %} + +### Parameters + +* `idOrNum` (string): This parameter can be the block height or the block hash. Not providing a value means that it will query the latest block. +* `options` (object, optional): This is an optional parameter that can include: + * `detail` (boolean, optional): If set to true, it queries the entire block information including the header and body. If false, it only queries the block header information. + +### Return Object + +The method returns a Promise that resolves to an object with the following properties: + +* `blockID` (string): The block hash. +* `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). +* `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```json +{ + "id_or_num": "1000000", + "detail": true +} +``` + +### HTTP Response Example + +```json +{ + "blockID": "00000000000f424013e51b18e0782a32fa079ddafdb2f4c343468cf8896dc887", + "block_header": { + "raw_data": { + "number": 1000000, + "txTrieRoot": "e2dd42daa9c853e070df1e4fc927851a7438c601fb12cf945922629d5cec187b", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "00000000000f423fbccd9cdb9e410eabdf9f94145cf5b71a678b8b9616619125", + "version": 9, + "timestamp": 1578594852000 + }, + "witness_signature": "179caed28b3d129dee6d553ae6761a8c8698f890e5f38e062d56e2d0d0b8c9a20317b7753b3fd1be261935d6182434a6c057f8926f25027b9859cde3da3a655300" + }, + "transactions": [ + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "95428ed2e263600933f82bf67f43e15450bc2da3b7b2987a7f46b0b9b9c4aae7ba5ea005b9297fbff5bca5fe5c9b05299433e36e10224c167f9c613b6dded39000" + ], + "txID": "7faabd22623eb53467d34b2a417262f6df75433566c104b6c6eec5a227090df6", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "ae21db6f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa0000000000000000000000000000000000000000000000000000000004a9681c0000000000000000000000000000000000000000000000000000000004a8fe400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000051f5e04f9000000000000000000000000000000000000000000000000000000051f5e04f8000000000000000000000000000000000000000000000000000000051f5e04f7000000000000000000000000000000000000000000000000000000051f5e04f6000000000000000000000000000000000000000000000000000000051f5e04f5000000000000000000000000000000000000000000000000000000051f5e04f4000000000000000000000000000000000000000000000000000000051f5e04f3", + "owner_address": "41920bb75dd5751afd68e1d55a8a0bc1bc39b32c78", + "contract_address": "417090190c41ba59f763e2cbe7d885e007e94be5d2" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423e", + "ref_block_hash": "5c35fda2f1a9a386", + "expiration": 1578594906000, + "fee_limit": 1000000000, + "timestamp": 1578594849159 + }, + "raw_data_hex": "0a02423e22085c35fda2f1a9a3864090dfdadcf82d5af003081f12eb030a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412b5030a1541920bb75dd5751afd68e1d55a8a0bc1bc39b32c781215417090190c41ba59f763e2cbe7d885e007e94be5d2228403ae21db6f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa0000000000000000000000000000000000000000000000000000000004a9681c0000000000000000000000000000000000000000000000000000000004a8fe400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000051f5e04f9000000000000000000000000000000000000000000000000000000051f5e04f8000000000000000000000000000000000000000000000000000000051f5e04f7000000000000000000000000000000000000000000000000000000051f5e04f6000000000000000000000000000000000000000000000000000000051f5e04f5000000000000000000000000000000000000000000000000000000051f5e04f4000000000000000000000000000000000000000000000000000000051f5e04f37087a3d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "6e3f72c5d8bf433bf98ac3bbcdfbbb179d8cd8f5f6da5f1eb0466bbc80bcebee6dc0e5312796c37c3fe73d49f9b350cf61f4830deb7d846c90570f8afb3f513400" + ], + "txID": "98d0f4149bf8023a9df4d2b754f6c728a5b6d021c4497c6cd5452b97f01b0548", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "41ed2f4270fa5a7cae1efd4706ae27a4335406921e", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 14000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594849385 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad401081f12cf010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741299010a1541ed2f4270fa5a7cae1efd4706ae27a4335406921e1215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c1880bfd60622640204b01b000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa70e9a4d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "230b8767e8745d01f38d2b9f742f4037eb81e93bcc9c2d60bedf4bab3b9e0c16692138a112f1610b505cf3109f3a5ff00d6687c09b3c94a734dd8aedfc92d82101" + ], + "txID": "17e7321320bb08c40f027cbcca320152c2396c77a910f387849a944ee8aa0cb1", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "f6d4ef1a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa", + "owner_address": "41920bb75dd5751afd68e1d55a8a0bc1bc39b32c78", + "contract_address": "4179c23a5666042e40420d6afdc1541e3926205eba" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423e", + "ref_block_hash": "5c35fda2f1a9a386", + "expiration": 1578594906000, + "fee_limit": 1000000000, + "timestamp": 1578594849187 + }, + "raw_data_hex": "0a02423e22085c35fda2f1a9a3864090dfdadcf82d5aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a1541920bb75dd5751afd68e1d55a8a0bc1bc39b32c7812154179c23a5666042e40420d6afdc1541e3926205eba2244f6d4ef1a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa70a3a3d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "55124a9bfb733a27fc193b00c9c2ce0c1f969ffd0ec59c295fea00a75501206b0d5333c16c8f6a5aa7a32a03268edd3ca903d41f386001733a7d0199bcedb8bb01" + ], + "txID": "4ef51a5760bf98dc2dd752658f48db1445e8ca75f8a6efe14d5a462a15edd3f0", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "41f07e117a4b5f1fda66f8fcedf44065f1dafc5ad7", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 1982000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594850315 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad501081f12d0010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e7472616374129a010a1541f07e117a4b5f1fda66f8fcedf44065f1dafc5ad71215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c1880d78bb10722640204b01b00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa708bacd7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "153d437be2c417d88bef564a1421d2c3debb9f3828e9276a58578eb566091d6a612d3294c124ba3a5da37815d49b7cc7a91be04c0304a8e9ecee02f4d3dc420901" + ], + "txID": "80e07e3f2b92a0e9974b1398964e006288836dee82aa3a81e579a512e6581354", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "419ac63dd8e80daf0a786bf962860e2209b7fa5fb9", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 11000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594851357 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad401081f12cf010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741299010a15419ac63dd8e80daf0a786bf962860e2209b7fa5fb91215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c18c0b19f0522640204b01b00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa709db4d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "a2e6784005b0bd9f80dcb92de8f37133e3355a09496bd7467580805226e2ed520e48858456151dc681e423f0041ae877369a16e6d805facc7af9d27b712891bb01" + ], + "txID": "ba8e727c03d588619310d7a16a95fcfd31a516dbf8893ddd585e0bbd7e0deae4", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "8a157bf900000000000000000000000000000000000000000000000000000000000019be", + "owner_address": "4141c910d7942636ae041975616104ef253e5a8371", + "contract_address": "41174e91a57d68f5ac1bc485d03a038fe745a3b89b" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 10000000, + "timestamp": 1578594850984 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a154141c910d7942636ae041975616104ef253e5a8371121541174e91a57d68f5ac1bc485d03a038fe745a3b89b22248a157bf900000000000000000000000000000000000000000000000000000000000019be70a8b1d7dcf82d900180ade204" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbalance.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbalance.md new file mode 100644 index 0000000..d3100a9 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbalance.md @@ -0,0 +1,85 @@ +# getblockbalance + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @@tatumio/tatum +import { TatumSDK, Tron, Network, BigNumber } from '@tatumio/tatum' +import BigNumber from "bignumber.js"; + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getBlockBalance('00000000032669d53545fc1becc4d0cc9287e6324fb3a9230103aa0922f84544', new BigNumber(52849109), { visible: true }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockBalance` RPC method retrieves all balance change operations in a specific block. This method is useful for tracking transactional changes and balances within a given block. At present, the interface data can only be queried through specific official nodes (47.241.20.47, 161.117.85.97, 161.117.224.116, 161.117.83.38). + +### Parameters + +* `hash` (string): The hash of the block for which you want to get the balance change operations. For example: '0000000001f5b9ca67c722d9263879696c92e8e383d4f0b31c15a91b8a249029'. +* `number` (integer): The number of the block for which you want to get the balance change operations. For example: 32881098. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Whether the address is in base58 format. + +### Return Object + +The method returns an object with the following properties: + +* `timestamp` (integer): The timestamp of the block. +* `block_identifier.hash` (string): The hash of the block. +* `block_identifier.number` (integer): The number of the block. +* `transaction_balance_trace` (TransactionBalanceTrace\[]): An array of transaction information with balance changes. Each TransactionBalanceTrace object contains: + * `transaction_identifier` (string): The hash of the transaction. + * `operation` (Operation\[]): An array of operations involved in the transaction. Each operation contains: + * `operation_identifier` (integer): The identifier of the operation. + * `address` (string): The address involved in the operation. + * `amount` (integer): The amount of balance increase or decrease. + * `type` (string): The type of the transaction. + * `status` (string): The result of the transaction. + +### HTTP Request Example + +```json +{ + "hash": "0000000001f5b9ca67c722d9263879696c92e8e383d4f0b31c15a91b8a249029", + "number": 32881098, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "timestamp": 1630847456000, + "block_identifier": { + "hash": "0000000001f5b9ca67c722d9263879696c92e8e383d4f0b31c15a91b8a249029", + "number": 32881098 + }, + "transaction_balance_trace": [ + { + "transaction_identifier": "ea75b733582194c3c4da8a4c962c5c5a1dfabf525e8db300678b4d18b3adc7fa", + "operation": [ + { + "operation_identifier": 0, + "address": "TKJUZBU4wFm5Vc3MJboGLp7MEeYQ9xEJGy", + "amount": -1000000 + }, + { + "operation_identifier": 1, + "address": "TAUN6FwrnwwmaEqYcckffC7wYmbaS6cBiX", + "amount": 1000000 + } + ], + "type": "TransferContract", + "status": "SUCCESS" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbyid.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbyid.md new file mode 100644 index 0000000..445eb13 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbyid.md @@ -0,0 +1,272 @@ +# getblockbyid + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getBlockById('000000000326bcabea2fa533c7080c8baf231f320d3ccdd54a59e3fcb1760364') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockById` method allows you to query a specific block on the TRON blockchain by providing the block's ID. This can be useful when you want to retrieve specific transactional or metadata about a particular block. + +### Parameters + +* `value` (string): The ID of the block to query. This is the block hash which uniquely identifies each block on the TRON blockchain. + +### Return Object + +* `blockID` (string): The block hash. +* `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). +* `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```json +{ + "value": "0x000000000332a91b74ac983b698b9b6ddb087631992fcf8a4cf838b8500e7767" +} +``` + +### HTTP Response Example + +```json +{ + "blockID": "00000000000f424013e51b18e0782a32fa079ddafdb2f4c343468cf8896dc887", + "block_header": { + "raw_data": { + "number": 1000000, + "txTrieRoot": "e2dd42daa9c853e070df1e4fc927851a7438c601fb12cf945922629d5cec187b", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "00000000000f423fbccd9cdb9e410eabdf9f94145cf5b71a678b8b9616619125", + "version": 9, + "timestamp": 1578594852000 + }, + "witness_signature": "179caed28b3d129dee6d553ae6761a8c8698f890e5f38e062d56e2d0d0b8c9a20317b7753b3fd1be261935d6182434a6c057f8926f25027b9859cde3da3a655300" + }, + "transactions": [ + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "95428ed2e263600933f82bf67f43e15450bc2da3b7b2987a7f46b0b9b9c4aae7ba5ea005b9297fbff5bca5fe5c9b05299433e36e10224c167f9c613b6dded39000" + ], + "txID": "7faabd22623eb53467d34b2a417262f6df75433566c104b6c6eec5a227090df6", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "ae21db6f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa0000000000000000000000000000000000000000000000000000000004a9681c0000000000000000000000000000000000000000000000000000000004a8fe400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000051f5e04f9000000000000000000000000000000000000000000000000000000051f5e04f8000000000000000000000000000000000000000000000000000000051f5e04f7000000000000000000000000000000000000000000000000000000051f5e04f6000000000000000000000000000000000000000000000000000000051f5e04f5000000000000000000000000000000000000000000000000000000051f5e04f4000000000000000000000000000000000000000000000000000000051f5e04f3", + "owner_address": "41920bb75dd5751afd68e1d55a8a0bc1bc39b32c78", + "contract_address": "417090190c41ba59f763e2cbe7d885e007e94be5d2" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423e", + "ref_block_hash": "5c35fda2f1a9a386", + "expiration": 1578594906000, + "fee_limit": 1000000000, + "timestamp": 1578594849159 + }, + "raw_data_hex": "0a02423e22085c35fda2f1a9a3864090dfdadcf82d5af003081f12eb030a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412b5030a1541920bb75dd5751afd68e1d55a8a0bc1bc39b32c781215417090190c41ba59f763e2cbe7d885e007e94be5d2228403ae21db6f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa0000000000000000000000000000000000000000000000000000000004a9681c0000000000000000000000000000000000000000000000000000000004a8fe400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000051f5e04f9000000000000000000000000000000000000000000000000000000051f5e04f8000000000000000000000000000000000000000000000000000000051f5e04f7000000000000000000000000000000000000000000000000000000051f5e04f6000000000000000000000000000000000000000000000000000000051f5e04f5000000000000000000000000000000000000000000000000000000051f5e04f4000000000000000000000000000000000000000000000000000000051f5e04f37087a3d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "6e3f72c5d8bf433bf98ac3bbcdfbbb179d8cd8f5f6da5f1eb0466bbc80bcebee6dc0e5312796c37c3fe73d49f9b350cf61f4830deb7d846c90570f8afb3f513400" + ], + "txID": "98d0f4149bf8023a9df4d2b754f6c728a5b6d021c4497c6cd5452b97f01b0548", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "41ed2f4270fa5a7cae1efd4706ae27a4335406921e", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 14000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594849385 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad401081f12cf010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741299010a1541ed2f4270fa5a7cae1efd4706ae27a4335406921e1215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c1880bfd60622640204b01b000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa70e9a4d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "230b8767e8745d01f38d2b9f742f4037eb81e93bcc9c2d60bedf4bab3b9e0c16692138a112f1610b505cf3109f3a5ff00d6687c09b3c94a734dd8aedfc92d82101" + ], + "txID": "17e7321320bb08c40f027cbcca320152c2396c77a910f387849a944ee8aa0cb1", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "f6d4ef1a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa", + "owner_address": "41920bb75dd5751afd68e1d55a8a0bc1bc39b32c78", + "contract_address": "4179c23a5666042e40420d6afdc1541e3926205eba" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423e", + "ref_block_hash": "5c35fda2f1a9a386", + "expiration": 1578594906000, + "fee_limit": 1000000000, + "timestamp": 1578594849187 + }, + "raw_data_hex": "0a02423e22085c35fda2f1a9a3864090dfdadcf82d5aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a1541920bb75dd5751afd68e1d55a8a0bc1bc39b32c7812154179c23a5666042e40420d6afdc1541e3926205eba2244f6d4ef1a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000051f5e04fa70a3a3d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "55124a9bfb733a27fc193b00c9c2ce0c1f969ffd0ec59c295fea00a75501206b0d5333c16c8f6a5aa7a32a03268edd3ca903d41f386001733a7d0199bcedb8bb01" + ], + "txID": "4ef51a5760bf98dc2dd752658f48db1445e8ca75f8a6efe14d5a462a15edd3f0", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "41f07e117a4b5f1fda66f8fcedf44065f1dafc5ad7", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 1982000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594850315 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad501081f12d0010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e7472616374129a010a1541f07e117a4b5f1fda66f8fcedf44065f1dafc5ad71215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c1880d78bb10722640204b01b00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa708bacd7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "153d437be2c417d88bef564a1421d2c3debb9f3828e9276a58578eb566091d6a612d3294c124ba3a5da37815d49b7cc7a91be04c0304a8e9ecee02f4d3dc420901" + ], + "txID": "80e07e3f2b92a0e9974b1398964e006288836dee82aa3a81e579a512e6581354", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "0204b01b00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa", + "owner_address": "419ac63dd8e80daf0a786bf962860e2209b7fa5fb9", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "call_value": 11000000 + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 1000000000, + "timestamp": 1578594851357 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5ad401081f12cf010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741299010a15419ac63dd8e80daf0a786bf962860e2209b7fa5fb91215418d9dd663cf90256fdf2faba2a1be71f8a0147f8c18c0b19f0522640204b01b00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003000000000000000000000000db4df489cf3977fbf0d06e47885f3dc85446b4aa709db4d7dcf82d90018094ebdc03" + }, + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "a2e6784005b0bd9f80dcb92de8f37133e3355a09496bd7467580805226e2ed520e48858456151dc681e423f0041ae877369a16e6d805facc7af9d27b712891bb01" + ], + "txID": "ba8e727c03d588619310d7a16a95fcfd31a516dbf8893ddd585e0bbd7e0deae4", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "8a157bf900000000000000000000000000000000000000000000000000000000000019be", + "owner_address": "4141c910d7942636ae041975616104ef253e5a8371", + "contract_address": "41174e91a57d68f5ac1bc485d03a038fe745a3b89b" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "423f", + "ref_block_hash": "bccd9cdb9e410eab", + "expiration": 1578594909000, + "fee_limit": 10000000, + "timestamp": 1578594850984 + }, + "raw_data_hex": "0a02423f2208bccd9cdb9e410eab40c8f6dadcf82d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a154141c910d7942636ae041975616104ef253e5a8371121541174e91a57d68f5ac1bc485d03a038fe745a3b89b22248a157bf900000000000000000000000000000000000000000000000000000000000019be70a8b1d7dcf82d900180ade204" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylatestnum.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylatestnum.md new file mode 100644 index 0000000..387c382 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylatestnum.md @@ -0,0 +1,173 @@ +# getblockbylatestnum + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getBlockByLatestNum(5) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockByLatestNum` method retrieves a specified number of the most recent blocks from the TRON blockchain. This can be helpful when you need to analyse or display recent blockchain data. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOJrGL" %} + +### Parameters + +* `num` (integer): The number of the most recent blocks to retrieve. + +### Return Object + +* `block:` Array of blocks + * + * `blockID` (string): The block hash. + * `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). + * `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```json +{ + "num": 5 +} +``` + +### HTTP Response Example + +```json +{ + "block": [ + { + "blockID": "000000000203c375c7521ef953106e9a112e1902664a91becc5f40371a7397d7", + "block_header": { + "raw_data": { + "number": 33801077, + "txTrieRoot": "30fe6502e11e110fa389d5c17e1cf53fa8df93f26297d9f27cd8c07d3558d722", + "witness_address": "41e71c365c9dbf284ca8c1eed2d7877638941b9011", + "parentHash": "000000000203c3741f9a08f594934bd26df95cc6c49b475d118e3a87aed5a4a4", + "version": 27, + "timestamp": 1684509309000 + }, + "witness_signature": "cb4845bbd745f620852a1a54a955cee0d1aecc209f2f96e9b4ea53bf3d2ceb0f665fa07a5e870fcf9c6b98110a33d5bba5f35b588cc4123394b7e9f439fe265301" + }, + "transactions": [ + { + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "95874b4774ba56125dfd7bf2a99a0652d4abda98c6977e3f417852b7ea6f2b81ff2f260df473d186be9586b6bbeb74b5382d7f058593fd72fb60da5d0f77f77100" + ], + "txID": "31370141e3345421bdb92eff72f0d69aba8d04e636317ed52745d3f97e9faabb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "37383d0e00000000000000000000000000000000000000000000000000000188349354c9", + "owner_address": "41fcf7ab2a2fb29362babd41647a22b223f7fbedec", + "contract_address": "41c3c5115bd3f5cfe5559c634eeb250f339ae3e29c" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "c362", + "ref_block_hash": "4ddf60f936a910d9", + "expiration": 1684509366000, + "fee_limit": 150000000, + "timestamp": 1684509306936 + }, + "raw_data_hex": "0a02c36222084ddf60f936a910d940f0add4a483315a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a1541fcf7ab2a2fb29362babd41647a22b223f7fbedec121541c3c5115bd3f5cfe5559c634eeb250f339ae3e29c222437383d0e00000000000000000000000000000000000000000000000000000188349354c970b8e0d0a48331900180a3c347" + } + ] + }, + { + "blockID": "000000000203c376d3d45ca88309982517d69ff0ec4d9a9f9f25536cebcdd76b", + "block_header": { + "raw_data": { + "number": 33801078, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41e61626ef01662b320a8ba38372e9db9cca940a3b", + "parentHash": "000000000203c375c7521ef953106e9a112e1902664a91becc5f40371a7397d7", + "version": 27, + "timestamp": 1684509312000 + }, + "witness_signature": "f38e08044df52f0bd3314a0dc73431290c323e20a67297da8be939041a8eae484e1094ba455c78b71f198bfaf80aee68bb5e9d40f9146158e88ed776d2034e9800" + } + }, + { + "blockID": "000000000203c3772b4f36792ea4f44a6d8345ccacee8a00d6f309a206193f1c", + "block_header": { + "raw_data": { + "number": 33801079, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41e76da262ad1ca05274f74258ee18bc7fcc4987dc", + "parentHash": "000000000203c376d3d45ca88309982517d69ff0ec4d9a9f9f25536cebcdd76b", + "version": 27, + "timestamp": 1684509315000 + }, + "witness_signature": "c6413a9d83553d6243eff19c27c136436e9e2e1b2315849e71232ae473614fdf3034ce215c8695c7ca15742899dcf6c276b3be918b6b8049b74f3b81a3c695b500" + } + }, + { + "blockID": "000000000203c378d7df0f9d0edecc8b5e7edac57543e6fa421bbae6b1448e5f", + "block_header": { + "raw_data": { + "number": 33801080, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41290bf92b578a1c615ebb273aff6a285230c02f65", + "parentHash": "000000000203c3772b4f36792ea4f44a6d8345ccacee8a00d6f309a206193f1c", + "version": 27, + "timestamp": 1684509318000 + }, + "witness_signature": "122a4463f64743b90f1e0f476bd878aae576225591643972595a7bb250ddee2757287b8c8ab627ba95e027e55421160ea2b6bb543bcaa89b871427113bbab6a101" + } + }, + { + "blockID": "000000000203c3799526a98bab56861511f0e67ec65557826d7bfc0b36e17450", + "block_header": { + "raw_data": { + "number": 33801081, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41977f82c69011cf4a7db6f7339edcded85c614d45", + "parentHash": "000000000203c378d7df0f9d0edecc8b5e7edac57543e6fa421bbae6b1448e5f", + "version": 27, + "timestamp": 1684509321000 + }, + "witness_signature": "bd07babfec59340828d6d82032a0865f22391df29c43647c0e3186e21b9df43d2f78f3cb50d4a0113f08ebd7c02663ffc169352297256cce4bd62b04a4289e1d01" + } + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylimitnext.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylimitnext.md new file mode 100644 index 0000000..bbab7cb --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbylimitnext.md @@ -0,0 +1,133 @@ +# getblockbylimitnext + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import { TatumSDK, Tron, Network } from '@tatumio/tatum'; + +const tatum = await TatumSDK.init({network: Network.TRON}); + +const res = await tatum.rpc.getBlockByLimitNext(1, 5); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockByLimitNext` method allows interaction with the TRON blockchain to fetch a range of blocks. The method requires the starting and ending block heights as input and returns the list of Block Objects included in the range. + +Use cases include, but are not limited to, data analysis, tracking block transactions, and network monitoring. + +### Parameters + +The method takes two parameters: + +* `startNum` (integer): The starting block height, inclusive. +* `endNum` (integer): The ending block height, exclusive. + +### Return Object + +* `block:` Array of blocks + * `blockID` (string): The block hash. + * `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). + * `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +Here's how the request looks as a CURL command: + +```json +{ + "startNum": 1, + "endNum": 5 +} +``` + +### HTTP Response Example + +This is a general representation of a response. The actual response will contain a list of blocks based on the range specified: + +```json +{ + "block": [ + { + "blockID": "0000000000000001049f911bc1069bfd2c2225bc3cd210abd02fb219751813f0", + "block_header": { + "raw_data": { + "number": 1, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "0000000000000000de1aa88295e1fcf982742f773e0419c5a9c134c994a9059e", + "version": 9, + "timestamp": 1575594015000 + }, + "witness_signature": "a3feb861edcf246bd51a447f8f91636c1d7e6868b346eb2773e24859aacceaed4aa032664c2433bce5dc58e6febe87d3a7e70841684536964670fcad05fe111601" + } + }, + { + "blockID": "00000000000000028e917e1dcf24b45bf9ba16d59d77f9a1846bc4861e7045e4", + "block_header": { + "raw_data": { + "number": 2, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "0000000000000001049f911bc1069bfd2c2225bc3cd210abd02fb219751813f0", + "version": 9, + "timestamp": 1575594024000 + }, + "witness_signature": "076e8610191e5e1b010697ed40fc4a8b316010374e27add85ca117160582223559e14195c7f475020b66f6136807a96c8aaea4b8a8061a9ab50d1d19234034eb00" + } + }, + { + "blockID": "0000000000000003e7025004f6a699db79bd9d5f20bc5e363344f8b01f959394", + "block_header": { + "raw_data": { + "number": 3, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "00000000000000028e917e1dcf24b45bf9ba16d59d77f9a1846bc4861e7045e4", + "version": 9, + "timestamp": 1575594027000 + }, + "witness_signature": "fa4bf8994324f816b8ad1e85ae06b93b33e24cce84255c5656415573641b01410f5e2152d328c32525b8a03ca06dc6100e26fddb2c4836e3e4357134399372a901" + } + }, + { + "blockID": "00000000000000044a56ccc0ee2c6ce0f6d1aeeeca788486ea0f6ad52853749c", + "block_header": { + "raw_data": { + "number": 4, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "0000000000000003e7025004f6a699db79bd9d5f20bc5e363344f8b01f959394", + "version": 9, + "timestamp": 1575594030000 + }, + "witness_signature": "192eadd1f1ae870d0e7464a72829307e5b214e1e3be16e03f223d264acf9c2f715b4b647e836c62cb88a428752b225aa8f3c6d9c85696c8f06635091b1c1982600" + } + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbynum.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbynum.md new file mode 100644 index 0000000..a0db9bd --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getblockbynum.md @@ -0,0 +1,86 @@ +# getblockbynum + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize Tatum SDK for TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +// Get the block by number +const block = await tatum.rpc.getBlockByNum(200) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBlockByNum` method returns the block object corresponding to the block height specified (the number of blocks preceding it). This could be useful for retrieving specific block data or for validating transactions within a certain block. + +{% embed url="https://codepen.io/tatum-devrel/pen/GRwLzPK" %} + +### Parameters + +* `num` (integer): The height of the block to retrieve. + +### Return Object + +The method returns a promise that resolves to a block object with the following fields: + +* +* `blockID` (string): The block hash. +* `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). +* `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```json +{ + "num":200 +} +``` + +### HTTP Response Example + +```json +{ + "blockID": "00000000000000c86d2473411771f83db5e314c01bc8f8cf0dc2f8892be6fd7f", + "block_header": { + "raw_data": { + "number": 200, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41f16412b9a17ee9408646e2a21e16478f72ed1e95", + "parentHash": "00000000000000c7d4d47132f21fd0b74e2f8bcb0c2e9130f7cab35b5d38af9f", + "version": 9, + "timestamp": 1575594618000 + }, + "witness_signature": "97ecda5b130600d18304e02f7fd5ab9d115c5ec9c0e312c8c6fe83939771bb85505fafee598541dc902b1a7b8ca2735c83a12e640203ed4b8529d47ce4f413df00" + } +} +``` + +*** diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getburntrx.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getburntrx.md new file mode 100644 index 0000000..e292125 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getburntrx.md @@ -0,0 +1,53 @@ +# getburntrx + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum'; + +const tatum = await TatumSDK.init({network: Network.TRON}); + +const res = await tatum.rpc.getBurnTRX(); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getBurnTRX()` RPC method allows to query the amount of TRX burned due to on-chain transaction fees since the No. 54 Committee Proposal took effect. + +Before the No. 54 Committee Proposal takes effect, the destruction of transaction fees is completed by transferring to the black hole address TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy. After the No. 54 committee proposal takes effect, it will no longer be transferred to the black hole address, but will be directly recorded in the node database. + +Use cases of this method include monitoring the total amount of TRX burned due to transaction fees, which can be useful for data analysis and transparency purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/VwVNgOO" %} + +### Parameters + +The `getBurnTRX()` RPC method does not require any parameters. + +### Return Object + +* `burnTrxAmount`: This is the amount of TRX burned due to on-chain transaction fees. The amount is returned in sun (1 TRX = 1,000,000 sun). + +### HTTP Request Example + +```bash +{} +``` + +### HTTP Response Example + +```json +{ + "burnTrxAmount": 200 +} +``` + +Note that the `burnTrxAmount` is returned as an integer in sun. + +*** diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getchainparameters.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getchainparameters.md new file mode 100644 index 0000000..177c393 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getchainparameters.md @@ -0,0 +1,289 @@ +# getchainparameters + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const chainParameters = await tatum.rpc.getChainParameters() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getChainParameters` method retrieves all parameters that the blockchain committee can set. This method is useful for getting detailed information about the blockchain's configurable parameters. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGEMej" %} + +### Parameters + +This method doesn't require any parameters. + +### Return Object + +The return object is an array of ChainParameters objects. Each ChainParameters object contains the following parameters: + +* `chainParameter (array)` + * `key` (string): The parameter name. + * `value` (integer): The parameter value. + +### HTTP Request Example + +```curl +{] +``` + +### HTTP Response Example + +```json +{ + "chainParameter": [ + { + "key": "getMaintenanceTimeInterval", + "value": 600000 + }, + { + "key": "getAccountUpgradeCost", + "value": 9999000000 + }, + { + "key": "getCreateAccountFee", + "value": 100000 + }, + { + "key": "getTransactionFee", + "value": 1000 + }, + { + "key": "getAssetIssueFee", + "value": 1024000000 + }, + { + "key": "getWitnessPayPerBlock", + "value": 100000000000 + }, + { + "key": "getWitnessStandbyAllowance", + "value": 100000000 + }, + { + "key": "getCreateNewAccountFeeInSystemContract", + "value": 1000000 + }, + { + "key": "getCreateNewAccountBandwidthRate", + "value": 1 + }, + { + "key": "getAllowCreationOfContracts", + "value": 1 + }, + { + "key": "getRemoveThePowerOfTheGr", + "value": -1 + }, + { + "key": "getEnergyFee", + "value": 420 + }, + { + "key": "getExchangeCreateFee", + "value": 1024000000 + }, + { + "key": "getMaxCpuTimeOfOneTx", + "value": 120 + }, + { + "key": "getAllowUpdateAccountName" + }, + { + "key": "getAllowSameTokenName", + "value": 1 + }, + { + "key": "getAllowDelegateResource", + "value": 1 + }, + { + "key": "getTotalEnergyLimit", + "value": 50000000000 + }, + { + "key": "getAllowTvmTransferTrc10", + "value": 1 + }, + { + "key": "getTotalEnergyCurrentLimit", + "value": 50000000000000 + }, + { + "key": "getAllowMultiSign", + "value": 1 + }, + { + "key": "getAllowAdaptiveEnergy", + "value": 1 + }, + { + "key": "getTotalEnergyTargetLimit", + "value": 3472222 + }, + { + "key": "getTotalEnergyAverageUsage", + "value": 8384 + }, + { + "key": "getUpdateAccountPermissionFee", + "value": 100000000 + }, + { + "key": "getMultiSignFee", + "value": 1000000 + }, + { + "key": "getAllowAccountStateRoot" + }, + { + "key": "getAllowProtoFilterNum" + }, + { + "key": "getAllowTvmConstantinople", + "value": 1 + }, + { + "key": "getAllowTvmSolidity059", + "value": 1 + }, + { + "key": "getAllowTvmIstanbul", + "value": 1 + }, + { + "key": "getAllowShieldedTRC20Transaction", + "value": 1 + }, + { + "key": "getForbidTransferToContract" + }, + { + "key": "getAdaptiveResourceLimitTargetRatio", + "value": 10 + }, + { + "key": "getAdaptiveResourceLimitMultiplier", + "value": 1000 + }, + { + "key": "getChangeDelegation", + "value": 1 + }, + { + "key": "getWitness127PayPerBlock", + "value": 10000000 + }, + { + "key": "getAllowMarketTransaction" + }, + { + "key": "getMarketSellFee" + }, + { + "key": "getMarketCancelFee" + }, + { + "key": "getAllowPBFT" + }, + { + "key": "getAllowTransactionFeePool" + }, + { + "key": "getMaxFeeLimit", + "value": 15000000000 + }, + { + "key": "getAllowOptimizeBlackHole", + "value": 1 + }, + { + "key": "getAllowNewResourceModel" + }, + { + "key": "getAllowTvmFreeze" + }, + { + "key": "getAllowTvmVote", + "value": 1 + }, + { + "key": "getAllowTvmLondon", + "value": 1 + }, + { + "key": "getAllowTvmCompatibleEvm" + }, + { + "key": "getAllowAccountAssetOptimization" + }, + { + "key": "getFreeNetLimit", + "value": 1500 + }, + { + "key": "getTotalNetLimit", + "value": 43200000000 + }, + { + "key": "getAllowHigherLimitForMaxCpuTimeOfOneTx", + "value": 1 + }, + { + "key": "getAllowAssetOptimization", + "value": 1 + }, + { + "key": "getAllowNewReward", + "value": 1 + }, + { + "key": "getMemoFee", + "value": 1000000 + }, + { + "key": "getAllowDelegateOptimization", + "value": 1 + }, + { + "key": "getUnfreezeDelayDays", + "value": 14 + }, + { + "key": "getAllowOptimizedReturnValueOfChainId", + "value": 1 + }, + { + "key": "getAllowDynamicEnergy", + "value": 1 + }, + { + "key": "getDynamicEnergyThreshold", + "value": 3000000000 + }, + { + "key": "getDynamicEnergyIncreaseFactor", + "value": 2000 + }, + { + "key": "getDynamicEnergyMaxFactor", + "value": 12000 + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getenergyprices.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getenergyprices.md new file mode 100644 index 0000000..3319196 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getenergyprices.md @@ -0,0 +1,47 @@ +# getenergyprices + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum'; + +const tatum = await TatumSDK.init({network: Network.TRON}); + +const res = await tatum.rpc.getEnergyPrices(); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getEnergyPrices` method is used to query historical energy unit price on the TRON network. The energy unit price is the cost of performing operations on the TRON network, measured in "sun" units. The historical data can be useful in various situations like estimating future energy costs based on historical data or analysing network activity over time. + +{% embed url="https://codepen.io/tatum-devrel/pen/KKrYJLm" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +* `prices` - string: All historical energy unit price information. Each unit price change is separated by a comma. Before the colon is the millisecond timestamp, and after the colon is the energy unit price in sun. + +### HTTP Request Example + +```bash +{} +``` + +### HTTP Response Example + +```json +{ + "prices": "1614227200000:15,1614313600000:20,1614400000000:25" +} +``` + +In this example response, three price changes are listed: on the timestamp `1614227200000`, the price was `15` sun; on `1614313600000`, the price changed to `20` sun; and on `1614400000000`, the price was `25` sun. diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnodeinfo.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnodeinfo.md new file mode 100644 index 0000000..1bda91b --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnodeinfo.md @@ -0,0 +1,279 @@ +# getnodeinfo + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const nodeInfo = await tatum.rpc.getNodeInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getNodeInfo` method is used to query information about the current state of the TRON node. This includes details about the latest block information, the number of active and passive connections, the total TCP flow, and other vital node details. This information is critical for monitoring the health and status of the TRON network. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQwgwQ" %} + +### Parameters + +This method doesn't require any parameters. + +### Return Object + +* `beginSyncNum` (integer): The begin sync block number. +* `block` (string): The latest block information, including block height and block id. +* `solidityBlock` (string): The latest solidified block information, including block height and block id. +* `currentConnectCount` (integer): The current connect count. +* `activeConnectCount` (integer): Active node connection count. +* `passiveConnectCount` (integer): Passive node connection count. +* `totalFlow` (integer): Total TCP flow. +* `peerInfoList` (PeerInfo\[]): Peer node information. +* `configNodeInfo` (ConfigNodeInfo): Node configuration information. +* `machineInfo` (MachineInfo): The information of the machine where the node is located. +* `cheatWitnessInfoMap` (map\): SR information that may be suspected of cheating. + +### HTTP Request Example + +```curl +{} +``` + +### HTTP Response Example + +```json +{ + "activeConnectCount": 2, + "beginSyncNum": 33868394, + "block": "Num:33868413,ID:000000000204ca7d21eec047b7bd9659e633f27eabe7133aa8ae1f35c7800835", + "cheatWitnessInfoMap": {}, + "configNodeInfo": { + "activeNodeSize": 2, + "allowAdaptiveEnergy": 1, + "allowCreationOfContracts": 1, + "backupListenPort": 10001, + "backupMemberSize": 0, + "backupPriority": 6, + "codeVersion": "4.7.1.1", + "dbVersion": 2, + "discoverEnable": true, + "listenPort": 16666, + "maxConnectCount": 30, + "maxTimeRatio": 5, + "minParticipationRate": 0, + "minTimeRatio": 0, + "p2pVersion": "1", + "passiveNodeSize": 2, + "sameIpMaxConnectCount": 2, + "sendNodeSize": 3, + "supportConstant": true, + "versionNum": "17686" + }, + "currentConnectCount": 5, + "machineInfo": { + "cpuCount": 4, + "cpuRate": 0.012658227848101266, + "deadLockThreadCount": 0, + "deadLockThreadInfoList": [], + "freeMemory": 391487488, + "javaVersion": "1.8.0_291", + "jvmFreeMemory": 11439582784, + "jvmTotalMemory": 12850036736, + "memoryDescInfoList": [ + { + "initSize": 2555904, + "maxSize": 268435456, + "name": "Code Cache", + "useRate": 0.2647867202758789, + "useSize": 71078144 + }, + { + "initSize": 0, + "maxSize": -1, + "name": "Metaspace", + "useRate": 0.9261336443443698, + "useSize": 78023544 + }, + { + "initSize": 0, + "maxSize": 1073741824, + "name": "Compressed Class Space", + "useRate": 0.007893860340118408, + "useSize": 8475968 + }, + { + "initSize": 68222976, + "maxSize": 279183360, + "name": "Par Eden Space", + "useRate": 0.13357790378337736, + "useSize": 37292728 + }, + { + "initSize": 8519680, + "maxSize": 34865152, + "name": "Par Survivor Space", + "useRate": 0.16272110329534775, + "useSize": 5673296 + }, + { + "initSize": 170590208, + "maxSize": 12535988224, + "name": "CMS Old Gen", + "useRate": 0.10908497228658533, + "useSize": 1367487928 + } + ], + "osName": "Linux 3.10.0-1160.49.1.el7.x86_64", + "processCpuRate": 0.012658227848101266, + "threadCount": 185, + "totalMemory": 16260251648 + }, + "passiveConnectCount": 3, + "peerList": [ + { + "active": true, + "avgLatency": 0, + "blockInPorcSize": 0, + "connectTime": 1681960376733, + "disconnectTimes": 0, + "headBlockTimeWeBothHave": 0, + "headBlockWeBothHave": "Num:33868390,ID:000000000204ca664c3e79e480b435591d53e0bcd7d8697a0b11e51ece052e84", + "host": "/54.186.12.211", + "inFlow": 0, + "lastBlockUpdateTime": 1684738920033, + "lastSyncBlock": "", + "localDisconnectReason": "", + "needSyncFromPeer": false, + "needSyncFromUs": false, + "nodeCount": 4, + "nodeId": "2e278e5e01e48a4da86d0ee547447917cbf08433fdb438e22cf0f2362d09ee33412a7f035e53931efed83f22e72b705044384db2a09e59885310574d06b33f8d", + "port": 16666, + "remainNum": 0, + "remoteDisconnectReason": "", + "score": 0, + "syncBlockRequestedSize": 0, + "syncFlag": false, + "syncToFetchSize": 0, + "syncToFetchSizePeekNum": -1, + "unFetchSynNum": 0 + }, + { + "active": true, + "avgLatency": 0, + "blockInPorcSize": 0, + "connectTime": 1681960358724, + "disconnectTimes": 0, + "headBlockTimeWeBothHave": 0, + "headBlockWeBothHave": "Num:33824159,ID:0000000002041d9f47331f314d2e124dde87180cae606f005d8c26023a1c2e21", + "host": "/54.69.254.172", + "inFlow": 0, + "lastBlockUpdateTime": 1684588047076, + "lastSyncBlock": "Num:33217176,ID:0000000001fada9882d944c94f79b01305e0bfdc43536fc9530eecc16ae1ac49", + "localDisconnectReason": "", + "needSyncFromPeer": false, + "needSyncFromUs": false, + "nodeCount": 4, + "nodeId": "2e278e5e01e48a4da86d0ee547447917cbf08433fdb438e22cf0f2362d09ee33412a7f035e53931efed83f22e72b705044384db2a09e59885310574d06b33f8d", + "port": 16666, + "remainNum": 0, + "remoteDisconnectReason": "", + "score": 0, + "syncBlockRequestedSize": 0, + "syncFlag": false, + "syncToFetchSize": 0, + "syncToFetchSizePeekNum": -1, + "unFetchSynNum": 0 + }, + { + "active": false, + "avgLatency": 0, + "blockInPorcSize": 0, + "connectTime": 1682772783216, + "disconnectTimes": 0, + "headBlockTimeWeBothHave": 0, + "headBlockWeBothHave": "Num:33868413,ID:000000000204ca7d21eec047b7bd9659e633f27eabe7133aa8ae1f35c7800835", + "host": "/54.69.105.245", + "inFlow": 0, + "lastBlockUpdateTime": 1684738998026, + "lastSyncBlock": "Num:33524301,ID:0000000001ff8a4dd686ace89310555cacfdaa929ea24de2bff34369fce82a64", + "localDisconnectReason": "", + "needSyncFromPeer": false, + "needSyncFromUs": false, + "nodeCount": 4, + "nodeId": "2e278e5e01e48a4da86d0ee547447917cbf08433fdb438e22cf0f2362d09ee33412a7f035e53931efed83f22e72b705044384db2a09e59885310574d06b33f8d", + "port": 16666, + "remainNum": 0, + "remoteDisconnectReason": "", + "score": 0, + "syncBlockRequestedSize": 0, + "syncFlag": false, + "syncToFetchSize": 0, + "syncToFetchSizePeekNum": -1, + "unFetchSynNum": 0 + }, + { + "active": false, + "avgLatency": 71, + "blockInPorcSize": 0, + "connectTime": 1681961633946, + "disconnectTimes": 0, + "headBlockTimeWeBothHave": 0, + "headBlockWeBothHave": "Num:33868413,ID:000000000204ca7d21eec047b7bd9659e633f27eabe7133aa8ae1f35c7800835", + "host": "/47.90.207.227", + "inFlow": 0, + "lastBlockUpdateTime": 1684738998108, + "lastSyncBlock": "Num:33156658,ID:0000000001f9ee326f10e9b927216b5459579e57b781b9f6702a4d76e205ef7b", + "localDisconnectReason": "", + "needSyncFromPeer": false, + "needSyncFromUs": false, + "nodeCount": 4, + "nodeId": "2e278e5e01e48a4da86d0ee547447917cbf08433fdb438e22cf0f2362d09ee33412a7f035e53931efed83f22e72b705044384db2a09e59885310574d06b33f8d", + "port": 16666, + "remainNum": 0, + "remoteDisconnectReason": "", + "score": 0, + "syncBlockRequestedSize": 0, + "syncFlag": false, + "syncToFetchSize": 0, + "syncToFetchSizePeekNum": -1, + "unFetchSynNum": 0 + }, + { + "active": false, + "avgLatency": 75, + "blockInPorcSize": 0, + "connectTime": 1682398959068, + "disconnectTimes": 1, + "headBlockTimeWeBothHave": 0, + "headBlockWeBothHave": "Num:33868050,ID:000000000204c91264aedf926cd8f53e9d67ec2e1ccf6d0da98fbf3ab12ed27f", + "host": "/47.89.186.34", + "inFlow": 0, + "lastBlockUpdateTime": 1684737768295, + "lastSyncBlock": "", + "localDisconnectReason": "", + "needSyncFromPeer": false, + "needSyncFromUs": false, + "nodeCount": 4, + "nodeId": "2e278e5e01e48a4da86d0ee547447917cbf08433fdb438e22cf0f2362d09ee33412a7f035e53931efed83f22e72b705044384db2a09e59885310574d06b33f8d", + "port": 16666, + "remainNum": 0, + "remoteDisconnectReason": "TIME_OUT", + "score": 0, + "syncBlockRequestedSize": 0, + "syncFlag": false, + "syncToFetchSize": 0, + "syncToFetchSizePeekNum": -1, + "unFetchSynNum": 0 + } + ], + "solidityBlock": "Num:33868395,ID:000000000204ca6bce66b0a2b5694dffbb37eb2ff3f83040457f4c88115c0ee3", + "totalFlow": 0 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnowblock.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnowblock.md new file mode 100644 index 0000000..cfcc62d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/getnowblock.md @@ -0,0 +1,79 @@ +# getnowblock + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum'; + +const tatum = await TatumSDK.init({ network: Network.TRON }); + +const res = await tatum.rpc.getNowBlock(); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getNowBlock()` method is used to query the latest block information on the TRON network. It interacts with the TRON RPC to fetch the data, making it a crucial function for applications needing real-time information about the TRON blockchain. Examples of such applications include blockchain explorers, cryptocurrency wallets, or decentralised applications. + +{% embed url="https://codepen.io/tatum-devrel/pen/GRwLzzK" %} + +### Parameters + +This method doesn't require any parameters. + +### Return Object + +* `blockID` (string): The block hash. +* `block_header` (object) + * `raw_data` (object) + * `timestamp` (integer): The timestamp of the block. + * `txTrieRoot` (string): The root of the transaction merkle tree. + * `parentHash` (string): The parent block hash. + * `number` (integer): The block number. + * `witness_id` (integer): The witness id. + * `witness_address` (string): The witness address. + * `version` (integer): The version. + * `accountStateRoot` (string): The root of the account state tree. + * `witness_signature` (string): The signature of the Super Representative (SR). +* `transactions` (Array): Contains transaction information in the block. + * `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```bash +{} +``` + +### HTTP Response Example + +The HTTP response for the `getNowBlock()` function is a JSON object representing the latest block data. The exact fields can vary due to the dynamic nature of the blockchain data. Here is an example of how the HTTP response could look like: + +```json +{ + "blockID": "000000000203c44fb29c8b78d653607e5b7c210a9b415c0daa1f84f00c8fa9af", + "block_header": { + "raw_data": { + "number": 33801295, + "txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000", + "witness_address": "41977f82c69011cf4a7db6f7339edcded85c614d45", + "parentHash": "000000000203c44e82ebe5332248e40efa68a5243458dc398628b1ce05db0d36", + "version": 27, + "timestamp": 1684510050000 + }, + "witness_signature": "05cd4c14889dc39a0465fc6c769fb6c39f986c90cfe0ef8cbf4be6402f7b25b613b97c4c7ee2e411b908d53658752102a7292a4965002609a50e075f171c151e01" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactionbyid.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactionbyid.md new file mode 100644 index 0000000..4c51a99 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactionbyid.md @@ -0,0 +1,93 @@ +# gettransactionbyid + +### How to Use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const transaction = await tatum.rpc.getTransactionById('7c2d4206c03a883dd9066d620335dc1be272a8dc733cfa3f6d10308faa37facc', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTransactionById` method is used to query transaction information using a transaction ID on the TRON network. This can be beneficial in several use cases, such as retrieving details about a specific transaction, verifying the transaction status, and checking the transaction content. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQZNOG" %} + +### Parameters + +* `value` (string): ID of the transaction to be queried. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Whether the address is in base58 format. + +### Return Object + +The method returns a Promise resolving to a Transaction object containing: + + + +* `raw_data.contract` - The main content of the transaction, contract is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +### HTTP Request Example + +```json +{ + "value": "0x94eea63bb6774c1565a5a5adc37cc8b73bb5292c63f7829231e195314d338b98", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "ret": [ + { + "contractRet": "SUCCESS" + } + ], + "signature": [ + "90f1b82fecfef333afc338d243bfd7e6506fc400f5cbb74034d2eff58ba04d520b5d12ab34f8dfd4d29e999ca1f86184670df41e0aa6131b38e52289acb6499000" + ], + "txID": "7c2d4206c03a883dd9066d620335dc1be272a8dc733cfa3f6d10308faa37facc", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "amount": 2000000, + "owner_address": "TMmYhZ5XyjWwkPSLizzMoqyQLVrwqDdH5Y", + "to_address": "TEouV6gdGqZvFDde6dDKHBJgbVFV2NW48T" + }, + "type_url": "type.googleapis.com/protocol.TransferContract" + }, + "type": "TransferContract" + } + ], + "ref_block_bytes": "b663", + "ref_block_hash": "fb1feb948ee9fff2", + "expiration": 1681403964000, + "fee_limit": 500000, + "timestamp": 1681368025716 + }, + "raw_data_hex": "0a02b6632208fb1feb948ee9fff240e0d4f1dbf7305a67080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541816cf60987aa124eed29db9a057e476861b8d8dc1215413516435fb1e706c51efff614c7e14ce2625f28e51880897a70f494e0caf7309001a0c21e" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyblocknum.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyblocknum.md new file mode 100644 index 0000000..475cafd --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyblocknum.md @@ -0,0 +1,338 @@ +# gettransactioninfobyblocknum + +### How to use it + +You can use the `getTransactionInfoByBlockNum` method with Tatum SDK by following the below example: + +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Tron, Network } from '@@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Tron>({network: Network.TRON})
+
+const transactionInfo = await tatum.rpc.getTransactionInfoByBlockNum(1000000)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+ +Replace `1000000` with the actual block height that you want to get information about. + +### Overview + +The `getTransactionInfoByBlockNum` method allows you to query the TransactionInfo data of all transactions contained in the block of a specified height. This can be particularly useful when you need to track the status of all transactions within a particular block or analyse the transactions for auditing purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/dyQLarr" %} + +### Parameters + +The `getTransactionInfoByBlockNum` method requires the following parameter: + +* `num`: The block height you want to get transaction information about. It should be an integer. + +### Return Object + +Array of: + +* `id`: The transaction ID (string) +* `fee`: The total number of TRX burned in this transaction, represented as an integer. +* `blockNumber`: The block number (integer) +* `blockTimeStamp`: The block timestamp, in milliseconds (integer) +* `contractResult`: Transaction execution results (string array) +* `contract_address`: Contract address (string) +* `receipt`: Transaction receipt, including transaction execution result and transaction fee details. It contains the following fields: + * `energy_usage`: The amount of energy consumed in the caller's account + * `energy_fee`: The amount of TRX burned to pay for energy + * `origin_energy_usage`: The amount of energy consumed in the contract deployer's account + * `energy_usage_total`: The total amount of energy consumed by the transaction + * `net_usage`: The amount of bandwidth consumed + * `net_fee`: The amount of TRX burned to pay for the bandwidth + * `result`: Transaction execution result + * `energy_penalty_total`: The amount of extra energy that needs to be paid for calling a few popular contracts +* `log`: The log of events triggered during the smart contract call. +* `result`: Execution results. If the execution is successful, the field will not be displayed in the returned value, if the execution fails, the field will be "FAILED" +* `resMessage`: When the transaction execution fails, the details of the failure will be returned through this field. Hex format, you can convert it to a string to get plaintext information. +* `withdraw_amount`: For the withdrawal reward transaction, unfreeze transaction, they will withdraw the vote reward to account. The number of rewards withdrawn to the account is returned through this field, and the unit is sun. +* `unfreeze_amount`: In the Stake1.0 stage, for unstaking transactions, this field returns the amount of unstaked TRX, the unit is sun. +* `internal_transactions`: Internal transaction +* `withdraw_expire_amount`: In the Stake2.0 stage, for unstaking transactions and withdrawing unfrozen balance transactions, this field returns the amount of unfrozen TRX withdrawn to the account in this transaction, the unit is sun. + +### HTTP Request Example + +```json +{ + "num": 1000000 +} +``` + +### HTTP Response Example + +```json +[ + { + "log": [ + { + "address": "7090190c41ba59f763e2cbe7d885e007e94be5d2", + "data": "000000000000000000000000000000000000000000000000000000051f5e04fa0000000000000000000000000000000000000000000000000000000004a9681c0000000000000000000000000000000000000000000000000000000004a8fe4001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000", + "topics": [ + "baca790fd027b9b7f36b90c3084718a3a039693cdf83844342f5f1edc839c3af" + ] + } + ], + "blockNumber": 1000000, + "contractResult": [ + "" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "energy_usage": 124980, + "energy_usage_total": 124980, + "net_usage": 668 + }, + "id": "7faabd22623eb53467d34b2a417262f6df75433566c104b6c6eec5a227090df6", + "contract_address": "417090190c41ba59f763e2cbe7d885e007e94be5d2" + }, + { + "log": [ + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "0000000000000000000000000000000000000000000000000000000001c890cf00000000000000000000000000000000000000000000000000000000000000150000000000000000000000000000000000000000000000000000000000000002", + "topics": [ + "50b0fde04a05002ee4ba3c03973059b7d8af741148bf53ff213e39d2867a7930", + "000000000000000000000000ed2f4270fa5a7cae1efd4706ae27a4335406921e" + ] + }, + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "0000000000000000000000000000000000000000000000000000000001cef96f", + "topics": [ + "6a965f98da6f13a2ccafa10fd99074eb59617607c5c8153ceded5713e33c2cc1" + ] + }, + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000d59f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000000", + "topics": [ + "df1b2fae932fd98400d3d19f3d68900102b199899050d106565310ffd640c594", + "000000000000000000000000ed2f4270fa5a7cae1efd4706ae27a4335406921e" + ] + } + ], + "fee": 433850, + "blockNumber": 1000000, + "contractResult": [ + "0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000001cef96f00000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000000" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "energy_fee": 433850, + "energy_usage_total": 43385, + "net_usage": 384 + }, + "id": "98d0f4149bf8023a9df4d2b754f6c728a5b6d021c4497c6cd5452b97f01b0548", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "internal_transactions": [ + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "callValueInfo": [ + {} + ], + "hash": "ef89ade61942aa3371a3f006e6406fd4758ef648ee38c04f70a57b296668d3ed" + }, + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "413a5bfb715d2086ec513b64e98531e2f58154c44c", + "callValueInfo": [ + { + "callValue": 700000 + } + ], + "hash": "a630ff6999c4762637d5cecf109c55e225064bd11afcbb1ae301fbaa21cf3a78" + } + ] + }, + { + "log": [ + { + "address": "79c23a5666042e40420d6afdc1541e3926205eba", + "data": "000000000000000000000000000000000000000000000000000000051f5e04fa", + "topics": [ + "678ae61fcbde3426947a5076f2541a6705fa78577e819a420c826e9c722ff792" + ] + } + ], + "blockNumber": 1000000, + "contractResult": [ + "" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "energy_usage": 28643, + "energy_usage_total": 28643, + "net_usage": 346 + }, + "id": "17e7321320bb08c40f027cbcca320152c2396c77a910f387849a944ee8aa0cb1", + "contract_address": "4179c23a5666042e40420d6afdc1541e3926205eba", + "internal_transactions": [ + { + "caller_address": "4179c23a5666042e40420d6afdc1541e3926205eba", + "note": "63616c6c", + "transferTo_address": "4179c23a5666042e40420d6afdc1541e3926205eba", + "callValueInfo": [ + {} + ], + "hash": "60b85ea10861cd2352f34de84fe72792fa9f02165f215f4432a54b152a30eb8e" + } + ] + }, + { + "log": [ + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "0000000000000000000000000000000000000000000000000000000001cef96f00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001", + "topics": [ + "50b0fde04a05002ee4ba3c03973059b7d8af741148bf53ff213e39d2867a7930", + "000000000000000000000000f07e117a4b5f1fda66f8fcedf44065f1dafc5ad7" + ] + }, + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000007622eb8000000000000000000000000000000000000000000000000000000000a9aba44200000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000000", + "topics": [ + "df1b2fae932fd98400d3d19f3d68900102b199899050d106565310ffd640c594", + "000000000000000000000000f07e117a4b5f1fda66f8fcedf44065f1dafc5ad7" + ] + } + ], + "fee": 376380, + "blockNumber": 1000000, + "contractResult": [ + "0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000a9aba4420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000001cef96f000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000000" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "energy_fee": 376380, + "energy_usage_total": 37638, + "net_usage": 385 + }, + "id": "4ef51a5760bf98dc2dd752658f48db1445e8ca75f8a6efe14d5a462a15edd3f0", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "internal_transactions": [ + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "callValueInfo": [ + {} + ], + "hash": "ebd48b28e91e23a0f190b2ef898c6c89d0723759eb17ceb9203fcd6a4b0b313e" + }, + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "callValueInfo": [ + {} + ], + "hash": "4369d49d09a1d17cbff6a3c69e3bcd081f4c1d10fc176cab53371908e03819f1" + }, + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "41f07e117a4b5f1fda66f8fcedf44065f1dafc5ad7", + "callValueInfo": [ + { + "callValue": 2457950000 + } + ], + "hash": "b31eeb5d614133be49ff5be526d8bd258583b478c5daad9713b68591141b5f10" + } + ] + }, + { + "log": [ + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "0000000000000000000000000000000000000000000000000000000001cef96f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000002", + "topics": [ + "50b0fde04a05002ee4ba3c03973059b7d8af741148bf53ff213e39d2867a7930", + "0000000000000000000000009ac63dd8e80daf0a786bf962860e2209b7fa5fb9" + ] + }, + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "0000000000000000000000000000000000000000000000000000000001d4027f", + "topics": [ + "6a965f98da6f13a2ccafa10fd99074eb59617607c5c8153ceded5713e33c2cc1" + ] + }, + { + "address": "8d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "data": "000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000a7d8c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000", + "topics": [ + "df1b2fae932fd98400d3d19f3d68900102b199899050d106565310ffd640c594", + "0000000000000000000000009ac63dd8e80daf0a786bf962860e2209b7fa5fb9" + ] + } + ], + "fee": 433850, + "blockNumber": 1000000, + "contractResult": [ + "0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000001d4027f00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "energy_fee": 433850, + "energy_usage_total": 43385, + "net_usage": 384 + }, + "id": "80e07e3f2b92a0e9974b1398964e006288836dee82aa3a81e579a512e6581354", + "contract_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "internal_transactions": [ + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "callValueInfo": [ + {} + ], + "hash": "3e32e3a6ef17975e8d2ac842a520cef987bf9d93d7c2538857b06d1c792da36e" + }, + { + "caller_address": "418d9dd663cf90256fdf2faba2a1be71f8a0147f8c", + "note": "63616c6c", + "transferTo_address": "413a5bfb715d2086ec513b64e98531e2f58154c44c", + "callValueInfo": [ + { + "callValue": 550000 + } + ], + "hash": "bc9897f79e4eaa5f795626b853a29baacb132283f5d0e6f94c0462894683cf9b" + } + ] + }, + { + "fee": 3130, + "blockNumber": 1000000, + "contractResult": [ + "" + ], + "blockTimeStamp": 1578594852000, + "receipt": { + "result": "SUCCESS", + "net_fee": 3130, + "energy_usage": 328466, + "energy_usage_total": 328466 + }, + "id": "ba8e727c03d588619310d7a16a95fcfd31a516dbf8893ddd585e0bbd7e0deae4", + "contract_address": "41174e91a57d68f5ac1bc485d03a038fe745a3b89b" + } +] +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyid.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyid.md new file mode 100644 index 0000000..caf887d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/gettransactioninfobyid.md @@ -0,0 +1,77 @@ +# gettransactioninfobyid + +How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const transactionInfo = await tatum.rpc.getTransactionInfoById('7c2d4206c03a883dd9066d920335dc1be272a8dc733cfa3f6d10308faa37facc') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getTransactionInfoById` method allows you to query the transaction fee, block height, and other related information by a transaction id. This can be particularly useful when you need to track the status of specific transactions or analyse the transactions for auditing purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyQOGE" %} + +### Parameters + +* `value`: The transaction hash, or transaction ID, you want to get information about. It should be a string. + +### Return Object + +* `id`: The transaction ID (string) +* `fee`: The total number of TRX burned in this transaction, represented as an integer. +* `blockNumber`: The block number (integer) +* `blockTimeStamp`: The block timestamp, in milliseconds (integer) +* `contractResult`: Transaction execution results (string array) +* `contract_address`: Contract address (string) +* `receipt`: Transaction receipt, including transaction execution result and transaction fee details. It contains the following fields: + * `energy_usage`: The amount of energy consumed in the caller's account + * `energy_fee`: The amount of TRX burned to pay for energy + * `origin_energy_usage`: The amount of energy consumed in the contract deployer's account + * `energy_usage_total`: The total amount of energy consumed by the transaction + * `net_usage`: The amount of bandwidth consumed + * `net_fee`: The amount of TRX burned to pay for the bandwidth + * `result`: Transaction execution result + * `energy_penalty_total`: The amount of extra energy that needs to be paid for calling a few popular contracts +* `log`: The log of events triggered during the smart contract call. +* `result`: Execution results. If the execution is successful, the field will not be displayed in the returned value, if the execution fails, the field will be "FAILED" +* `resMessage`: When the transaction execution fails, the details of the failure will be returned through this field. Hex format, you can convert it to a string to get plaintext information. +* `withdraw_amount`: For the withdrawal reward transaction, unfreeze transaction, they will withdraw the vote reward to account. The number of rewards withdrawn to the account is returned through this field, and the unit is sun. +* `unfreeze_amount`: In the Stake1.0 stage, for unstaking transactions, this field returns the amount of unstaked TRX, the unit is sun. +* `internal_transactions`: Internal transaction +* `withdraw_expire_amount`: In the Stake2.0 stage, for unstaking transactions and withdrawing unfrozen balance transactions, this field returns the amount of unfrozen TRX withdrawn to the account in this transaction, the unit is sun. + +### HTTP Request Example + +```json +{ + "value": "0x94eea63bb6774c1565a5a5adc37cc8b73bb5292c63f7829231e195314d338b98", +} +``` + +### HTTP Response Example + +```json +{ + "id": "7c2d4206c03a883dd9066d620335dc1be272a8dc733cfa3f6d10308faa37facc", + "fee": 1100000, + "blockNumber": 32880248, + "blockTimeStamp": 1681368027000, + "contractResult": [ + "" + ], + "receipt": { + "net_fee": 100000 + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/listnodes.md b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/listnodes.md new file mode 100644 index 0000000..e201646 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-query-the-network-methods/listnodes.md @@ -0,0 +1,76 @@ +# listnodes + +### How to Use It + +You can interact with the TRON blockchain by using the `listNodes` method in the Tatum SDK. Here's an example: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// Import necessary components from the SDK +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({ network: Network.TRON }) + +// Use the RPC method +const nodeList = await tatum.rpc.listNodes() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `listNodes` method is an RPC method provided by the TRON blockchain. It returns a list of nodes connected to the TRON network, including their host addresses and ports. This information can be used for various purposes, such as network analysis, node performance assessment, or setting up a new node connection. + +{% embed url="https://codepen.io/tatum-devrel/pen/WNYWPWo" %} + +### Parameters + +The `listNodes` method does not accept any parameters. + +### Return Object + +* `nodes` (array) + * `address` (object) + * `host` (string): The host address of the node. + * `port` (integer): The port number of the node. + +### HTTP Request Example + +```bash +{} +``` + +### HTTP Response Example + +```json +{ + "nodes": [ + { + "address": { + "host": "34372e38392e3138362e3334", + "port": 16666 + } + }, + { + "address": { + "host": "35322e31312e34322e3439", + "port": 16666 + } + }, + { + "address": { + "host": "34372e39302e3230372e323237", + "port": 16666 + } + }, + { + "address": { + "host": "34372e39302e3230362e313439", + "port": 16666 + } + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/README.md new file mode 100644 index 0000000..bef9cd1 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/README.md @@ -0,0 +1,2 @@ +# API calls for smart contract methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/clearabi.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/clearabi.md new file mode 100644 index 0000000..5d3b7c5 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/clearabi.md @@ -0,0 +1,85 @@ +# clearabi + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleOption } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.clearAbi('TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW', 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `clearAbi` method allows clearing the ABI (Application Binary Interface) information of a smart contract on the TRON blockchain. This operation is often used when there is a need to remove outdated or incorrect ABI information from a smart contract. + +### Parameters + +* `ownerAddress` (string): The account address that owns the smart contract. It can be in base58check format if visible is true; otherwise, it should be in hex format. +* `contractAddress` (string): The address of the smart contract. It can be in base58check format if visible is true; otherwise, it should be in hex format. +* `options` (object, optional): This is an optional parameter that can include: + * `visible` (boolean, optional): Specifies whether the address is in base58 format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `ClearABIContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` - Account address. +* `contract_address` - Contract address. + +### HTTP Request Example + +```json +{ + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "0841733f1141ecd4f932551a26db7b7a4c8077e95bfa78d28ab806d85a3114b1", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs" + }, + "type_url": "type.googleapis.com/protocol.ClearABIContract" + }, + "type": "ClearABIContract" + } + ], + "ref_block_bytes": "ee6c", + "ref_block_hash": "1819e770abbc2e4c", + "expiration": 1684770510000, + "timestamp": 1684770452476 + }, + "raw_data_hex": "0a02ee6c22081819e770abbc2e4c40b0a997a184315a630830125f0a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e436c656172414249436f6e7472616374122e0a1541b3dcf27c251da9363f1a4888257c16676cf54edf12154142a1e39aefa49290f2b3f9ed688d7cecf86cd6e070fce793a18431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/deploycontract.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/deploycontract.md new file mode 100644 index 0000000..3e8cf04 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/deploycontract.md @@ -0,0 +1,137 @@ +# deploycontract + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const abi = [{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]" +const bytecode = "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029" +const ownerAddress = "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh" +const name = "SomeContract" + +const res = await tatum.rpc.deployContract( + abi, + bytecode, + ownerAddress, + name, + { visible: true } +); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + + + +### Overview + +The `deployContract` method is used to deploy a smart contract to the TRON blockchain. This method takes the application binary interface (ABI) and bytecode of the contract, among other parameters, and returns an unsigned transaction that must be signed and sent to the blockchain to deploy the contract. + +### Parameters + +* `abi`(string): The application binary interface (ABI) of the smart contract. +* `bytecode`(string): The bytecode of the smart contract. +* `feeLimit`(BigNumber): The maximum TRX consumption, measured in SUN (1 TRX = 1,000,000 SUN). +* `parameter`(string): Parameter passed to the constructor of the contract. +* `originEnergyLimit`(BigNumber): The max energy that will be consumed by the owner during contract execution or creation. +* `ownerAddress`(string): The contract owner's address in hexadecimal format. +* `name`(string): The name of the smart contract. +* `callValue`(BigNumber): The amount of TRX transferred with this transaction, measured in SUN. +* `consumeUserResourcePercent`(integer): The percentage of resources designated for users who use this contract. Accepts integers between 0 and 100. +* `options` (optional): Additional options: + * `visible` (boolean, optional): Specifies whether the address is in base58 format. Default: false. + * `permission_id` (number, optional): The permission ID for multi-signature use. + +### Return Object + +* `txID`: String - The transaction ID. +* `raw_data`: Object - The raw data of the transaction, including the contract details. +* `signature`: Array - An array containing the signatures of the transaction. + +### HTTP Request Example + +```json +{ + "abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", + "bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029", + "owner_address": "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh", + "name": "SomeContract", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "8e6c61ec8d6eee3685ddfde892f6d78609b30cd969f6c96ae13904dd9125afa7", + "contract_address": "41a7444de2b88e2d7a383d1a8c8d3c5c02b2939d61", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh", + "new_contract": { + "bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029", + "name": "SomeContract", + "origin_address": "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh", + "abi": { + "entrys": [ + { + "inputs": [ + { + "name": "key", + "type": "uint256" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "set", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "name": "value", + "type": "uint256" + } + ], + "constant": true, + "inputs": [ + { + "name": "key", + "type": "uint256" + } + ], + "name": "get", + "stateMutability": "View", + "type": "Function" + } + ] + } + } + }, + "type_url": "type.googleapis.com/protocol.CreateSmartContract" + }, + "type": "CreateSmartContract" + } + ], + "ref_block_bytes": "e881", + "ref_block_hash": "f0d4c62907d3ad78", + "expiration": 1684765344000, + "timestamp": 1684765286344 + }, + "raw_data_hex": "0a02e8812208f0d4c62907d3ad78408082dc9e84315ad703081e12d2030a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e437265617465536d617274436f6e7472616374129d030a1541608f8da72479edc7dd921e4c30bb7e7cddbe722e1283030a1541608f8da72479edc7dd921e4c30bb7e7cddbe722e1a5c0a2b1a03736574220e12036b65791a0775696e743235362210120576616c75651a0775696e74323536300240030a2d10011a03676574220e12036b65791a0775696e743235362a10120576616c75651a0775696e743235363002400222fd01608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b250400293a0c536f6d65436f6e747261637470c8bfd89e8431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/estimateenergy.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/estimateenergy.md new file mode 100644 index 0000000..16f83f0 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/estimateenergy.md @@ -0,0 +1,69 @@ +# estimateenergy + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.estimateEnergy( + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', + 'balanceOf(address)', + '000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c', + { visible: true } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `estimateEnergy` method is used to estimate the energy required for the successful execution of smart contract transactions on the TRON blockchain. It can be used to get a more accurate estimation of the energy consumption for executing certain special contracts compared to the existing `wallet/triggerconstantcontract` API. + +This method does not generate an on-chain transaction, nor does it change the status of the current node. The `energy_required` field in the returned value is the estimated energy amount. + +### Parameters + +* `ownerAddress` (string): The owner address that triggers the contract. If `visible=true`, use base58check format, otherwise use hex format. For a constant call, you can use the all-zero address. +* `contractAddress` (string): The smart contract address. If `visible=true`, use base58check format, otherwise use hex format. +* `functionSelector` (string): The function call. It must not be left blank. +* `parameter` (string): The parameter encoding needs to be in accordance with the ABI rules. +* `options` (object, optional): This is an optional parameter that can include: + * `visible` (boolean, optional): Specifies whether the address is in base58 format. + +### Return Object + +* `result: object` - The run result. + * `result` - Indicates if the estimate is successful. + * `code` - The response code. + * `message` - The result message. +* `energy_required` - The estimated energy to run the contract. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "function_selector": "balanceOf(address)", + "parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "result": { + "result": true + }, + "energy_required": 1082 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontract.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontract.md new file mode 100644 index 0000000..dd2dc38 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontract.md @@ -0,0 +1,303 @@ +# getcontract + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getContract('TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', { + visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getContract` method allows you to query a contract's information from the TRON blockchain. This includes the bytecode of the contract, ABI, configuration parameters, and more. This can be useful in a variety of use-cases such as contract verification, auditing, and debugging. + +{% embed url="https://codepen.io/Night-Shift-Dev/pen/wvQaBNR" %} + +### Parameters + +* `value` (string): The contract address, as a string. +* `options` (optional): Additional options. + * `visible` (boolean, optional): Whether the address is in visible format(base58check) or hex. + +### Return Object + +The method returns an object with the following properties: + +* `origin_address` (string): Contract creator address. +* `contract_address` (string): Contract address. +* `abi` (ABI): ABI of the contract. +* `bytecode` (string): Bytecode of the contract. +* `call_value` (integer): The amount of TRX passed into the contract when deploying the contract. +* `consume_user_resource_percent` (integer): Proportion of user energy consumption. +* `name` (string): Contract name. +* `origin_energy_limit` (integer): Each transaction is allowed to consume the maximum energy of the contract creator, the unit is sun. +* `code_hash` (string): Code hash of the contract. + +### HTTP Request Example + +```json +{ + "value": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "bytecode": "608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50604080518082018252600b81526a2a32ba3432b92a37b5b2b760a91b6020808301918252835180850190945260048452631554d11560e21b90840152815191929160069161007c9160039190610236565b508151610090906004906020850190610236565b506005805460ff191660ff92909216919091179055506100cc9050336100b46100d1565b60ff16600a0a6402540be400026100db60201b60201c565b6102ce565b60055460ff165b90565b6001600160a01b038216610136576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61014f816002546101d560201b61078c1790919060201c565b6002556001600160a01b0382166000908152602081815260409091205461017f91839061078c6101d5821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008282018381101561022f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061027757805160ff19168380011785556102a4565b828001600101855582156102a4579182015b828111156102a4578251825591602001919060010190610289565b506102b09291506102b4565b5090565b6100d891905b808211156102b057600081556001016102ba565b6108ad806102dd6000396000f3fe608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50600436106100b35760003560e01c806306fdde03146100b8578063095ea7b31461013557806318160ddd1461017557806323b872dd1461018f578063313ce567146101c557806339509351146101e357806370a082311461020f57806395d89b4114610235578063a457c2d71461023d578063a9059cbb14610269578063dd62ed3e14610295575b600080fd5b6100c06102c3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fa5781810151838201526020016100e2565b50505050905090810190601f1680156101275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101616004803603604081101561014b57600080fd5b506001600160a01b038135169060200135610359565b604080519115158252519081900360200190f35b61017d61036f565b60408051918252519081900360200190f35b610161600480360360608110156101a557600080fd5b506001600160a01b03813581169160208101359091169060400135610375565b6101cd6103cc565b6040805160ff9092168252519081900360200190f35b610161600480360360408110156101f957600080fd5b506001600160a01b0381351690602001356103d5565b61017d6004803603602081101561022557600080fd5b50356001600160a01b0316610411565b6100c061042c565b6101616004803603604081101561025357600080fd5b506001600160a01b03813516906020013561048d565b6101616004803603604081101561027f57600080fd5b506001600160a01b0381351690602001356104c9565b61017d600480360360408110156102ab57600080fd5b506001600160a01b03813581169160200135166104d6565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b5050505050905090565b6000610366338484610501565b50600192915050565b60025490565b60006103828484846105ed565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546103c29186916103bd908663ffffffff61072f16565b610501565b5060019392505050565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61078c16565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61072f16565b60006103663384846105ed565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105465760405162461bcd60e51b81526004018080602001828103825260248152602001806108566024913960400191505060405180910390fd5b6001600160a01b03821661058b5760405162461bcd60e51b815260040180806020018281038252602281526020018061080f6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106325760405162461bcd60e51b81526004018080602001828103825260258152602001806108316025913960400191505060405180910390fd5b6001600160a01b0382166106775760405162461bcd60e51b81526004018080602001828103825260238152602001806107ec6023913960400191505060405180910390fd5b6001600160a01b0383166000908152602081905260409020546106a0908263ffffffff61072f16565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546106d5908263ffffffff61078c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610786576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156107e4576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26474726f6e58205ad8bd992125d73612e695872f74ea2d6951c0410b7633d79c611eec48000cf864736f6c63430005120031", + "name": "Token", + "origin_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "abi": { + "entrys": [ + { + "stateMutability": "Nonpayable", + "type": "Constructor" + }, + { + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "Event" + }, + { + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "Event" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint8" + } + ], + "constant": true, + "name": "decimals", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "string" + } + ], + "constant": true, + "name": "name", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "string" + } + ], + "constant": true, + "name": "symbol", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "name": "totalSupply", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "stateMutability": "Nonpayable", + "type": "Function" + } + ] + }, + "origin_energy_limit": 10000000, + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "code_hash": "5933c5f6804befa730c18e6bf1b14393d9e062b466c2a772f81a6bfa932a8d46" +} +``` + +*** diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontractinfo.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontractinfo.md new file mode 100644 index 0000000..16a5050 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/getcontractinfo.md @@ -0,0 +1,313 @@ +# getcontractinfo + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getContractInfo('TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getContractInfo` method allows you to query a contract's information from the blockchain. This interface returns not only the bytecode but also the runtime bytecode of the contract. Unlike bytecode, runtime bytecode does not contain constructor and constructor parameter information. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQoXOM" %} + +### Parameters + +* `value`: (string) The contract address, converted to a hex string. +* `options` (optional): Additional options for the transaction. + * `visible`: (boolean, optional) Whether the address is in visible format (base58check) or hex. + +### Return Object + +The `getContractInfo` method returns an object containing the following fields: + +* `runtimecode`: (String) The contract's runtime code. +* `smart_contract`: (SmartContract) A smart contract object. + * `origin_address` (string): Contract creator address. + * `contract_address` (string): Contract address. + * `abi` (ABI): ABI of the contract. + * `bytecode` (string): Bytecode of the contract. + * `call_value` (integer): The amount of TRX passed into the contract when deploying the contract. + * `consume_user_resource_percent` (integer): Proportion of user energy consumption. + * `name` (string): Contract name. + * `origin_energy_limit` (integer): Each transaction is allowed to consume the maximum energy of the contract creator, the unit is sun. + * `code_hash` (string): Code hash of the contract. +* `contract_state`: (ContractState) The contract's state, which includes: + * `contract_state.energy_usage`: (Integer) The total amount of basic energy usage of the contract in the current maintenance cycle. + * `contract_state.energy_factor`: (Integer) The contract's energy factor. + * `contract_state.update_cycle`: (Integer) The current maintenance cycle number. + +### HTTP Request Example + +```json +{ + "value": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "runtimecode": "608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50600436106100b35760003560e01c806306fdde03146100b8578063095ea7b31461013557806318160ddd1461017557806323b872dd1461018f578063313ce567146101c557806339509351146101e357806370a082311461020f57806395d89b4114610235578063a457c2d71461023d578063a9059cbb14610269578063dd62ed3e14610295575b600080fd5b6100c06102c3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fa5781810151838201526020016100e2565b50505050905090810190601f1680156101275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101616004803603604081101561014b57600080fd5b506001600160a01b038135169060200135610359565b604080519115158252519081900360200190f35b61017d61036f565b60408051918252519081900360200190f35b610161600480360360608110156101a557600080fd5b506001600160a01b03813581169160208101359091169060400135610375565b6101cd6103cc565b6040805160ff9092168252519081900360200190f35b610161600480360360408110156101f957600080fd5b506001600160a01b0381351690602001356103d5565b61017d6004803603602081101561022557600080fd5b50356001600160a01b0316610411565b6100c061042c565b6101616004803603604081101561025357600080fd5b506001600160a01b03813516906020013561048d565b6101616004803603604081101561027f57600080fd5b506001600160a01b0381351690602001356104c9565b61017d600480360360408110156102ab57600080fd5b506001600160a01b03813581169160200135166104d6565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b5050505050905090565b6000610366338484610501565b50600192915050565b60025490565b60006103828484846105ed565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546103c29186916103bd908663ffffffff61072f16565b610501565b5060019392505050565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61078c16565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61072f16565b60006103663384846105ed565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105465760405162461bcd60e51b81526004018080602001828103825260248152602001806108566024913960400191505060405180910390fd5b6001600160a01b03821661058b5760405162461bcd60e51b815260040180806020018281038252602281526020018061080f6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106325760405162461bcd60e51b81526004018080602001828103825260258152602001806108316025913960400191505060405180910390fd5b6001600160a01b0382166106775760405162461bcd60e51b81526004018080602001828103825260238152602001806107ec6023913960400191505060405180910390fd5b6001600160a01b0383166000908152602081905260409020546106a0908263ffffffff61072f16565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546106d5908263ffffffff61078c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610786576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156107e4576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26474726f6e58205ad8bd992125d73612e695872f74ea2d6951c0410b7633d79c611eec48000cf864736f6c63430005120031", + "smart_contract": { + "bytecode": "608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50604080518082018252600b81526a2a32ba3432b92a37b5b2b760a91b6020808301918252835180850190945260048452631554d11560e21b90840152815191929160069161007c9160039190610236565b508151610090906004906020850190610236565b506005805460ff191660ff92909216919091179055506100cc9050336100b46100d1565b60ff16600a0a6402540be400026100db60201b60201c565b6102ce565b60055460ff165b90565b6001600160a01b038216610136576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61014f816002546101d560201b61078c1790919060201c565b6002556001600160a01b0382166000908152602081815260409091205461017f91839061078c6101d5821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008282018381101561022f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061027757805160ff19168380011785556102a4565b828001600101855582156102a4579182015b828111156102a4578251825591602001919060010190610289565b506102b09291506102b4565b5090565b6100d891905b808211156102b057600081556001016102ba565b6108ad806102dd6000396000f3fe608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50600436106100b35760003560e01c806306fdde03146100b8578063095ea7b31461013557806318160ddd1461017557806323b872dd1461018f578063313ce567146101c557806339509351146101e357806370a082311461020f57806395d89b4114610235578063a457c2d71461023d578063a9059cbb14610269578063dd62ed3e14610295575b600080fd5b6100c06102c3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fa5781810151838201526020016100e2565b50505050905090810190601f1680156101275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101616004803603604081101561014b57600080fd5b506001600160a01b038135169060200135610359565b604080519115158252519081900360200190f35b61017d61036f565b60408051918252519081900360200190f35b610161600480360360608110156101a557600080fd5b506001600160a01b03813581169160208101359091169060400135610375565b6101cd6103cc565b6040805160ff9092168252519081900360200190f35b610161600480360360408110156101f957600080fd5b506001600160a01b0381351690602001356103d5565b61017d6004803603602081101561022557600080fd5b50356001600160a01b0316610411565b6100c061042c565b6101616004803603604081101561025357600080fd5b506001600160a01b03813516906020013561048d565b6101616004803603604081101561027f57600080fd5b506001600160a01b0381351690602001356104c9565b61017d600480360360408110156102ab57600080fd5b506001600160a01b03813581169160200135166104d6565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b5050505050905090565b6000610366338484610501565b50600192915050565b60025490565b60006103828484846105ed565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546103c29186916103bd908663ffffffff61072f16565b610501565b5060019392505050565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61078c16565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034f5780601f106103245761010080835404028352916020019161034f565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103669185906103bd908663ffffffff61072f16565b60006103663384846105ed565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105465760405162461bcd60e51b81526004018080602001828103825260248152602001806108566024913960400191505060405180910390fd5b6001600160a01b03821661058b5760405162461bcd60e51b815260040180806020018281038252602281526020018061080f6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106325760405162461bcd60e51b81526004018080602001828103825260258152602001806108316025913960400191505060405180910390fd5b6001600160a01b0382166106775760405162461bcd60e51b81526004018080602001828103825260238152602001806107ec6023913960400191505060405180910390fd5b6001600160a01b0383166000908152602081905260409020546106a0908263ffffffff61072f16565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546106d5908263ffffffff61078c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610786576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156107e4576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26474726f6e58205ad8bd992125d73612e695872f74ea2d6951c0410b7633d79c611eec48000cf864736f6c63430005120031", + "name": "Token", + "origin_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "abi": { + "entrys": [ + { + "stateMutability": "Nonpayable", + "type": "Constructor" + }, + { + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "Event" + }, + { + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "Event" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint8" + } + ], + "constant": true, + "name": "decimals", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "string" + } + ], + "constant": true, + "name": "name", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "string" + } + ], + "constant": true, + "name": "symbol", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "uint256" + } + ], + "constant": true, + "name": "totalSupply", + "stateMutability": "View", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "stateMutability": "Nonpayable", + "type": "Function" + }, + { + "outputs": [ + { + "type": "bool" + } + ], + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "stateMutability": "Nonpayable", + "type": "Function" + } + ] + }, + "origin_energy_limit": 10000000, + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "code_hash": "5933c5f6804befa730c18e6bf1b14393d9e062b466c2a772f81a6bfa932a8d46" + }, + "contract_state": { + "update_cycle": 146215 + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggerconstantcontract.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggerconstantcontract.md new file mode 100644 index 0000000..7b33e65 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggerconstantcontract.md @@ -0,0 +1,112 @@ +# triggerconstantcontract + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.triggerConstantContract( + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', + 'balanceOf(address)', + '000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c', + { + visible: true, + } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `triggerConstantContract` method is used to interact with smart contracts on the TRON blockchain. It allows you to invoke either readonly (view or pure) or non-readonly functions of a contract for contract data queries or estimating energy consumption. Notably, this operation does not generate an on-chain transaction and does not change the status of the current node. + +### Parameters + +* `ownerAddress` (string): The owner's address that triggers the contract. Use base58check format if visible=true, otherwise use hex format. +* `contractAddress` (string): The smart contract address. Use base58check format if visible=true, otherwise use hex format. +* `functionSelector` (string): The function call; must not be left blank. +* `parameter` (string): The parameter encoding must be in accordance with the ABI rules. +* `options` (object, optional): Optional settings for the contract trigger, including: + * `callValue` (integer, optional): The amount of TRX transferred to the contract with this transaction, in sun. This field may be used when estimating energy consumption. + * `visible` (boolean, optional): Optional. Whether the address is in base58 format. + +### Return Object + +* `result` + * `result` - When error ocuurs, this is empty, otherwise true. + * `code` - Error code. + * `message -` Error message. +* `energy_used` (integer): The estimated energy consumption. +* `constant_result` (array of strings): The result list of triggered functions. +* `transaction`: Transaction information. For details, refer to GetTransactionByID. + * `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "function_selector": "balanceOf(address)", + "parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "result": { + "result": true + }, + "energy_used": 541, + "constant_result": [ + "00000000000000000000000000000000000000000000000000000000000186a0" + ], + "transaction": { + "ret": [ + {} + ], + "visible": true, + "txID": "342791a4015feba921cea6e7c3e3d5ba4d1ede50f3508a686e643709b14abce2", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "70a08231000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "e80d", + "ref_block_hash": "7547cc93d09e65de", + "expiration": 1684764945000, + "timestamp": 1684764885358 + }, + "raw_data_hex": "0a02e80d22087547cc93d09e65de40e8d4c39e84315a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12154142a1e39aefa49290f2b3f9ed688d7cecf86cd6e0222470a08231000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c70ee82c09e8431" + } +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggersmartcontract.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggersmartcontract.md new file mode 100644 index 0000000..7c98e75 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/triggersmartcontract.md @@ -0,0 +1,123 @@ +# triggersmartcontract + +### How to Use It + +Here is an example of how you can use the `triggerSmartContract` method with the Tatum SDK. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const options = { + feeLimit: 1000000000, + callValue: 0, +} + +const result = await tatum.rpc.triggerSmartContract( + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', + 'transfer(address,uint256)', + '00000000000000000000004115208EF33A926919ED270E2FA61367B2DA3753DA0000000000000000000000000000000000000000000000000000000000000032', + options +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `triggerSmartContract` method is used to call a smart contract function on the TRON network. The function parameters are encoded according to the ABI rules and the method returns an unsigned transaction, ready to be signed and broadcasted to the network. This method can be used for interacting with deployed smart contracts and triggering their functions. + +### Parameters + +* `ownerAddress`(string): Account address triggering the contract, converted to a hex string. +* `contractAddress`(string): Smart contract address, converted to a hex string. +* `functionSelector`(string): Function call from the smart contract. Must not be left blank. +* `parameter`(string): Function parameters, encoded according to the ABI rules. +* `options`: (object, optional): Additional options for the contract triggering. + * `feeLimit`(integer, optional): Maximum TRX consumption, measured in SUN (1 TRX = 1,000,000 SUN). + * `callValue`(integer, optional): Amount of TRX transferred with this transaction, measured in SUN. + * `permission_id`(integer, optional): For multi-signature. + * `visible`(boolean, optional): Whether the address is in base58check format. + +### Return Object + +* `result` + * `result` - When error ocuurs, this is empty, otherwise true. + * `code` - Error code. + * `message -` Error message. +* `transaction` + * `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). + * `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. + * `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. + * `raw_data.data` - Transaction memo. + * `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. + * `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. + * `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. + * `txID` - transaction id + +Since the transaction type is `TriggerSmartContract`, the fields contained in `transaction.raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: string. Account address. +* `contract_address`: string. Contract address. +* `call_value`: integer. The amount of TRX passed into the contract. +* `data`: string. Operating parameters. +* `call_token_value`: integer. The amount of TRC-10 transferred into the contract. +* `token_id`: integer. TRC-10 token id. + +### HTTP Request Example + +Here is an example of an HTTP request to trigger a smart contract: + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "function_selector": "transfer(address,uint256)", + "parameter": "00000000000000000000004115208EF33A926919ED270E2FA61367B2DA3753DA0000000000000000000000000000000000000000000000000000000000000032", + "fee_limit": 1000000000, + "call_value": 0, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "result": { + "result": true + }, + "transaction": { + "visible": true, + "txID": "27318af0aca1e748919c9f28a40c66776d468d06ec936cad1f56130df7704db7", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "data": "a9059cbb00000000000000000000004115208ef33a926919ed270e2fa61367b2da3753da0000000000000000000000000000000000000000000000000000000000000032", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs" + }, + "type_url": "type.googleapis.com/protocol.TriggerSmartContract" + }, + "type": "TriggerSmartContract" + } + ], + "ref_block_bytes": "e70f", + "ref_block_hash": "bde2c956cedbf2ae", + "expiration": 1684764078000, + "fee_limit": 1000000000, + "timestamp": 1684764019325 + }, + "raw_data_hex": "0a02e70f2208bde2c956cedbf2ae40b0df8e9e84315aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12154142a1e39aefa49290f2b3f9ed688d7cecf86cd6e02244a9059cbb00000000000000000000004115208ef33a926919ed270e2fa61367b2da3753da000000000000000000000000000000000000000000000000000000000000003270fd948b9e843190018094ebdc03" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updateenergylimit.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updateenergylimit.md new file mode 100644 index 0000000..cca4ba1 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updateenergylimit.md @@ -0,0 +1,99 @@ +# updateenergylimit + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.updateEnergyLimit('TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW', 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', 100000000, { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +`updateEnergyLimit` is a TRON RPC method used to update the `origin_energy_limit` parameter of a smart contract. The `origin_energy_limit` is a required parameter for deploying new contracts with a value larger than 0. + +Use cases: + +* Deploying new smart contracts +* Updating the energy limit for existing smart contracts + +### Parameters + +* `ownerAddress` (string): Account address of the transaction creator, in hex string format. +* `contractAddress` (string): Address of the contract to be modified, in hex string format. +* `originEnergyLimit` (integer): The maximum energy set by the creator. This refers to the greatest amount of energy the creator consumes during contract execution or creation process. +* `options` (object, optional): Additional options. + * `visible` (boolean, optional): Specifies if the address is in base58 format. + * `permission_id` (integer, optional): Used for multi-signature. + +### Return Object + + + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `UpdateEnergyLimitContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Account address. +* `contract_address` (string): Contract address. +* `origin_energy_limit` (string): Adjusted upper limit of energy provided by smart contract deployers in one transaction. + +### HTTP Request Example + +```json +{ + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "origin_energy_limit": 100000000, + "visible": true +} +``` + +### HTTP Response Example + +A successful response will return a `200` status code. + +```json +{ + "visible": true, + "txID": "158a188799ab507e9a4a5d673250c5e1b3ab3f8722ae9778be87c3087fc36453", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "origin_energy_limit": 100000000, + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs" + }, + "type_url": "type.googleapis.com/protocol.UpdateEnergyLimitContract" + }, + "type": "UpdateEnergyLimitContract" + } + ], + "ref_block_bytes": "ee2f", + "ref_block_hash": "f408ae3f40e49e07", + "expiration": 1684770300000, + "timestamp": 1684770243112 + }, + "raw_data_hex": "0a02ee2f2208f408ae3f40e49e0740e0c08aa184315a71082d126d0a36747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e557064617465456e657267794c696d6974436f6e747261637412330a1541b3dcf27c251da9363f1a4888257c16676cf54edf12154142a1e39aefa49290f2b3f9ed688d7cecf86cd6e01880c2d72f70a88487a18431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updatesetting.md b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updatesetting.md new file mode 100644 index 0000000..3b81e28 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-smart-contract-methods/updatesetting.md @@ -0,0 +1,97 @@ +# updatesetting + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, VisibleAndPermissionIdOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const ownerAddress = 'TSNEe5Tf4rnc9zPMNXfaTFKHSANinZseWnPcX' +const contractAddress = 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs' +const consumeUserResourcePercent = 10 +const options: VisibleAndPermissionIdOptions = { + visible: true, +} + +const res = await tatum.rpc.updateSetting(ownerAddress, contractAddress, consumeUserResourcePercent, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `updateSetting` method is used to update the `consume_user_resource_percent` parameter of a smart contract on the TRON blockchain. This setting controls how much of a user's resource balance is consumed when they interact with the contract. + +### Parameters + +The following parameters are required for the `updateSetting` method: + +* `ownerAddress` (string): Account address. Transaction creator's address, in hex string format. +* `contractAddress` (string): Contract address. The address of the contract to be modified, in hex string format. +* `consumeUserResourcePercent` (integer): User Energy Proportion. Consume user's resource percentage. It should be an integer between \[0, 100]. if 0, means it does not consume user's resource until the developer's resource has been used up. +* `options` (optional): Additional options + * `visible` (boolean, optional): Whether the address is in base58 format. + * `permission_id` (integer, optional): For multi-signature use. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `UpdateSettingContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Account address. +* `contract_address` (string): Contract address. +* `consume_user_resource_percent` (integer): User energy proportion. + +### HTTP Request Example + +```json +{ + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTFKHSANinZseWnPcX", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", + "consume_user_resource_percent": 10, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "1bdf05c55b6034743aef2a02906b3a1bfd98832bf0dc35caa96ccf701de972a0", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "consume_user_resource_percent": 10, + "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW", + "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs" + }, + "type_url": "type.googleapis.com/protocol.UpdateSettingContract" + }, + "type": "UpdateSettingContract" + } + ], + "ref_block_bytes": "ea5d", + "ref_block_hash": "049f1eb82a28ee3d", + "expiration": 1684766970000, + "timestamp": 1684766911523 + }, + "raw_data_hex": "0a02ea5d2208049f1eb82a28ee3d4090a1bf9f84315a6a082112660a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e55706461746553657474696e67436f6e747261637412300a1541b3dcf27c251da9363f1a4888257c16676cf54edf12154142a1e39aefa49290f2b3f9ed688d7cecf86cd6e0180a70a3d8bb9f8431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/README.md new file mode 100644 index 0000000..c56abc3 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/README.md @@ -0,0 +1,2 @@ +# API calls for transaction methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasthex.md b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasthex.md new file mode 100644 index 0000000..d45e86e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasthex.md @@ -0,0 +1,71 @@ +# broadcasthex + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js + +import { TatumSDK, Tron, Network } from '@tatumcom/js' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.broadcastHex('transactionHex') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `broadcastHex` method is used to broadcast a signed transaction to the TRON network. This is a crucial step in performing operations on the blockchain, such as transferring TRX tokens or interacting with smart contracts. + +The method requires the signed transaction in hexadecimal format. + +### Parameters + +`transaction` (string): The signed transaction in hexadecimal format. This is a required parameter. + +### Return Object + +The response object contains the following fields: + +`result` (boolean): Whether the broadcast was successful. true - successful; false - failed, and this field will not be displayed in the returned result. + +`txid` (string): The Transaction ID of the broadcasted transaction. + +`code` (string): The error code in case the broadcast fails. + +`message` (string): Detailed error information in case the broadcast fails. + +`transaction` (Transaction): + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +### HTTP Request Example + +```json +{ + "transaction": "0A8A010A0202DB2208C89D4811359A28004098A4E0A6B52D5A730802126F0A32747970652E676F6F676C65617069732E636F6D2F70726F746F636F6C2E5472616E736665724173736574436F6E747261637412390A07313030303030311215415A523B449890854C8FC460AB602DF9F31FE4293F1A15416B0580DA195542DDABE288FEC436C7D5AF769D24206412418BF3F2E492ED443607910EA9EF0A7EF79728DAAAAC0EE2BA6CB87DA38366DF9AC4ADE54B2912C1DEB0EE6666B86A07A6C7DF68F1F9DA171EEE6A370B3CA9CBBB00" +} +``` + +### HTTP Response Example + +```json +{ + "result": false, + "code": "TAPOS_ERROR", + "txid": "38a0482d6d5a7d1439a50b848d68cafa7d904db48b82344f28765067a5773e1d", + "message": "Tapos check error.", + "transaction": "{\"raw_data\": {\"ref_block_bytes\": \"02db\",\"ref_block_hash\": \"c89d4811359a2800\",\"expiration\": 1560496575000,\"contract\": [{\"type\": \"TransferAssetContract\",\"parameter\": {\"type_url\": \"type.googleapis.com/protocol.TransferAssetContract\",\"value\": \"0a07313030303030311215415a523b449890854c8fc460ab602df9f31fe4293f1a15416b0580da195542ddabe288fec436c7d5af769d242064\"}}]},\"signature\": [\"8bf3f2e492ed443607910ea9ef0a7ef79728daaaac0ee2ba6cb87da38366df9ac4ade54b2912c1deb0ee6666b86a07a6c7df68f1f9da171eee6a370b3ca9cbbb00\"]}" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasttransaction.md b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasttransaction.md new file mode 100644 index 0000000..c21b37a --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasttransaction.md @@ -0,0 +1,82 @@ +# broadcasttransaction + +### How to use it + +Below is an example of how to use the `broadcastTransaction` method with the Tatum SDK: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// Install Tatum SDK +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +// Define a transaction raw body +const rawBody = { + // fill out appropriate data +} + +// Call broadcastTransaction RPC method +const res = await tatum.rpc.broadcastTransaction(rawBody); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `broadcastTransaction` method is used to broadcast a raw transaction to the TRON blockchain network. It submits the transaction for inclusion in the blockchain and returns the result of the broadcast attempt, including the transaction id and any error information. + +### Parameters + +This method accepts a single parameter, `rawBody`, which is a `TronTxRawBody` object with the following properties: + +* `txID` (string): Transaction identifier. +* `visible` (boolean): Specifies the visibility of the transaction. It can be set to either true or false. +* `raw_data` (json): Raw data of the transaction. +* `raw_data_hex` (string): Raw data of the transaction in hexadecimal format. +* `signature` (array of strings): Array of signatures for the transaction. + +### Return Object + +This method returns a Promise resolving to an object with the following parameters: + +* `result` (boolean): Indicates whether the broadcast was successful. If the broadcast failed, this field will not be displayed in the returned result. +* `txid` (string): Transaction id. +* `code` (string): Error code, present if the broadcast failed. +* `message` (string): Detailed error information, present if the broadcast failed. + +### HTTP Request Example + +JSON request body example: + +```json +{ + "raw_data": "{\"contract\":[{\"parameter\":{\"value\":{\"amount\":1000,\"owner_address\":\"41608f8da72479edc7dd921e4c30bb7e7cddbe722e\",\"to_address\":\"41e9d79cc47518930bc322d9bf7cddd260a0260a8d\"},\"type_url\":\"type.googleapis.com/protocol.TransferContract\"},\"type\":\"TransferContract\"}],\"ref_block_bytes\":\"5e4b\",\"ref_block_hash\":\"47c9dc89341b300d\",\"expiration\":1591089627000,\"timestamp\":1591089567635}", + "raw_data_hex": "<0a025e4b220847c9dc89341b300d40f8fed3a2a72e5a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412310a1541608f8da72479edc7dd921e4c30bb7e7cddbe722e121541e9d79cc47518930bc322d9bf7cddd260a0260a8d18e8077093afd0a2a72e>" +} +``` + +### HTTP Response Example + +A successful HTTP response returns a JSON body similar to the following example: + +```json +{ + "result": true, + "txid": "77ddfa7093cc5f745c0d3a54abb89ef070f983343c05e0f89e5a52f3e5401299" +} +``` + +In case of an error, the HTTP response returns a JSON body with an error message: + +```json +{ + "code": "SIGERROR", + "txid": "77ddfa7093cc5f745c0d3a54abb89ef070f983343c05e0f89e5a52f3e5401299", + "message": "56616c6964617465207369676e6174757265206572726f723a206d69737320736967206f7220636f6e7472616374" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/createtransaction.md b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/createtransaction.md new file mode 100644 index 0000000..37fe3ca --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-transaction-methods/createtransaction.md @@ -0,0 +1,99 @@ +# createtransaction + +### How to Use + +Example SDK code: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js + +import { TatumSDK, Tron, Network } from '@tatumcom/js' + +const tatum = await TatumSDK.init({ network: Network.TRON }) + +const res = await tatum.rpc.createTransaction('ra5nK24KXen9AHvsdFTKHSANinZseWnPcX', 'rz6oqD16GHJmfRwK2viGm6jEM2r7QqzVvP', 1000, { visible: true }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `createTransaction` method is used to create a TRON transaction. It allows you to transfer TRX (TRON native cryptocurrency) from one address to another. + +Use cases: + +* Transfer TRX from one TRON address to another. + +### Parameters + +* `ownerAddress` (string): The initiator's address for the transaction. +* `toAddress` (string): The destination address for the transaction. +* `amount` (BigNumber): The amount of TRX to transfer, in sun (the smallest unit of TRX, where 1 TRX = 1,000,000 sun). +* `options` (optional): Additional options for the transaction. + * `visible` (boolean, optional): Specifies whether the address is in base58 format. Default: false. + * `permission_id` (number, optional): The permission ID for multi-signature use. + * `extra_data` (string, optional): Additional data for the transaction in HEX format. + +### Return Object + +`transaction` (`TransferContract`): + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `TransferContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Transaction initiator's address. +* `to_address` (string): Destination address. +* `amount` (int64): Transfer amount in sun. + +### HTTP Request Example + +Example of the JSON request body for the HTTP request: + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "amount": 1000, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "094d59ae6c22cb6f206f4b263eec54a1dbfc1d1704d0c43a31d90b8b66ee4fbb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "amount": 1000, + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1" + }, + "type_url": "type.googleapis.com/protocol.TransferContract" + }, + "type": "TransferContract" + } + ], + "ref_block_bytes": "ab93", + "ref_block_hash": "88c6e64972349f0f", + "expiration": 1684488576000, + "timestamp": 1684488517323 + }, + "raw_data_hex": "0a02ab93220888c6e64972349f0f4080b8df9a83315a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412310a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12154198927ffb9f554dc4a453c64b2e553a02d6df514b18e80770cbeddb9a8331" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/README.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/README.md new file mode 100644 index 0000000..fa07e13 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/README.md @@ -0,0 +1,2 @@ +# API calls for TRC10 token methods + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/createassetissue.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/createassetissue.md new file mode 100644 index 0000000..248564d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/createassetissue.md @@ -0,0 +1,160 @@ +# createassetissue + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const options = { + freeAssetNetLimit: 10, + publicFreeAssetNetLimit: 10, + frozenSupply: { + frozen_amount: 1, + frozen_days: 2 + }, + precision: 2, + description: "A new token", +} + +const res = await tatum.rpc.createAssetIssue( + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + 'MyToken', + 'MTK', + 1000000, + 1, + 1, + 1621629260000, + 1621629860000, + 'https://www.mytoken.com', + options +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `createAssetIssue` RPC method allows you to create a new token on the TRON network. You need to specify various parameters like the name, abbreviation, total supply, and more. + +Use cases for this method include creating new tokens for ICOs or for a DeFi project. + +### Parameters + +* `ownerAddress` (string): The address of the issuer. +* `name` (string): The name of the token. +* `abbr` (string): The abbreviation of the token. +* `totalSupply` (integer): The total supply of the token. +* `trxNum` (integer): Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN). +* `num` (integer): Define the price by the ratio of trx\_num/num. +* `startTime` (integer): The ICO start time. +* `endTime` (integer): The ICO end time. +* `url` (string): The official website URL of the token. +* `options` (optional): Additional options for the transaction. + * `freeAssetNetLimit` (integer, optional): Token free asset net limit. + * `publicFreeAssetNetLimit` (integer, optional): Token public free asset net limit. + * `frozenSupply` (object, optional): Object with parameters: + * `frozen_amount` (integer): The number of tokens to be frozen. + * `frozen_days` (integer): The number of days to freeze. + * `precision` (integer, optional): The precision of the token. + * `description` (string, optional): The description of the token. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `AssetIssueContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: Issuer address. +* `name`: Token name. +* `abbr`: Token abbreviation. +* `total_supply`: Total supply of the token. +* `frozen_supply`: The number of tokens to be frozen as specified by the issuer when the token is issued. +* `trx_num`: Defines the price by the ratio of trx\_num/num (The unit of 'trx\_num' is SUN). +* `precision`: Precision of the token value. +* `num`: Defines the price by the ratio of trx\_num/num (The unit of 'trx\_num' is SUN). +* `start_time`: ICO start time. +* `end_time`: ICO end time. +* `description`: Description of the token. +* `url`: Official website URL of the token, default is hexString. +* `free_asset_net_limit`: Token free asset net limit. +* `public_free_asset_net_limit`: Token public free asset net limit for an account. +* `public_free_asset_net_usage`: The total number of token free bandwidth used by all token owners. +* `public_latest_free_net_time`: The timestamp of the last consumption of this token's free bandwidth. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "name": "MyToken", + "abbr": "MTK", + "description": "A new token", + "url": "https://www.mytoken.com", + "frozen_supply": { + "frozen_amount": 1, + "frozen_days": 2 + }, + "visible": true, + "total_supply": 1000000, + "trx_num": 1, + "num": 1, + "start_time": 1621629260000, + "end_time": 1621629860000 +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "1789f68952b601243e09fc851eeed547cc1c9e16b0fc2cb6bf219aa07a1a8a9c", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "start_time": 2684752341111, + "trx_num": 1, + "frozen_supply": [ + { + "frozen_amount": 1, + "frozen_days": 2 + } + ], + "total_supply": 100, + "num": 1, + "name": "asdfasdfadsf", + "end_time": 2684752345111, + "description": "0x4578616d706c654465736372697074696f6e", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "abbr": "asdfsdf", + "url": "0x7777772e6578616d706c652e636f6d" + }, + "type_url": "type.googleapis.com/protocol.AssetIssueContract" + }, + "type": "AssetIssueContract" + } + ], + "ref_block_bytes": "e206", + "ref_block_hash": "034cf77f0ad4956a", + "expiration": 1684759677000, + "timestamp": 1684759617932 + }, + "raw_data_hex": "0a02e2062208034cf77f0ad4956a40c890829c84315acd01080612c8010a2f747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e41737365744973737565436f6e74726163741294010a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e120c6173646661736466616473661a076173646673646620642a04080110023001400148f7d0d6bd914e5097f0d6bd914ea201263078343537383631366437303663363534343635373336333732363937303734363936663665aa01203078373737373737326536353738363136643730366336353265363336663664708cc3fe9b8431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyaccount.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyaccount.md new file mode 100644 index 0000000..45f4bb0 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyaccount.md @@ -0,0 +1,89 @@ +# getassetissuebyaccount + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAssetIssueByAccount('TTzC9cm1vbsyBzhC8n4z3k6eAVkryDyKU8', { +visible: true, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAssetIssueByAccount` method queries the TRC10 token information issued by a specified account. The main use case for this method is to gather information about tokens issued by a certain address on the TRON blockchain. + +### Parameters + +* `address` (string): This is the address of the Token Issuer account. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean, optional): Whether the address is in base58 format. + +### Return Object + +* `assetIssue`: (array) + * `id`: (integer) token ID + * `owner_address`: (string) issuer address + * `name`: (string) token name + * `abbr`: (string) token abbreviation + * `total_supply`: (integer) total supply + * `frozen_supply`: (Array) The number of tokens to be frozen is specified by the issuer of the token when it is issued + * `trx_num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `precision`: (integer) precision + * `num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `start_time`: (integer) ICO start time + * `end_time`: (integer) ICO end time + * `description`: (string) token description + * `url`: (string) Token official website url, default hexString + * `free_asset_net_limit`: (integer) Token free asset net limit + * `public_free_asset_net_limit`: (integer) Token public free asset net limit for a account + * `public_free_asset_net_usage`: (integer) The total number of token free bandwidth used by all token owner + * `public_latest_free_net_time`: (integer) The timestamp of the last consumption of this token's free bandwidth + +### HTTP Request Example + +```json +{ + "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "assetIssue": [ + { + "id": 1, + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "name": "TokenName", + "abbr": "TKN", + "total_supply": 1000000, + "frozen_supply": [], + "trx_num": 1, + "precision": 6, + "num": 1, + "start_time": 1622376000000, + "end_time": 1622462400000, + "description": "This is a test token", + "url": "https://tokenwebsite.com", + "free_asset_net_limit": 5000, + "public_free_asset_net_limit": 10000, + "public_free_asset_net_usage": 0, + "public_latest_free_net_time": 0 + } + ] +} +``` + +*** diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyid.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyid.md new file mode 100644 index 0000000..7cb1902 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyid.md @@ -0,0 +1,76 @@ +# getassetissuebyid + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAssetIssueById(1002357) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +This method is used to query a token by its token id in the TRON blockchain. Since TRON allows for duplicate token names (TRC10 tokens), tokens are identifiable by a unique Token ID. The function `getAssetIssueById` takes this Token ID and returns the token object, which includes the token name. + +### Parameters + +* `value` (string): The address of the TRON account. + +### Return Object + +The function returns a promise that resolves to an object of type `AssetIssueCapsule`. This object contains the following properties: + + + +* `id`: (integer) Token ID. +* `owner_address`: (string) Issuer address. +* `name`: (string) Token name. +* `abbr`: (string) Token abbreviation. +* `total_supply`: (integer) Total supply of tokens. +* `frozen_supply`: (FrozenSupply\[]) The number of tokens to be frozen as specified by the issuer when it was issued. +* `trx_num`: (integer) Defines the price by the ratio of trx\_num/num. The unit of 'trx\_num' is SUN. +* `precision`: (integer) Precision of the token. +* `num`: (integer) Defines the price by the ratio of trx\_num/num. The unit of 'trx\_num' is SUN. +* `start_time`: (integer) ICO start time. +* `end_time`: (integer) ICO end time. +* `description`: (string) Token description. +* `url`: (string) Token's official website URL, default hexString. +* `free_asset_net_limit`: (integer) Token's free asset net limit. +* `public_free_asset_net_limit`: (integer) Token's public free asset net limit for an account. +* `public_free_asset_net_usage`: (integer) The total number of token free bandwidth used by all token owner. +* `public_latest_free_net_time`: (integer) The timestamp of the last consumption of this token's free bandwidth. + +### HTTP Request Example + +```json +{ + "value":1000001 +} +``` + +### HTTP Response Example + +```json +{ + "owner_address": "412e1934759faf93497d6742208e2e521f7043e2ff", + "name": "62747474657374", + "abbr": "62747474657374", + "total_supply": 1000000000000000, + "trx_num": 1000000, + "precision": 6, + "num": 1000000, + "start_time": 1575648000000, + "end_time": 1575734400000, + "description": "62747474657374", + "url": "68747470733a2f2f62746673736f7465722e726561646d652e696f2f646f63732f686f772d746f2d6765742d737461727465642d776974682d736f746572", + "id": "1000001" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyname.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyname.md new file mode 100644 index 0000000..bc01906 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuebyname.md @@ -0,0 +1,77 @@ +# getassetissuebyname + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAssetIssueByName('474d436f696e') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAssetIssueByName` method allows you to query a token by name on the TRON blockchain. This method is useful when you need to get detailed information about a specific token, such as its total supply, issuer address, precision, and other related details. + +### Parameters + +* `name` (string): The TRC 10 token name, default hexString. + +### Return Object + +* `id` (string): Token ID. +* `owner_address` (string): Issuer address. +* `name` (string): Token name. +* `abbr` (string): Token abbreviation. +* `total_supply` (integer): Total supply. +* `frozen_supply` (FrozenSupply\[]): The number of tokens to be frozen is specified by the issuer of the token when it is issued. +* `trx_num` (integer): Define the price by the ratio of trx\_num/num (The unit of 'trx\_num' is SUN). +* `precision` (integer): Precision. +* `num` (integer): Define the price by the ratio of trx\_num/num (The unit of 'trx\_num' is SUN). +* `start_time` (integer): ICO start time. +* `end_time` (integer): ICO end time. +* `description` (string): Token description. +* `url` (string): Token official website URL, default hexString. +* `free_asset_net_limit` (integer): Token free asset net limit. +* `public_free_asset_net_limit` (integer): Token public free asset net limit for an account. +* `public_free_asset_net_usage` (integer): The total number of token free bandwidth used by all token owners. +* `public_latest_free_net_time` (integer): The timestamp of the last consumption of this token's free bandwidth. + +### HTTP Request Example + +```json +{ + "value": "62747474657374" +} +``` + +### HTTP Response Example + +```json +{ + "id": "1000011", + "owner_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", + "name": "62747474657374", + "abbr": "BTTS", + "total_supply": 1000000000000000, + "frozen_supply": [], + "trx_num": 1, + "num": 1, + "precision": 6, + "start_time": 1530894319000, + "end_time": 1533472719000, + "description": "BitTorrent Token", + "url": "https://www.bittorrent.com/", + "free_asset_net_limit": 0, + "public_free_asset_net_limit": 0, + "public_free_asset_net_usage": 0, + "public_latest_free_net_time": 0 +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelist.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelist.md new file mode 100644 index 0000000..7580c92 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelist.md @@ -0,0 +1,94 @@ +# getassetissuelist + +### How to use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAssetIssueList() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAssetIssueList` RPC method allows you to query the list of all the TRC10 tokens on the TRON network. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyQOLq" %} + +### Parameters + +This RPC method doesn't require any parameters. + +### Return Object + +* `assetIssue`: (array) + * `id`: (integer) token ID + * `owner_address`: (string) issuer address + * `name`: (string) token name + * `abbr`: (string) token abbreviation + * `total_supply`: (integer) total supply + * `frozen_supply`: (Array) The number of tokens to be frozen is specified by the issuer of the token when it is issued + * `trx_num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `precision`: (integer) precision + * `num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `start_time`: (integer) ICO start time + * `end_time`: (integer) ICO end time + * `description`: (string) token description + * `url`: (string) Token official website url, default hexString + * `free_asset_net_limit`: (integer) Token free asset net limit + * `public_free_asset_net_limit`: (integer) Token public free asset net limit for a account + * `public_free_asset_net_usage`: (integer) The total number of token free bandwidth used by all token owner + * `public_latest_free_net_time`: (integer) The timestamp of the last consumption of this token's free bandwidth + +### HTTP Request Example + +Below is an example of how to use the `getAssetIssueList` RPC method with a curl HTTP request: + +```shell +curl --request GET \ + --url https://api.tatum.io/v3/blockchain/node/tron-testnet/wallet/getassetissuelist +``` + +### HTTP Response Example + +```json +{ + "assetIssue": [ + { + "owner_address": "412e1934759faf93497d6742208e2e521f7043e2ff", + "name": "62747474657374", + "abbr": "62747474657374", + "total_supply": 1000000000000000, + "trx_num": 1000000, + "precision": 6, + "num": 1000000, + "start_time": 1575648000000, + "end_time": 1575734400000, + "description": "62747474657374", + "url": "68747470733a2f2f62746673736f7465722e726561646d652e696f2f646f63732f686f772d746f2d6765742d737461727465642d776974682d736f746572", + "id": "1000001" + }, + { + "owner_address": "411e260aeff8bd61d42590d256b671c8062926ef20", + "name": "6f756363746f6b656e", + "abbr": "4f554343", + "total_supply": 10000000000, + "trx_num": 1000000, + "num": 1, + "start_time": 1575648000000, + "end_time": 1640275200000, + "description": "74657374", + "url": "687474703a2f2f7777772e62616964752e636f6d", + "id": "1000002" + } + ] +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelistbyname.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelistbyname.md new file mode 100644 index 0000000..bedf41f --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getassetissuelistbyname.md @@ -0,0 +1,76 @@ +# getassetissuelistbyname + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getAssetIssueListByName('62747474657374') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `getAssetIssueListByName` method allows users to query the list of all the TRC10 tokens by a specific name. This can be useful in various scenarios, such as when one needs to quickly identify tokens with a specific name, or for tracking purposes, where knowing the associated tokens can provide valuable insights. + +### Parameters + +* `value` (string): Name of the TRC10 token to be queried. This parameter is required. + +### Return Object + +* `assetIssue`: (array) + * `id`: (integer) token ID + * `owner_address`: (string) issuer address + * `name`: (string) token name + * `abbr`: (string) token abbreviation + * `total_supply`: (integer) total supply + * `frozen_supply`: (Array) The number of tokens to be frozen is specified by the issuer of the token when it is issued + * `trx_num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `precision`: (integer) precision + * `num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `start_time`: (integer) ICO start time + * `end_time`: (integer) ICO end time + * `description`: (string) token description + * `url`: (string) Token official website url, default hexString + * `free_asset_net_limit`: (integer) Token free asset net limit + * `public_free_asset_net_limit`: (integer) Token public free asset net limit for a account + * `public_free_asset_net_usage`: (integer) The total number of token free bandwidth used by all token owner + * `public_latest_free_net_time`: (integer) The timestamp of the last consumption of this token's free bandwidth + +### HTTP Request Example + +```json +{ + "value": "49504653" +} +``` + +### HTTP Response Example + +```json +{ + "assetIssue": [ + { + "owner_address": "41d13433f53fdf88820c2e530da7828ce15d6585cb", + "name": "49504653", + "abbr": "49504653", + "total_supply": 100000000000, + "trx_num": 1000000, + "num": 1, + "start_time": 1529990700000, + "end_time": 1537632000000, + "description": "4950465320636f696e", + "url": "687474703a2f2f", + "id": "1000003" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getpaginatedassetissuelist.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getpaginatedassetissuelist.md new file mode 100644 index 0000000..740e20f --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/getpaginatedassetissuelist.md @@ -0,0 +1,120 @@ +# getpaginatedassetissuelist + +### How to use it + +Use the Tatum SDK to access the TRON network as follows: + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.getPaginatedAssetIssueList(0, 20) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +* `assetIssue`: (array) + * `id`: (integer) token ID + * `owner_address`: (string) issuer address + * `name`: (string) token name + * `abbr`: (string) token abbreviation + * `total_supply`: (integer) total supply + * `frozen_supply`: (Array) The number of tokens to be frozen is specified by the issuer of the token when it is issued + * `trx_num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `precision`: (integer) precision + * `num`: (integer) Define the price by the ratio of trx\_num/num(The unit of 'trx\_num' is SUN) + * `start_time`: (integer) ICO start time + * `end_time`: (integer) ICO end time + * `description`: (string) token description + * `url`: (string) Token official website url, default hexString + * `free_asset_net_limit`: (integer) Token free asset net limit + * `public_free_asset_net_limit`: (integer) Token public free asset net limit for a account + * `public_free_asset_net_usage`: (integer) The total number of token free bandwidth used by all token owner + * `public_latest_free_net_time`: (integer) The timestamp of the last consumption of this token's free bandwidth + +{% embed url="https://codepen.io/tatum-devrel/pen/abQxXea" %} + +### Parameters + +1. `offset` (integer) - The index of the start token. This parameter allows you to specify the starting point in the list of tokens. +2. `limit` (integer) - The amount of tokens per page. This parameter allows you to limit the number of tokens returned in a single request. + +### Return Object + +This method returns a promise that resolves to an array of `AssetIssueCapsule` objects. Each `AssetIssueCapsule` object represents a TRC10 token and includes detailed fields as described in the `GetAssetIssueByAccount` method. + +### HTTP Request Example + +A typical HTTP request using this method looks like this: + +```json +{ + "offset": 0, + "limit": 20 +} +``` + +### HTTP Response Example + +```json +{ + "assetIssue": [ + { + "owner_address": "41f3642e1824d654fed5e71f850fd82d24ed8545ed", + "name": "2e6874616363657373", + "abbr": "74657374", + "total_supply": 1000000000, + "trx_num": 1, + "precision": 6, + "num": 1, + "start_time": 1629878133455, + "end_time": 1629978123454, + "description": "74657374", + "url": "68747470733a2f2f73757065726d61747269782e696f", + "id": "1000942" + }, + { + "owner_address": "411fafb1e96dfe4f609e2259bfaf8c77b60c535b93", + "name": "303734363537333734", + "abbr": "36353738363136643730366336353631363236323732", + "total_supply": 100000000, + "frozen_supply": [ + { + "frozen_amount": 1, + "frozen_days": 2 + } + ], + "trx_num": 1, + "num": 1, + "start_time": 1576684800000, + "end_time": 1576728000000, + "description": "3635373836313664373036633635323036343635373336333732363937303734363936663665", + "url": "373737373737326536353738363136643730366336353265363336663664", + "free_asset_net_limit": 10000, + "public_free_asset_net_limit": 10000, + "id": "1000030" + }, + { + "owner_address": "414f10065476e61054dad85d1c9a32cf429a6bc8cd", + "name": "3077426974636f696e", + "abbr": "57425443", + "total_supply": 100000000000000, + "trx_num": 6000000, + "precision": 4, + "num": 10000, + "start_time": 1609023600000, + "end_time": 1609110000000, + "description": "426974636f696e20546f6b656e", + "url": "68747470733a2f2f7368617374612e74726f6e7363616e2e6f72672f232f", + "id": "1000507" + } + ] +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/participateassetissue.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/participateassetissue.md new file mode 100644 index 0000000..fa47762 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/participateassetissue.md @@ -0,0 +1,111 @@ +# participateassetissue + +### How to use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.participateAssetIssue( + 'TPswDDCAWhJAZG5nEf8TkNToDX1', + 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g', + '1000001031303030303031', + 100000, + { + visible: true, + } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `participateAssetIssue` method allows an account to participate in a token issuance on the TRON blockchain. This participation involves purchasing the issued tokens with TRX, the native currency of TRON. The method returns an unsigned transaction object which contains the details of the ParticipateAssetIssueContract. + +### Parameters + +* `toAddress` (string): The issuer's address. +* `ownerAddress` (string): The account address participating in the token issuance. +* `assetName` (string): The token ID. +* `amount` (integer): The amount of TRX used to purchase the issued token. The unit is in sun. +* `options` (object, optional): Additional options, which include: + * `visible` (boolean, optional): Specifies whether the address is in base58 format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `ParticipateAssetIssueContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` - Account address participating in the token issuance. (Type: string) +* `to_address` - The issuer's address. (Type: string) +* `asset_name` - Token ID. (Type: string) +* `amount` - The amount of TRX used to purchase the issued token. Unit is in sun. (Type: integer + +### HTTP Request Example + +```json +{ + "to_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "asset_name": "1000001031303030303031", + "amount": 100000, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "1789f68952b601243e09fc851eeed547cc1c9e16b0fc2cb6bf219aa07a1a8a9c", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "start_time": 2684752341111, + "trx_num": 1, + "frozen_supply": [ + { + "frozen_amount": 1, + "frozen_days": 2 + } + ], + "total_supply": 100, + "num": 1, + "name": "asdfasdfadsf", + "end_time": 2684752345111, + "description": "0x4578616d706c654465736372697074696f6e", + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "abbr": "asdfsdf", + "url": "0x7777772e6578616d706c652e636f6d" + }, + "type_url": "type.googleapis.com/protocol.ParticipateAssetIssueContract" + }, + "type": "ParticipateAssetIssueContract" + } + ], + "ref_block_bytes": "e206", + "ref_block_hash": "034cf77f0ad4956a", + "expiration": 1684759677000, + "timestamp": 1684759617932 + }, + "raw_data_hex": "0a02e2062208034cf77f0ad4956a40c890829c84315acd01080612c8010a2f747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e41737365744973737565436f6e74726163741294010a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e120c6173646661736466616473661a076173646673646620642a04080110023001400148f7d0d6bd914e5097f0d6bd914ea201263078343537383631366437303663363534343635373336333732363937303734363936663665aa01203078373737373737326536353738363136643730366336353265363336663664708cc3fe9b8431" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/transferasset.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/transferasset.md new file mode 100644 index 0000000..81a7d3b --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/transferasset.md @@ -0,0 +1,104 @@ +# transferasset + +### How to use it + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network, TransferAssetIssueByAccountOptions } from '@tatumio/tatum' +import { BigNumber } from 'bignumber.js'; + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const options: TransferAssetIssueByAccountOptions = { + // optional parameters +}; + +const ownerAddress = "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g"; +const toAddress = "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1"; +const assetName = "31303030303031"; +const amount = new BigNumber(1); + +const res = await tatum.rpc.transferAsset(ownerAddress, toAddress, assetName, amount, options); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `transferAsset` method is used to transfer TRC10 tokens from one address to another on the TRON network. This could be used in a variety of situations, such as transferring tokens to a user's account after they've made a purchase, or redistributing tokens between accounts as part of a dApp's internal logic. + +### Parameters + +* `ownerAddress` (string) - The account address from which the tokens are transferred. +* `toAddress` (string) - The target address to receive the transferred tokens. +* `assetName` (string) - The token ID to transfer. +* `amount` (BigNumber) - The amount of token to transfer. +* `options` (object, optional): This optional parameter contains the following properties: + * `visible` (boolean) - Whether the address is in base58 format. + * `extraData` (string) - Notes on the transaction, HEX format. + +### Return Object + +`transaction` (`TransferContract`): + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `TransferAssetContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Transaction initiator's address. +* `asset_name` (string): The token id to transfer +* `to_address` (string): The target address to transfer +* `amount` (integer): The amount of token to transfer. + +### HTTP Request Example + +```json +{ + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "asset_name": "31303030303031", + "amount": 1, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "094d59ae6c22cb6f206f4b263eec54a1dbfc1d1704d0c43a31d90b8b66ee4fbb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "amount": 1000, + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", + "to_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "asset_name: "62747474657374" + }, + "type_url": "type.googleapis.com/protocol.TransferContract" + }, + "type": "TransferContract" + } + ], + "ref_block_bytes": "ab93", + "ref_block_hash": "88c6e64972349f0f", + "expiration": 1684488576000, + "timestamp": 1684488517323 + }, + "raw_data_hex": "0a02ab93220888c6e64972349f0f4080b8df9a83315a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412310a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12154198927ffb9f554dc4a453c64b2e553a02d6df514b18e80770cbeddb9a8331" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/unfreezeasset.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/unfreezeasset.md new file mode 100644 index 0000000..0d42dc2 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/unfreezeasset.md @@ -0,0 +1,81 @@ +# unfreezeasset + +### How to use it + +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Tron, Network } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Tron>({network: Network.TRON})
+
+const res = await tatum.rpc.unfreezeAsset('TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', {
+visible: true,
+})
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+ +### Overview + +The `unfreezeAsset` method allows the unstaking of a token that has passed the minimum freeze duration on the TRON blockchain. + +### Parameters + +This method accepts the following parameters: + +* `ownerAddress` (string): Account address. The address of the owner of the assets. This must be a hexString. +* `options` (optional): Additional options for the transaction. + * `permission_id` (integer, optional): This is optional and mainly used for multi-signature transactions. + * `visible` (boolean, optional): Indicates whether the address is in base58 format. This is also optional. Default value is true. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `UnfreezeAssetContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address` (string): Account address + +### HTTP Request Example + +```json +{ + "owner_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "visible": true, + "txID": "094d59ae6c22cb6f206f4b263eec54a1dbfc1d1704d0c43a31d90b8b66ee4fbb", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" + }, + "type_url": "type.googleapis.com/protocol.UnfreezeAssetContract" + }, + "type": "UnfreezeAssetContract" + } + ], + "ref_block_bytes": "ab93", + "ref_block_hash": "88c6e64972349f0f", + "expiration": 1684488576000, + "timestamp": 1684488517323 + }, + "raw_data_hex": "0a02ab93220888c6e64972349f0f4080b8df9a83315a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412310a1541fd49eda0f23ff7ec1d03b52c3a45991c24cd440e12154198927ffb9f554dc4a453c64b2e553a02d6df514b18e80770cbeddb9a8331" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/updateasset.md b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/updateasset.md new file mode 100644 index 0000000..149e16b --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/api-calls-for-trc10-token-methods/updateasset.md @@ -0,0 +1,104 @@ +# updateasset + +### How to Use It + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.TRON}) + +const res = await tatum.rpc.updateAsset('TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1', 'https://mytokenwebsite.com', { + description: 'My Token Description', + new_limit: 10000, + new_public_limit: 50000, + permission_id: 1, + visible: true +}); + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} + +### Overview + +The `updateAsset` method is used to update basic information about a TRC10 token on the TRON network. This method could be useful when the information of a TRC10 token needs to be updated, for instance, if the token's website URL changes or the bandwidth limits for the token are adjusted. + +### Parameters + +* `ownerAddress`(string): The issuer's address of the token in hexString format. +* `url`(string): The token's website url in hexString format. +* `options` (optional): An object containing additional parameters: + * `description`(string, optional): The description of the token in hexString format. + * `new_limit`(integer, optional): Each token holder's free bandwidth limit. + * `new_public_limit`(integer, optional): The total free bandwidth limit of the token. + * `permission_id`(integer, optional): Used for multi-signature purposes. + * `visible`(boolean, optional): A boolean value indicating whether the address is in base58 format. + +### Return Object + +* `raw_data.contract` - The main content of the transaction,`contract` is a list, but only one element is used at present. Different types of transactions have different contract contents. For example, for a TRX transfer type transaction, the contract will include the transfer amount, receiver address and other information. TRON supports multiple types of contracts, please refer to the official documentation [Types of Transaction](https://developers.tron.network/docs/tron-protocol-transaction#types-of-transaction). +* `raw_data.ref_block_bytes` - The height of the transaction reference block, using the 6th to 8th (exclusive) bytes of the reference block height, a total of 2 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.ref_block_hash` - The hash of the transaction reference block, using the 8th to 16th (exclusive) bytes of the reference block hash, a total of 8 bytes. The reference block is used in the TRON TAPOS mechanism, which can prevent a replay of a transaction on forks that do not include the referenced block. Generally, the latest solidified block is used as the reference block. +* `raw_data.expiration` - Transaction expiration time, beyond which the transaction will no longer be packed. If the transaction is created by calling the java-tron API, its expiration time will be automatically set by the node to the value of adding 60 seconds to the timestamp of the node's latest block. The expiration time interval can be modified in the node's configuration file, the maximum value cannot exceed 24 hours. +* `raw_data.data` - Transaction memo. +* `raw_data.timestamp` - Transaction timestamp, set as the transaction creation time. +* `raw_data.fee_limit` - The maximum energy cost allowed for the execution of smart contract transactions. Only deploying and triggering smart contract transactions need to be set, others not. +* `signature` - The sender's signature for the transaction. This proves that the transaction could only have come from the sender and was not sent fraudulently. +* `txID` - transaction id + +Since the transaction type is `UpdateAssetContract`, the fields contained in `raw_data.contract[0].parameter.value` in the transaction are as follows: + +* `owner_address`: Account address +* `description`: Description +* `url`: Token's website Url +* `new_limit`: The limit of Bandwidth point which each caller can consume +* `new_public_limit`: The limit of Bandwidth point which all callers can consume + +### HTTP Request Example + +```json +{ + "owner_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "description": "My Token Description", + "url": "https://mytokenwebsite.com", + "new_limit": 10000, + "new_public_limit": 50000, + "permission_id": 1, + "visible": true +} +``` + +### HTTP Response Example + +```json +{ + "transaction": { + "txID": "b5e7e6e7908d295feb3e91784c68ddd0640830a27c465a4e8ee4ad87e7aff263", + "raw_data": { + "contract": [ + { + "parameter": { + "value": { + "owner_address": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1", + "description": "My Token Description", + "url": "https://mytokenwebsite.com", + "new_limit": 10000, + "new_public_limit": 50000 + }, + "type_url": "type.googleapis.com/protocol.UpdateAssetContract" + }, + "type": "UpdateAssetContract" + } + ], + "ref_block_bytes": "09f6", + "ref_block_hash": "fec5e58087511d2a", + "expiration": 1570676090000, + "timestamp": 1570676035768 + }, + "raw_data_hex": "0a0209f62202..." + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/README.md new file mode 100644 index 0000000..bfb5ea5 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/README.md @@ -0,0 +1,2 @@ +# EVM methods + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/README.md new file mode 100644 index 0000000..1fb947d --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/README.md @@ -0,0 +1,2 @@ +# Archival information + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbyhash.md b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbyhash.md new file mode 100644 index 0000000..4bc1b92 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbyhash.md @@ -0,0 +1,107 @@ +# debug\_traceBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.debugTraceBlockByHash( +'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', +{tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByHash` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `block_hash` (required): The hash of the block to be traced. + * Example: `"0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByHash", + "params": [ + "0x1dcf337a03e08a8c00e31de6f5b6d9a6e1c6f1d5e5e6c89fc5f5b5a30e6d5d0c", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbynumber.md b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbynumber.md new file mode 100644 index 0000000..5deea92 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_traceblockbynumber.md @@ -0,0 +1,105 @@ +# debug\_traceBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.debugTraceBlockByNumber('0xAD7C5E' ,{tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceBlockByNumber` is an RPC method that allows developers to trace all transactions within a block using a given tracer. This is particularly useful for analyzing the behavior of all transactions in a block, investigating potential issues, and understanding the flow of execution within smart contracts. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during each transaction, including the input, output, and depth of the calls. + +### Parameters + +* `blockNumber` - `Quantity` or `String` + * The block number of the block to trace. + * Example: `"0x1"` or `"latest"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an array of objects, each representing the trace result of a transaction within the block. Each object contains the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "latest", + { + "tracer": "callTracer", + "timeout": "10s" + } + ] +} + +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "result": { + "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", + "gas": "0x2d48c", + "gasUsed": "0xc7ab", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0xa9059cbb0000000000000000000000003b9f33b3a9d382fa60283c555bde8f78855957be00000000000000000000000000000000000000000000000d4e7f4f79da7c0000", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "value": "0x0", + "type": "CALL" + } + } + ] +} + +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracecall.md b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracecall.md new file mode 100644 index 0000000..c7c6c8f --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracecall.md @@ -0,0 +1,122 @@ +# debug\_traceCall + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const tatum = await TatumSDK.init({network: Network.EON}) + +const result = await tatum.rpc.debugTraceCall({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "gas": "0x76c0", + "gasPrice": "0x9184e72a000", + "value": "0x9184e72a", + "data": "0x606060..." + }, + "0xAD7C5E", + {tracer:'callTracer'} +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceCall` is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call. + +### Parameters + +The `debug_traceCall` method accepts the following parameters: + +* `transaction`: An object that contains the following fields: + * `from`: The address from which the call is initiated. Example: `"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"` + * `to`: The address of the contract to be called. Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` + * `gas`: (Optional) The gas limit for the call. Example: `"0x76c0"` + * `gasPrice`: (Optional) The gas price for the call. Example: `"0x9184e72a000"` + * `value`: (Optional) The value to be transferred during the call. Example: `"0x9184e72a"` + * `data`: (Optional) The input data for the call, encoded as a hexadecimal string. Example: `"0x606060..."` +* `blockNumber`: The block number for which the call should be traced. Example: `"0x1b4"` + +### Return Object + +The return object is an object containing the following fields: + +* `output`: The output data from the call. +* `gasUsed`: The total gas used by the call. +* `calls`: An array of objects, each representing a nested call made during the call. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +
{
+  "jsonrpc": "2.0",
+  "id": 1,
+  "method": "debug_traceCall",
+  "params": [
+    {
+      "from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
+      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
+      "gas": "0x76c0",
+      "gasPrice": "0x9184e72a000",
+      "value": "0x9184e72a",
+      "data": "0x606060..."
+    },
+    "0x1b4"
+  ]
+}
+
+ +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracetransaction.md b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracetransaction.md new file mode 100644 index 0000000..197c411 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/archival-information/debug_tracetransaction.md @@ -0,0 +1,103 @@ +# debug\_traceTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.debugTraceTransaction('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9', {tracer:'callTracer'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`debug_traceTransaction` is an RPC method that allows developers to inspect and trace the execution of a specific transaction, providing valuable insight into the internal workings of the transaction, including the calls made between contracts, the state of the contracts, and any errors encountered during the transaction. + +By using the `callTracer` tracer, developers can obtain more detailed information about the calls made during the transaction, including the input, output, and the depth of the calls. This is particularly useful in debugging complex transactions, analyzing gas consumption, and understanding the flow of execution within smart contracts. + +### Parameters + +* `transaction_hash` (required): The hash of the transaction to trace. + * Example: `"0x123f681646d4a755815f9cb19e1acc8565a0c2ac"` +* `options` (optional): An object containing configuration options for the tracer. + * `tracer` (required): The tracer to use, in this case, `"callTracer"`. + * `timeout` (optional): The maximum amount of time the tracer is allowed to run, in seconds or as a string (e.g. "5s" or "500ms"). Default is "5s". + * Example: `{"tracer": "callTracer", "timeout": "10s"}` + +### Return Object + +The return object is an object containing the following fields: + +* `from`: The address the transaction was sent from. +* `gas`: The gas provided for the transaction. +* `gasUsed`: The total gas used by the transaction. +* `to`: The address the transaction was sent to. +* `input`: The input data for the transaction. +* `output`: The output data from the transaction. +* `calls`: An array of objects, each representing a call made during the transaction. Each object contains: + * `from`: The address the call was made from. + * `gas`: The gas provided for the call. + * `gasUsed`: The gas used by the call. + * `to`: The address the call was made to. + * `input`: The input data for the call. + * `output`: The output data from the call. + * `type`: The type of the call (e.g., "STATICCALL"). + +{% hint style="info" %} +This method is available only on the full archive node. +{% endhint %} + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "debug_traceTransaction", + "params": ["0x920d562e886a0c7c1f07ecee2ee5557f72d3056b205f8811c57e2615a3b6adb0", {"tracer":"callTracer"}], + "id": 2 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 2, + "result": { + "from": "0x0a6d033f6628ef715732d61e059187b7330305ff", + "gas": "0x51fba", + "gasUsed": "0x41711", + "to": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "input": "0xcba9bc66000000000000000000000000f62ef040fb5ea7d0828ff50bced9a7720f1387c7000000000000000000000000325e343f1de602396e256b67efd1f61c3a6b38bd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000000100a08761e1547f0000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff000000000000000000000000000000000000000000000000000000000000000300000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000053e562b9b7e5e94b81f10e96ee70ad06df3d265700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "output": "0x0000000000000000000000000000000000000000000000000102b1eda6a2682d", + "calls": [ + { + "from": "0x19e870855cb8fd8f6689743d3c28311c0d62a24c", + "gas": "0x4f638", + "gasUsed": "0x4cf", + "to": "0x55d398326f99059ff775485246999027b3197955", + "input": "0x70a082310000000000000000000000000a6d033f6628ef715732d61e059187b7330305ff", + "output": "0x00000000000000000000000000000000000000000000002ca114a674b092dd94", + "type": "STATICCALL" + } + ], + "value": "0x0", + "type": "CALL" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/mempool/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_content.md b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_content.md new file mode 100644 index 0000000..33bb17e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_content.md @@ -0,0 +1,130 @@ +# txpool\_content + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const content = await tatum.rpc.txPoolContent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_content` method provides information about the transactions currently pending in the transaction pool of the Flare node. It can be helpful for developers and node operators to monitor and manage the transaction pool, especially in scenarios where it's necessary to analyze transaction congestion or prioritize specific transactions. + +Use cases for the `txpool_content` method include: + +* Analyzing network congestion by inspecting the transaction pool +* Prioritizing transactions by gas price +* Monitoring transactions from specific addresses +* Debugging and troubleshooting pending transactions + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `txpool_content` method returns an object with two fields: `pending` and `queued`. Each field contains a nested object with addresses as keys and their respective transactions as values. + +* **`pending`**: An object containing transactions that are currently pending for inclusion in the next block(s). +* **`queued`**: An object containing transactions that are currently queued (i.e., transactions that do not meet certain criteria for inclusion in the next block, like low gas price or nonce gaps). + +Each transaction object includes the following information: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Request Example + +```json +jsonCopy code{ + "id": 1, + "jsonrpc": "2.0", + "method": "txpool_content", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": { + "blockHash": null, + "blockNumber": null, + "from": "0x01d3b93aaade8a4066daabc8fd8482173a6ad120", + "gas": "0x1c9c380", + "gasPrice": "0x16cf917", + "maxFeePerGas": "0x16cf917", + "maxPriorityFeePerGas": "0x16cf917", + "hash": "0x1da9c2a8f0787bac4747c5ed1035e81f6a6745aeea43943e63635fc367b817f7", + "input": "0x00000000", + "nonce": "0xc5", + "to": "0x4f023eb8c6bc3116e35b67e03bf2c17f2e4f7e7e", + "transactionIndex": null, + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0x14f7578b57fd9f87acf5bbceb0a47f2d2d3f39b49169357457618c9634c45e8a", + "s": "0x775fa9976c571751a79f069f8c96f6489f286246e157a31fa99b33062631b46d" + } + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": { + "blockHash": null, + "blockNumber": null, + "from": "0x03321406635a04d37cf9211f2ea3afc83a87e777", + "gas": "0x5208", + "gasPrice": "0xc570bd200", + "hash": "0x05f5fb8e46793fafdc924917c0afdd0afb4a53cb562542d5399234bc1eff759b", + "input": "0x", + "nonce": "0x4dc359", + "to": "0x77b1c86ab0aa9066803ed567e1f00973976638f6", + "transactionIndex": null, + "value": "0xb1a2b96602aa20", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d72", + "r": "0x62bd220b95ec13827c0d9b643b9beaf6f4c66d4a8ef08bb10f93d5e5c7ae0068", + "s": "0x467f76847cfdf43a002defe054030c1a88a9e6f56539c051c3cba46b2dd2cc89" + } + } + } + } +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_inspect.md b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_inspect.md new file mode 100644 index 0000000..b8cbb95 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_inspect.md @@ -0,0 +1,77 @@ +# txpool\_inspect + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const inspect = await tatum.rpc.txPoolInspect() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_inspect` method is a JSON-RPC method used to inspect the current transaction pool of a running node. The method allows you to view all pending transactions and their details, including transaction hashes, gas prices, and transaction data. This method is useful for developers who want to monitor the status of pending transactions or debug transaction-related issues. + +### Parameters + +The `txpool_inspect` method takes one optional parameter: + +* **`include`**: A string specifying the type of transactions to include in the response. Possible values are **`pending`** (default) and **`queued`**. + +### Return Object + +The `txpool_inspect` method returns an object with the following fields: + +* **`pending`**: An array of transaction objects, with textual data +* **`queued`**: An array of transaction objects, with textual data + +## Example Request: + +```json +{ + "jsonrpc": "2.0", + "method": "txpool_inspect", + "params": [ + "pending" + ], + "id": 1 +} +``` + +## Example Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": { + "0x01d3B93AaADE8A4066DAaBc8fd8482173A6aD120": { + "197": "0x4f023eB8C6BC3116E35B67E03bf2C17f2e4f7e7e: 0 wei + 30000000 gas ร— 23918871 wei" + } + }, + "queued": { + "0x03321406635a04D37Cf9211F2ea3AFc83a87e777": { + "5096281": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 49999988041886240 wei + 21000 gas ร— 53000000000 wei", + "8308536": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 100000000000000000 wei + 21000 gas ร— 53000000000 wei", + "231211221": "0x77b1C86Ab0aa9066803eD567e1F00973976638F6: 1000000000000000 wei + 21000 gas ร— 11958113760 wei" + } + } + } +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_status.md b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_status.md new file mode 100644 index 0000000..69e2d9b --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/mempool/txpool_status.md @@ -0,0 +1,65 @@ +# txpool\_status + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const status = await tatum.rpc.txPoolStatus() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `txpool_status` method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners. + +This method can be useful for monitoring the health of the network and analyzing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block. + +### Parameters + +This method does not take any parameters. + +### Return Object + +The `txpool_status` method returns an object with the following fields: + +* **`pending`**: Number of pending transactions in the pool +* **`queued`**: Number of queued transactions in the pool + +### Example Request + +```json +{ + "jsonrpc":"2.0", + "method":"txpool_status", + "params":[], + "id":1 +} +``` + +### Example Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "pending": 4, + "queued": 10 + } +} +``` + +In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners. diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/README.md new file mode 100644 index 0000000..bd96ae8 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/README.md @@ -0,0 +1,2 @@ +# Network/Client information + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/eth_chainid.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/eth_chainid.md new file mode 100644 index 0000000..f96ab8e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/eth_chainid.md @@ -0,0 +1,62 @@ +# eth\_chainId + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const id = await tatum.rpc.chainId() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_chainId` method is an JSON-RPC method that allows developers to retrieve the currently configured chain ID of the network they are connected to. The chain ID is a unique identifier for different networks, such as mainnet or various testnets. + +This method is particularly useful when building applications that interact with multiple networks or need to verify the network to prevent replay attacks. By checking the chain ID, an application can ensure it is interacting with the intended network. + +### Parameters + +The `eth_chainId` method does not have any input parameters. + +### Return Object + +The return object contains a single field: + +* **`chainId`**: The hexadecimal string representation of the chain ID. + +### Example Request and Response + +JSON-RPC request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_chainId", + "params": [] +} +``` + +JSON-RPC response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xe" +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/web3_clientversion.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/web3_clientversion.md new file mode 100644 index 0000000..793c773 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-client-information/web3_clientversion.md @@ -0,0 +1,64 @@ +# web3\_clientVersion + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const version = await tatum.rpc.clientVersion() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`web3_clientVersion` is a method of the JSON-RPC API that allows the client to retrieve the current version of the client software being used by the node. + +This method is read-only and does not require authentication. The `web3_clientVersion` method can be used by developers to confirm the version of the client software they are using and ensure that it is compatible with their application. + +### Parameters + +This method has no parameters. It only retrieves the current version of the client software. + +### Return Object + +The `web3_clientVersion` method returns a string representing the version of the client software being used. The string includes the client name, version number, and build information. + +* `String` - Version string of the client software being used. + +### Example Request + +#### JSON Request + +```json +{ + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 +} +``` + +### Example Response + +#### JSON Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": "v0.9.0" +} +``` + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_blocknumber.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_blocknumber.md new file mode 100644 index 0000000..4d5f021 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_blocknumber.md @@ -0,0 +1,70 @@ +# eth\_blockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const latestBlock = await tatum.rpc.blockNumber() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_blockNumber` method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data. + +Use cases for `eth_blockNumber` include: + +* Synchronising a local copy of the blockchain with the network +* Checking the status of a transaction by comparing its block number to the current block number +* Determining the current network state for smart contract interactions\ + + +### Parameters + +The `eth_blockNumber` method does not require any parameters. + +### Return Object + +The `eth_blockNumber` method returns a single field: + +* **`blockNumber`**: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_blockNumber", + "params": [] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` + +In this example, the most recent block number is 1207 (`0x4b7` in hexadecimal notation). + +Please note that while this document provides a comprehensive description of the `eth_blockNumber` RPC method, other methods may be needed to obtain full transaction details or perform more complex tasks. Refer to the [Ethereum JSON-RPC documentation](https://eth.wiki/json-rpc/API) for more information. + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getbalance.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getbalance.md new file mode 100644 index 0000000..d8626be --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getbalance.md @@ -0,0 +1,109 @@ +# eth\_getBalance + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const balance = await tatum.rpc.getBalance('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getBalance", + Params = new object[] + { + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBalance` method is an JSON-RPC method that allows you to retrieve the balance of a specified address. This method can be used to query the balance of any address, whether it is a contract or an externally owned account (EOA). A common use case for this method is to display the current balance of a user's account in a wallet application or a decentralized application (DApp). + +### Parameters + +The method requires two parameters: + +1. **`address`** (required): The address of the account or contract whose balance you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** (optional): The block number or block identifier to specify the point in time for which you want to query the balance. + * Example: `"latest"` or `"0x1"` + +#### Transaction Details + +For the purpose of this documentation, we'll also describe the `transactions` field of a full transaction object. The `eth_getBalance` method does not return transaction details, but we provide this information for completeness. + +A full transaction object includes the following fields: + +* **`hash`**: The transaction hash. +* **`nonce`**: The number of transactions made by the sender prior to this one. +* **`blockHash`**: The hash of the block in which the transaction was included. +* **`blockNumber`**: The block number in which the transaction was included. +* **`transactionIndex`**: The index of the transaction in the block. +* **`from`**: The sender's address. +* **`to`**: The recipient's address (or `null` for contract creation transactions). +* **`value`**: The value transferred, in wei. +* **`gasPrice`**: The gas price provided by the sender, in wei. +* **`gas`**: The maximum gas allowed for the transaction. +* **`input`**: The data sent with the transaction (typically for contract interaction). +* **`v`**, **`r`**, **`s`**: The raw signature values of the transaction. + +### Return Object + +The method returns a single field: + +* `result`: The Flare balance of the specified address in wei, as a hexadecimal string. + * Example: `"0x1a2e1a"`, which corresponds to `1,726,666` wei. + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBalance", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1a2e1a" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbyhash.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbyhash.md new file mode 100644 index 0000000..fd3091e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbyhash.md @@ -0,0 +1,138 @@ +# eth\_getBlockByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const block = await tatum.rpc.getBlockByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByHash` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block hash. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +The `eth_getBlockByHash` method accepts two parameters: + +1. **`blockHash`**: The hash of the block you want to retrieve information about. + * Type: `String` + * Example: `"0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b"` +2. **`fullTransactionDetails`**: A boolean value indicating whether to return full transaction details or just transaction hashes. + * Type: `Boolean` + * Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getBlockByHash", + "params": ["0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", true], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbynumber.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbynumber.md new file mode 100644 index 0000000..8d916e6 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblockbynumber.md @@ -0,0 +1,135 @@ +# eth\_getBlockByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Tron, Network } from '@tatumio/tatum'
+
+// Initialize the SDK for the TRON network
+const tatum = await TatumSDK.init<Tron>({network: Network.TRON})
+
+const block = await tatum.rpc.getBlockByNumber('latest', true)
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockByNumber` is an JSON-RPC method that allows developers to query a specific block in the blockchain by its block number. This method can be used in various scenarios, such as analyzing historical transactions, validating the state of the blockchain, or monitoring the progress of mining activities. + +### Parameters + +There are two required parameters for this method: + +1. **`blockNumber`** - The block number of the block to be retrieved. This can be a hexadecimal string or one of the predefined aliases: `"earliest"`, `"latest"`, or `"pending"`. + + Example: `"0x1b4"` +2. **`returnFullTransactionObjects`** - A boolean value that determines whether the returned block contains complete transaction objects (`true`) or only transaction hashes (`false`). + + Example: `true` + +### Return Object + +The returned block object includes the following fields: + +* **`number`** - The block number (hexadecimal string). +* **`hash`** - The block hash (32-byte string). +* **`parentHash`** - The hash of the parent block (32-byte string). +* **`nonce`** - The nonce used to generate the block (8-byte string). +* **`sha3Uncles`** - The SHA3 hash of the uncles in the block (32-byte string). +* **`logsBloom`** - The logs bloom filter of the block (256-byte string). +* **`transactionsRoot`** - The root of the transaction trie (32-byte string). +* **`stateRoot`** - The root of the state trie (32-byte string). +* **`miner`** - The address of the miner who mined the block (20-byte string). +* **`difficulty`** - The difficulty of the block (hexadecimal string). +* **`totalDifficulty`** - The total difficulty of the chain up to this block (hexadecimal string). +* **`extraData`** - Extra data included by the miner in the block (byte string). +* **`size`** - The block size in bytes (hexadecimal string). +* **`gasLimit`** - The gas limit for the block (hexadecimal string). +* **`gasUsed`** - The total gas used by all transactions in the block (hexadecimal string). +* **`timestamp`** - The block timestamp (hexadecimal string). +* **`transactions`** - An array of transaction objects or transaction hashes, depending on the `returnFullTransactionObjects` parameter. +* **`uncles`** - An array of uncle block hashes (32-byte strings). + +If `returnFullTransactionObjects` is `true`, the `transactions` field contains transaction objects with the following fields: + +* **`hash`** - The transaction hash (32-byte string). +* **`nonce`** - The number of transactions sent by the sender before this transaction (hexadecimal string). +* **`blockHash`** - The block hash where the transaction is included (32-byte string). +* **`blockNumber`** - The block number where the transaction is included (hexadecimal string). +* **`transactionIndex`** - The index of the transaction in the block (hexadecimal string). +* **`from`** - The sender address (20-byte string). +* **`to`** - The recipient address, or `null` for contract creation transactions (20-byte string). +* **`value`** - The value being transferred (hexadecimal string). +* **`gasPrice`** - The gas price in wei (hexadecimal string). +* **`gas`** - The gas provided for the transaction (hexadecimal string). +* **`input`** - The input data for the transaction (byte string). + +### JSON-RPC Request and Response Examples + +Here are examples of JSON-RPC request and response for the `eth_getBlockByNumber` method: + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", true] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "difficulty": "0x2", + "extraData": "0xd883010114846765746888676f312e31392e36856c696e75780000008279af9a2f9343c00920c795a7abe84303ee56588946383a15d1e9ee422a7df6dcbe199e4ec93511fe1ffa3c3ab10cb5b12459e8f64553ad3a741e9562e1d5e522c336a400", + "gasLimit": "0x2faed85", + "gasUsed": "0xd81f1", + "hash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "logsBloom": "0x0020001000000000000001000000000000000000000000040000000000084000000004000800000000c06100800000000000000000010000200000000024008000004000000000000000001800001000a050000000040004000000000000000000000220020200000000000000400800080008000000000000001010004000400000000000010000000000000000000000002400000008000000008000000021022000000000000000000000000000000000000000000000000000000000010010180003000800000000000000000000000000800000000020000082000060000010000000001002010800000000000000020000080000800000000000000000", + "miner": "0x35552c16704d214347f29fa77f77da6d75d7c752", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1b5dd23", + "parentHash": "0x41f85649fa6d5e58a4631f76724a96dba8313302323f0834b9cf2b63d0308e0f", + "receiptsRoot": "0x81835f75c1f7521016ce3404f19a44f10c4d56b6ab780fad3388d490c154afbe", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x8e9", + "stateRoot": "0xda34eefae13e5940f564f3f6cc63c96fb9a0ee015b66552f01a14c2b002b0f7f", + "timestamp": "0x642ea5d2", + "totalDifficulty": "0x36908d2", + "transactions": [ + { + "blockHash": "0x078610ca461480e4b78557f20e544084cccc4accb41f5c1b7ef792246b78c94b", + "blockNumber": "0x1b5dd23", + "from": "0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3", + "gas": "0x5208", + "gasPrice": "0x430e23400", + "hash": "0x82544cc4cf767ec9d235f2afa72af2cf468b25c682c302b76390cf0830006174", + "input": "0x", + "nonce": "0x87bf4f", + "to": "0x2fc9076c0ebfa453dee1649721010764cbdf18fc", + "transactionIndex": "0x0", + "value": "0x16345785d8a0000", + "type": "0x0", + "v": "0xe5", + "r": "0x282c0953168acda79a7ec86be5392370bbce08441aa803be0576dfa467a46329", + "s": "0x59e528253c8fe85e72c43d84dd13d6fe724899cf3f94c4800761f2414b2b8f1e" + } + ], + "transactionsRoot": "0xc6939e1f42fa4c4a264a1c1617cc0a6ac7122f3cb5c2848e53b3fba35b33f6ad", + "uncles": [] + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbyhash.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbyhash.md new file mode 100644 index 0000000..78cb2a9 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbyhash.md @@ -0,0 +1,69 @@ +# eth\_getBlockTransactionCountByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const response = await tatum.rpc.getBlockTransactionCountByHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getBlockTransactionCountByHash` is a RPC method used to fetch the number of transactions in a block by the block's hash. It is useful when you want to know the total number of transactions included in a specific block and don't want to retrieve the entire block data. This method can be used in various scenarios, such as monitoring the network activity or estimating transaction confirmation times. + +### Parameters + +This method requires a single parameter: + +* **`blockHash`**: The hash of the target block for which the transaction count will be retrieved. It should be a valid 32-byte hex string. + +Example of the parameter: + +* `blockHash`: `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` + +### Return + +The method returns a single value: + +* `transactionCount`: The total number of transactions included in the specified block. It is returned as a hexadecimal value. + +### Examples + +#### JSON-RPC request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getBlockTransactionCountByHash", + "params": [ + "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" + ] +} +``` + +#### JSON-RPC response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa" +} +``` + +In this example, the block with the hash `"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"` has a total of 10 transactions (indicated by the hexadecimal value `"0xa"`). diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbynumber.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbynumber.md new file mode 100644 index 0000000..e720411 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getblocktransactioncountbynumber.md @@ -0,0 +1,64 @@ +# eth\_getBlockTransactionCountByNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const response = await tatum.rpc.getBlockTransactionCountByNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getBlockTransactionCountByNumber` JSON-RPC method allows you to retrieve the number of transactions in a specified block. This method is particularly useful when you need to analyze the transaction activity of a specific block. You can use it to gain insights into network usage, analyze the impact of specific events on the network, or monitor transaction congestion in certain blocks. + +### Parameters + +1. **`blockNumber`**: The block number for which the transaction count should be retrieved. It should be a hex-encoded value representing the block number. + * Example: `"0x1b4"` (block number 436) + +### Return Object + +The return object is a hex-encoded value representing the number of transactions in the specified block. + +* Example: `"0xa"` (10 transactions) + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockTransactionCountByNumber", + "params": ["0x1b4"] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0xa" +} +``` + + + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getcode.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getcode.md new file mode 100644 index 0000000..a8e38f2 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getcode.md @@ -0,0 +1,77 @@ +# eth\_getCode + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const code = await tatum.rpc.getCode('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getCode` method is part of the JSON-RPC API, which allows users to interact with the blockchain. This method is specifically used to retrieve the contract code (bytecode) of an account at a specific block number. It is helpful when developers need to examine the bytecode of a deployed contract or validate that the contract code on the blockchain matches the intended code. + +Use cases for this method could include: + +* Debugging a smart contract +* Verifying the integrity of a deployed contract +* Analyzing contract bytecode for security vulnerabilities + +### Parameters + +The `eth_getCode` method accepts two parameters: + +1. **`address`** (string): The address of the contract whose bytecode you want to retrieve. This should be a 20-byte address, formatted as a hex string with a `0x` prefix. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`block`** (string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords: + * `"earliest"`: The first block in the blockchain + * `"latest"`: The most recent block in the blockchain + * `"pending"`: The upcoming block that is being mined + * Example: `"0x1"` or `"latest"` + +### Return Object + +The `eth_getCode` method returns a string representing the contract bytecode. The returned value is a hex string with a `0x` prefix. + +* If the account has contract code, the returned string will contain the bytecode. +* If the account is not a contract or does not exist, the returned string will be `0x`. + +### JSON Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getCode", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x606060...code_here...3839" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getlogs.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getlogs.md new file mode 100644 index 0000000..a8b35e1 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getlogs.md @@ -0,0 +1,112 @@ +# eth\_getLogs + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const logs = await tatum.rpc.getLogs({ address : '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86'}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getLogs` method is an JSON-RPC method that allows developers to query logs generated by the network, specifically event logs emitted by smart contracts. These logs are an essential part of the ecosystem as they provide a way for developers to monitor contract events and track contract state changes. + +This method is particularly useful when building decentralized applications (dApps) that rely on events emitted by smart contracts, as it enables developers to retrieve logs based on specific filter criteria. By using `eth_getLogs`, developers can efficiently track and react to events happening on the blockchain. + +### Parameters + +The `eth_getLogs` method takes a single input parameter: an object containing the filter criteria. The filter object can have the following fields: + +* **`fromBlock`**: (optional) The starting block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"fromBlock": "0x1"` +* **`toBlock`**: (optional) The ending block number for the search. Can be a block number or one of the following strings: `"earliest"`, `"latest"`, or `"pending"`. + * Example: `"toBlock": "0x2"` +* **`address`**: (optional) The address or list of addresses of the contracts to filter logs from. Can be a single address or an array of addresses. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`topics`**: (optional) An array of up to four 32-byte topics. Topics are order-dependent, and each topic can be an array of topic hashes or `null`. + * Example: `"topics": ["0x123..."]` +* **`blockhash`**: (optional) The block hash to filter logs from. If provided, `fromBlock` and `toBlock` are ignored. + * Example: `"blockhash": "0xc6ef9..."` + +In addition to the above fields, the `transactions` field in the filter object can be specified to include full transaction details instead of just transaction hashes. This is useful when you need more information about the transactions in which the events were emitted. + +### Return Object + +The `eth_getLogs` method returns an array of log objects. Each log object contains the following fields: + +* **`removed`**: A boolean indicating whether the log was removed due to a chain reorganization. + * Example: `"removed": false` +* **`logIndex`**: The log index position in the block. + * Example: `"logIndex": "0x1"` +* **`transactionIndex`**: The transaction index position in the block. + * Example: `"transactionIndex": "0x0"` +* **`transactionHash`**: The hash of the transaction that emitted the log. + * Example: `"transactionHash": "0x88eef..."` +* **`blockHash`**: The hash of the block containing the log. + * Example: `"blockHash": "0xc6ef9..."` +* **`blockNumber`**: The block number containing the log. + * Example: `"blockNumber": "0x1"` +* **`address`**: The address of the contract that emitted the log. + * Example: `"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`data`**: The data associated with the log. + * Example: `"data":"0x0000000000000000000000000000000000000000000000000000000000000020"` +* **`topics`**: An array of topics (order-dependent) associated with the log. + * Example: `"topics": ["0x123..."]` + +## JSON-RPC Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getLogs", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "topics": ["0x123..."] + } + ] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "removed": false, + "logIndex": "0x1", + "transactionIndex": "0x0", + "transactionHash": "0x88eef...", + "blockHash": "0xc6ef9...", + "blockNumber": "0x1", + "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000020", + "topics": ["0x123..."] + } + ] +} +``` + +This documentation provides a comprehensive overview of the `eth_getLogs` JSON-RPC method, its parameters, return objects, and JSON-RPC examples. By using this method, developers can effectively query logs generated by the network and use the retrieved data to track and react to events happening on the blockchain. diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getproof.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getproof.md new file mode 100644 index 0000000..6861444 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getproof.md @@ -0,0 +1,108 @@ +# eth\_getProof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getProof("0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + ["0x0000000000000000000000000000000000000000000000000000000000000000"], + "latest") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getProof` is a JSON-RPC method that retrieves the Merkle-Patricia proof for an account, storage key-value pairs, and account transaction count. It allows developers to verify the state of an account or storage value at a specific block without needing the entire state trie. This method is particularly useful for light clients or off-chain applications that require proof of an account's state or specific storage values. + +### Parameters + +1. **`address`** - `Data`, 20 Bytes + * The address of the account. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`keys`** - `Array` of `Data` + * An array of storage keys for which the proof should be generated. + * Example: `["0x0000000000000000000000000000000000000000000000000000000000000000"]` +3. **`blockNumber`** - `Quantity` or `String` + * The block number for which the proof should be generated. + * Example: `"0x1"` or `"latest"` + +### Return Object + +The method returns an object containing the following fields: + +1. **`accountProof`** - `Array` of `Data` + * The serialized Merkle-Patricia proof for the account. +2. **`balance`** - `Quantity` + * The balance of the account at the specified block. +3. **`codeHash`** - `Data`, 32 Bytes + * The hash of the code for the account at the specified block. +4. **`nonce`** - `Quantity` + * The transaction count of the account at the specified block. +5. **`storageProof`** - `Array` of `Object` + * An array of storage proof objects, one for each requested key, containing the following fields: + * `key` - `Data`, 32 Bytes: The storage key. + * `value` - `Quantity`: The storage value. + * `proof` - `Array` of `Data`: The serialized Merkle-Patricia proof for the key-value pair. + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getProof", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "latest" + ] +} +``` + +_Response_: + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "accountProof": [ + "0x...", + "0x...", + "0x..." + ], + "balance": "0xde0b6b3a7640000", + "codeHash": "0x...", + "nonce": "0x1", + "storageProof": [ + { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "value": "0xde0b6b3a7640000", + "proof": [ + "0x...", + "0x...", + "0x..." + ] + } + ] + } +} + +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getstorageat.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getstorageat.md new file mode 100644 index 0000000..03ec852 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getstorageat.md @@ -0,0 +1,70 @@ +# eth\_getStorageAt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const response = await tatum.rpc.getStorageAt('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', '0x0') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getStorageAt` is an JSON-RPC method that allows you to query the storage value of a contract at a given position. It can be used to inspect the internal state of a smart contract. This method is particularly useful for developers, auditors, and analysts who want to examine contract storage values for various purposes, such as debugging, verifying contract behavior, or analyzing data. + +### Parameters + +`eth_getStorageAt` accepts three parameters: + +1. **`address`**: The address of the contract you want to query. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`position`**: The storage position (slot) you want to query. + * Example: `"0x0"` +3. **`blockParameter`**: The block number, block hash, or one of the string literals (`"earliest"`, `"latest"` or `"pending"`), representing the point in the blockchain to query the storage value. + * Example: `"latest"` + +### Return Object + +The return object is a single string value, representing the storage value at the given position in the contract. + +* `result`: The storage value in a 32-byte (64 character) hexadecimal format. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getStorageAt", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "0x0", + "latest" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000123" +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblockhashandindex.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblockhashandindex.md new file mode 100644 index 0000000..ff8f788 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblockhashandindex.md @@ -0,0 +1,103 @@ +# eth\_getTransactionByBlockHashAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const tx = await tatum.rpc.getTransactionByBlockHashAndIndex('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockHash` (required): The hash of the block containing the transaction. + * Example: `"0x9a9a2a0d69b4ff48f7a2a8a26d135e1dbcbd3c3be3e8a3c90de0bcb104e4c4b4"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockHashAndIndex", + "params": [ + "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblocknumberandindex.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblocknumberandindex.md new file mode 100644 index 0000000..55931bc --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyblocknumberandindex.md @@ -0,0 +1,103 @@ +# eth\_getTransactionByBlockNumberAndIndex + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const tx = await tatum.rpc.getTransactionByBlockNumberAndIndex('0xAD7C5E', 0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByBlockHashAndIndex` is an JSON-RPC method that allows you to fetch the transaction details based on the block hash and the index of the transaction within that block. This method can be useful when you want to retrieve transaction details for a specific transaction without knowing its transaction hash. + +Use cases for this method may include: + +* Inspecting transaction details for debugging purposes +* Gathering data for transaction analysis +* Fetching transaction information for specific blocks in a block explorer application + +### Parameters + +The `eth_getTransactionByBlockHashAndIndex` method accepts two parameters: + +1. `blockNumber` (required): The hash of the block containing the transaction. + * Example: `"0x316624"` +2. `transactionIndex` (required): The index of the transaction within the specified block. The index is a hexadecimal value. + * Example: `"0x0"` + +### Return Object + +The method returns a JSON object containing the following fields: + +1. `hash`: The transaction hash as a 32-byte hex string. +2. `nonce`: The number of transactions made by the sender prior to this one. +3. `blockHash`: The hash of the block in which this transaction is included. +4. `blockNumber`: The block number in which this transaction is included. +5. `transactionIndex`: The index of the transaction within the block. +6. `from`: The address of the sender. +7. `to`: The address of the recipient. `null` if the transaction is a contract creation transaction. +8. `value`: The value transferred in wei. +9. `gasPrice`: The gas price provided by the sender in wei. +10. `gas`: The gas limit provided by the sender. +11. `input`: The data sent along with the transaction. + +### JSON Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionByBlockNumberAndIndex", + "params": [ + "0x316624", + "0x0" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x37a53636ee68f59d9346aabcfc0d36011d9d5b35", + "gas": "0x5b8d80", + "gasPrice": "0x59682f0a", + "maxFeePerGas": "0x59682f10", + "maxPriorityFeePerGas": "0x59682f00", + "hash": "0x40a0f78e346d15b05efa1861149e5999ea48197dcf104d69160d45b08b7a5118", + "input": "0xb1dc65a4000129d4314ec8c4bafb6468cc9d3c21de025fa54002558c9f76aec833406ab600000000000000000000000000000000000000000000000000000000001ccc01f18333a24416e0a0be9cdb78505c9c3c27fa42bccdbe6456cd6c1fc81bee7c0e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003a001000000010100010100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000003d150000000000000000000000000000000000000000000000000000000000003d17325325668a08b50a9587fd4605ce02dbc5ccefc4883a41b485ff4dc4a4f86f1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000a8690000000000000000000000000000000000000000000000000000009d29229e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ba6547e7b549a1f180c5ad4f2e2e7104fecb8373482f3de6574ecbeefdc9be9dfd9f1934768a23584f1508adad8a7bbfbe445a27bed9f1d4538d4e4c9e458b0c5274b6f714f5aee9a8d56aeb8957b6da6b8914e445a46dcd349737b2eb7d72132e41926d07355de577b13e6ec8e55eaaf628b333197a8d1292bed1c375e891e1da1d519aabbebcc6d299b575b7bef506e2db9493de6f0cfdb0436a81597eb155edc63a8ea655a9b405a0c41c923b1734d78b5d9812f36a602ace3d8c5b22beb9519e406f32de9768e518f2b253a95364a9a2838ba5023c52d503fe8fa811c8803399679a19513671b13d4040e46be74e152d39be4f68bfecaa57d27965ba724a09464734faf7230b19e04f4aa581f10066884e2f402af36f0cdbf08de95e190f4f31fd3b718c1317b65fba9e7ea45ef6180e4861839c6395c814214ee8d56b28ba19f47b6b80f43045635432971b30f2bfb3a26a53ca502bf21fa598c5ddb934b000000000000000000000000000000000000000000000000000000000000000b3ab737e679aefe131ad3efc850fd2c50b316aabcdaa4368587d9606df84b3590541698c7c5538111187964e1b3f39fa033033bb7cab30275ea11b912089663ec43243ff37fa9d2cce04dfce25738c3a484d42f8d8a2c6be226627606f75788ee0e777481b5bd100d00d118bddd18e8726f7a54333b6228f57fa3237799079eb56e6e0ac0cb0f334d23f7284e2dcb2f463d8104fc198389e42a9d1bad1dcfe983115d3d85474db611a6e82b2f61b8d93efa77bc039bd5b3b0f02a7fc587d4a12a0daf256c21ecb9664e6c90c2bfb72a753ff008d3306f7cd4c823df6685fc4cba1514ed132d6367a8f99fba241fc6ef6917f5279ebfdd3e05a296e5c4d77a5463037d7c8180d0644d7e90123918c30fca011d710201ceabcae277924f32ff6b9d0e4d285eb59b4b56d3af8d4b2ab1a39ec2d4324e49deea661cbd43f21cbdc76a10a14055ecdd3251a5860c3bb02bcc1f21da5564fc05adbac70c7565fb5f44b8", + "nonce": "0xec0", + "to": "0x8febc74c26129c8d7e60288c6dccc75eb494aa3c", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x2", + "accessList": [], + "chainId": "0xaa36a7", + "v": "0x1", + "r": "0xccf7b8fd2d63782e651f4d9650c0ed1a430060fd947d97b6504876f8ea16b357", + "s": "0x50c56d90105b1b8aa475c9500137e9b7c4f0a331fee076bc395a695dc471dc05" + } +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyhash.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyhash.md new file mode 100644 index 0000000..6d5e3cc --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionbyhash.md @@ -0,0 +1,93 @@ +# eth\_getTransactionByHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const tx = await tatum.rpc.getTransactionByHash('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionByHash` is an JSON-RPC method that allows you to query transaction details based on its hash. This method is useful when you want to retrieve information about a specific transaction, such as its sender, receiver, value, and more. Common use cases include tracking transaction status, monitoring incoming transactions, or analyzing historical transaction data. + +### Parameters + +The `eth_getTransactionByHash` method takes one parameter: + +* **`transactionHash`**: The hash of the transaction you want to retrieve. This should be a 32-byte hash string with a `0x` prefix. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns a transaction object with the following fields: + +* **`hash`**: The hash of the transaction (32 bytes). +* **`nonce`**: The number of transactions sent by the sender prior to this one (integer). +* **`blockHash`**: The hash of the block in which the transaction was included (32 bytes), or `null` if the transaction is not yet mined. +* **`blockNumber`**: The block number in which the transaction was included (integer), or `null` if the transaction is not yet mined. +* **`transactionIndex`**: The index of the transaction in the block (integer), or `null` if the transaction is not yet mined. +* **`from`**: The address of the sender (20 bytes). +* **`to`**: The address of the receiver (20 bytes), or `null` for contract creation transactions. +* **`value`**: The value transferred in the transaction, in wei. +* **`gasPrice`**: The price of gas for the transaction, in wei. +* **`maxFeePerGas`** - The maximum fee per gas set in the transaction. +* **`maxPriorityFeePerGas`** - The maximum priority gas fee set in the transaction. +* **`gas`**: The maximum amount of gas the transaction is allowed to consume. +* **`input`**: The data payload of the transaction (string), or `0x` for simple value transfers. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "eth_getTransactionByHash", + "params": ["0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"], + "id": 1 +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gas": "0x3c524", + "gasPrice": "0x306dc421e", + "hash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "input": "0x50bb4e7f00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40000000000000000000000000000000000000000000000000000056b990e70e000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006068747470733a2f2f6574682d6d61696e6e65742e672e616c6368656d792e636f6d2f76322f72646f704c505054424a31536f786b2d555179306b7464676f4b45326146637a2f6765744e4654732f3f6f776e65723d766974616c696b2e657468", + "nonce": "0xc97", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionIndex": "0x4", + "value": "0x0", + "type": "0x0", + "chainId": "0xaa36a7", + "v": "0x1546d71", + "r": "0xf89098451217613aa4abbb3f8988e75e20ae948d07bf8b26c472bc9bda50c9d9", + "s": "0x15cfb5b34bcb23730aeadc28df3b66fa9cf28103ffc8b557d76f0c1df078028e" + } +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactioncount.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactioncount.md new file mode 100644 index 0000000..c0f60a3 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactioncount.md @@ -0,0 +1,75 @@ +# eth\_getTransactionCount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getTransactionCount('0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', 'pending') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getTransactionCount` method is an JSON-RPC method that retrieves the number of transactions sent from a given address. It is a useful method for developers who need to keep track of an account's nonce value to avoid transaction collisions or incorrect order of execution. The nonce value is essential for ensuring transaction uniqueness and preventing replay attacks. + +Use cases for this method include: + +* Determining the nonce value for a new transaction to be sent from a specific address +* Monitoring the number of transactions sent by an address to observe its activity +* Troubleshooting transaction issues and verifying if a transaction was submitted successfully + +### Parameters + +The `eth_getTransactionCount` method accepts two parameters: + +1. **`address`** - The address whose transaction count will be retrieved. + * Example: `"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +2. **`blockParameter`** - A string indicating the block number or block state to consider when retrieving the transaction count. + * Possible values: `"earliest"`, `"latest"`, `"pending"`, or a specific block number in hexadecimal format + * Example: `"latest"` + +### Return Object + +The method returns a single value: + +* **`transactionCount`** - A hexadecimal representation of the number of transactions sent from the specified address. + * Example: `"0x1e"` + +### JSON-RPC Request and Response Examples + +_Request_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionCount", + "params": [ + "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "latest" + ] +} +``` + +_Response_: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x1e" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionreceipt.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionreceipt.md new file mode 100644 index 0000000..fa43bc1 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_gettransactionreceipt.md @@ -0,0 +1,130 @@ +# eth\_getTransactionReceipt + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const tx = await tatum.rpc.getTransactionReceipt('0x6aefbd1a9c9e4c310cadde3bcdd809a14da87caa8fa4f10ca04d9e357a3907e9') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} + +{% tab title="C#" %} +```csharp +// dotnet add ${your_project} package Tatum + +var tatumSdk = await TatumSdk.InitAsync(); + +var rpcCall = new JsonRpcCall +{ + Id = "1", + JsonRpc = "2.0", + Method = "eth_getTransactionReceipt", + Params = new object[] + { + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + } +}; + +var result = await tatumSdk.Rpc.Flare.Call(rpcCall); +``` +{% endtab %} +{% endtabs %} + +### Overview + +`eth_getTransactionReceipt` is an JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction. + +### Parameters + +This method requires a single parameter: + +* **`transactionHash`**: The hash of the transaction for which you want to obtain the receipt. + * Example: `"0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13"` + +### Return Object + +The method returns an object containing the following fields: + +* **`transactionHash`**: The hash of the transaction. +* **`transactionIndex`**: The transaction's index position in the block. +* **`blockHash`**: The hash of the block where this transaction was mined. +* **`blockNumber`**: The block number where this transaction was mined. +* **`from`**: The address of the sender. +* **`to`**: The address of the receiver. `null` when it's a contract creation transaction. +* **`cumulativeGasUsed`**: The total amount of gas used when this transaction was executed in the block. +* **`gasUsed`**: The amount of gas used by this specific transaction alone. +* **`contractAddress`**: The address of the contract created, if the transaction was a contract creation. Otherwise, `null`. +* **`logs`**: An array of log objects, which were emitted during the transaction. +* **`logsBloom`**: A 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction. +* **`status`**: The status of the transaction's execution. `"0x1"` indicates success, while `"0x0"` indicates failure. + +### JSON-RPC Examples + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getTransactionReceipt", + "params": [ + "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13" + ] +} +``` + +Response: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "blockNumber": "0x316624", + "contractAddress": null, + "cumulativeGasUsed": "0x7ad81", + "effectiveGasPrice": "0x306dc421e", + "from": "0x53e8577c4347c365e4e0da5b57a589cb6f2ab848", + "gasUsed": "0x3c518", + "logs": [ + { + "address": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074b4551c177592a908c6ab9ce671bfe8c1b5bd40", + "0x000000000000000000000000000000000000000000000000000056b990e70e00" + ], + "data": "0x", + "blockNumber": "0x316624", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "blockHash": "0x1091a5831b3556e80e53598c24e9d592e104dba0428f47f94c61523eb52d09d8", + "logIndex": "0x3", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000010000000000000800000000000000000000000010000040000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000100000000000000000000000000000000002000000200000000000100000000000800000000000000000000020000000000000000000000200000000000000000000000000000000000000000000", + "status": "0x1", + "to": "0x211500d1960bdb7ba3390347ffd8ad486b897a18", + "transactionHash": "0xa536596d043c03d709aaccbc53f421963fe3537274e86444cd984404cf9ecb13", + "transactionIndex": "0x4", + "type": "0x0" + } +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblockhash.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblockhash.md new file mode 100644 index 0000000..547dda9 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblockhash.md @@ -0,0 +1,71 @@ +# eth\_getUncleCountByBlockHash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getUncleCountByBlockHash('0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockHash`: The hash of the block for which you want to get the uncle count. + * Example value: `"0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockHash` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockHash", + "params": [ + "0x3a3e528dcd6e05a614c9241b0a9296db961fa6a92e05af9f6c0d7d2f6bc92f7a" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblocknumber.md b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblocknumber.md new file mode 100644 index 0000000..49d5f84 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/network-state/eth_getunclecountbyblocknumber.md @@ -0,0 +1,72 @@ +# eth\_getUncleCountByBlockNumber + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const result = await tatum.rpc.getUncleCountByBlockNumber('0xAD7C5E') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_getUncleCountByBlockHash` method is an JSON-RPC method that returns the number of uncles in a specified block by its hash. This method can be useful for gathering information about the performance of the network and to analyze the security of the blockchain. + +Uncles are blocks that are not included in the main blockchain but are still valid, and they contribute to the overall security and decentralization of the network. The inclusion of uncles helps prevent centralization and ensures the mining process remains competitive. + +### Parameters + +The `eth_getUncleCountByBlockHash` method takes one parameter: + +* `blockNumber`: The number of the block for which you want to get the uncle count. + * Example value: `"0x12345"` + +### Return Object + +The return object for this method is a hex-encoded integer representing the number of uncles in the specified block. + +* Example value: `"0x1"` (1 uncle) + +### JSON-RPC Request and Response Examples + +Here is an example JSON-RPC request and response for the `eth_getUncleCountByBlockNumber` method: + +**Request:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_getUncleCountByBlockNumber", + "params": [ + "0x12345" + ] +} +``` + +**Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x1" +} +``` + +In this example, the JSON-RPC request asks for the number of uncles in the block with the specified hash. The response indicates that there is one uncle in the block. + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/transaction/README.md b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/README.md new file mode 100644 index 0000000..1b1ccbc --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/README.md @@ -0,0 +1,2 @@ +# Transaction + diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_estimategas.md b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_estimategas.md new file mode 100644 index 0000000..bd1367e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_estimategas.md @@ -0,0 +1,93 @@ +# eth\_estimateGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const estimate = await tatum.rpc.estimateGas({ + "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86", + "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87", + "value": "0xde0b6b3a7640000", + "data": "0x606060" + }) + + tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`eth_estimateGas` is an JSON-RPC method that estimates the amount of gas required to execute a given transaction. This method can be used to determine the gas cost before sending a transaction, allowing developers to better predict the gas fees and avoid issues like out-of-gas errors. + +Use cases for `eth_estimateGas` include: + +* Estimating gas costs for contract deployments +* Estimating gas costs for contract function calls +* Estimating gas costs for standard transfers + +### Parameters + +The `eth_estimateGas` method takes a single parameter, an object representing the transaction details. The fields in the transaction object include: + +* **`from`** (optional, string): The address that the transaction is sent from. + * Example: `"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`to`** (optional, string): The address the transaction is sent to. + * Example: `"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"` +* **`gas`** (optional, string): The maximum amount of gas provided for the transaction. + * Example: `"gas": "0x76c0"` +* **`gasPrice`** (optional, string): The price of gas in wei. + * Example: `"gasPrice": "0x9184e72a000"` +* **`value`** (optional, string): The amount of ZEN to send in the transaction, in wei. + * Example: `"value": "0xde0b6b3a7640000"` +* **`data`** (optional, string): The data payload of the transaction, typically used for contract function calls or contract deployment. + * Example: `"data": "0x606060..."` +* **`nonce`** (optional, string): The transaction count of the `from` address. + * Example: `"nonce": "0x1"` + +### Return Object + +The return value of the `eth_estimateGas` method is a single field: + +* `gasEstimate` (string): The estimated gas cost for the transaction, represented as a hexadecimal string. + * Example: `"0x5208"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "eth_estimateGas", + "params": [ + { + "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "value": "0xde0b6b3a7640000", + "data": "0x606060..." + } + ] +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x5208" +} +``` diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_gasprice.md b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_gasprice.md new file mode 100644 index 0000000..46b551e --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_gasprice.md @@ -0,0 +1,61 @@ +# eth\_gasPrice + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const gasPrice = await tatum.rpc.gasPrice() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_gasPrice` method is an JSON-RPC method used to estimate the average gas price required for transactions in the network. This method provides a suggestion for the gas price to be used in a transaction to increase the likelihood of it being mined and included in a block in a reasonable amount of time. The `eth_gasPrice` method is particularly useful for developers and users who want to create and send transactions, as it helps them estimate the appropriate gas price to ensure timely processing. + +### Parameters + +The `eth_gasPrice` method does not require any parameters. + +### Return Value + +The `eth_gasPrice` method returns a single value as a hexadecimal string: + +* `gasPrice`: The estimated average gas price in wei. Example: `"0x4a817c800"` + +### JSON-RPC Request and Response Examples + +#### Request + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_gasPrice", + "params": [] +} +``` + +#### Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4a817c800" +} +``` + +By using the `eth_gasPrice` method, developers and users can estimate the appropriate gas price for their transactions, improving the overall user experience and ensuring that their transactions are processed in a timely manner. diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_maxpriorityfeepergas.md b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_maxpriorityfeepergas.md new file mode 100644 index 0000000..910e4d6 --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_maxpriorityfeepergas.md @@ -0,0 +1,63 @@ +# eth\_maxPriorityFeePerGas + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const gasPrice = await tatum.rpc.maxPriorityFeePerGas() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_maxPriorityFeePerGas` RPC method is used to retrieve the maximum priority fee per gas set by the user for a transaction. This method can be used to determine the maximum fee that can be paid for a transaction to be included in a block quickly. + +### Use case + +This method is particularly useful when the user wants to ensure that a transaction is processed quickly, even in a congested network where transaction fees may fluctuate rapidly. By setting a high maximum priority fee per gas, the user can ensure that the transaction is processed as quickly as possible. + +### Parameters + +`None.` + +## Return Object + +* `maxPriorityFeePerGas` - The maximum priority fee per gas the user is willing to pay, in wei. + +### JSON Examples + +#### Request + +```json +{ + "jsonrpc": "2.0", + "method": "eth_maxPriorityFeePerGas", + "params": [], + "id": 1 +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": "0x3b9aca00" +} +``` + +\ diff --git a/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_sendrawtransaction.md b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_sendrawtransaction.md new file mode 100644 index 0000000..fe7fddc --- /dev/null +++ b/docs/rpc/tron-rpc-documentation/evm-methods/transaction/eth_sendrawtransaction.md @@ -0,0 +1,63 @@ +# eth\_sendRawTransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Tron, Network } from '@tatumio/tatum' + +// Initialize the SDK for the TRON network +const tatum = await TatumSDK.init({network: Network.TRON}) + +const gasPrice = await tatum.rpc.sendRawTransaction('0x0000.......') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `eth_sendRawTransaction` RPC method is used to send a signed and serialized transaction to the network. This method is particularly useful when you want to have full control over the signing process, e.g., when using hardware wallets, cold storage, or custom signing libraries. It can be utilized in various use cases, such as transferring, interacting with smart contracts, or deploying new contracts. + +### Parameters + +The method accepts a single parameter: + +* **`data`**: The signed and serialized transaction data as a hexadecimal string. + +### Return Value + +The method returns a single value: + +* `transactionHash`: The hash of the submitted transaction as a hexadecimal string, e.g., `"0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b"`. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sendRawTransaction", + "params": [ + "0xf86d8201...94a7bc" + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" +} +``` + +\ diff --git a/docs/rpc/utxo-blockchains/README.md b/docs/rpc/utxo-blockchains/README.md new file mode 100644 index 0000000..b635aa8 --- /dev/null +++ b/docs/rpc/utxo-blockchains/README.md @@ -0,0 +1,22 @@ +--- +description: >- + TXO blockchains, short for Unspent Transaction Output blockchains, are a + specific type of distributed ledger technology used in various + cryptocurrencies like Bitcoin, Litecoin, and Bitcoin Cash. +--- + +# UTXO Blockchains + +In UTXO blockchains, transactions are represented as a collection of unspent outputs from previous transactions, which become inputs for new transactions. Each output represents an unspent amount of cryptocurrency, and when used as input in a new transaction, it is consumed and divided into new outputs, creating a chain of transaction outputs that can be traced back to the original unspent coins. This UTXO model provides a unique approach to handling transactions, offering advantages in terms of privacy, security, and efficiency in certain scenarios. + +{% content-ref url="bitcoin-rpc-documentation/" %} +[bitcoin-rpc-documentation](bitcoin-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="litecoin-rpc-documentation/" %} +[litecoin-rpc-documentation](litecoin-rpc-documentation/) +{% endcontent-ref %} + +{% content-ref url="dogecoin-rpc-documentation/" %} +[dogecoin-rpc-documentation](dogecoin-rpc-documentation/) +{% endcontent-ref %} diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/README.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/README.md new file mode 100644 index 0000000..79745ae --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/README.md @@ -0,0 +1,10 @@ +# Bitcoin RPC documentation + +Bitcoin RPC (Remote Procedure Call) is an essential tool for developers seeking to interact with the Bitcoin blockchain network. It provides a standardised interface for communication, enabling developers to retrieve data, send transactions, deploy smart contracts, and more. Bitcoin RPC plays a vital role in building decentralised applications, integrating blockchain functionality, and exploring the vast ecosystem of Bitcoin. \ + + +## Getting Started with Bitcoin RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/swsbEP9cMPI" %} + +In this video tutorial, we will walk you through the process of getting started with Bitcoin RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including Bitcoin. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Bitcoin network via RPC, and perform common operations such as retrieving all the transactions, & getting the Block hash by the block number. Whether you are a beginner or an experienced developer, this tutorial will provide you with the necessary steps to kickstart your web3 app development journey on Bitcoin. diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/README.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/README.md new file mode 100644 index 0000000..ab4eb02 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/README.md @@ -0,0 +1,2 @@ +# Helper Functions + diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/validateaddress.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/validateaddress.md new file mode 100644 index 0000000..583d979 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/validateaddress.md @@ -0,0 +1,86 @@ +# validateaddress + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.validateAddress("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`validateaddress` is a Bitcoin RPC method that enables users to verify if a given Bitcoin address is valid. This method provides important information about the address, such as its type and whether it's a spendable or watch-only address. It can be particularly useful in applications where address validation is necessary before performing transactions or when dealing with user-generated addresses to ensure their validity. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOrJoX" %} + +### Parameters + +The `validateaddress` method accepts one required parameter: + +* `address` (string, required): The Bitcoin address to be validated. + +### Return Object + +The `validateaddress` method returns an object with the following fields: + +* `isvalid` (boolean): Indicates if the supplied address is valid. +* `address` (string): The validated Bitcoin address. +* `scriptPubKey` (string): The hex-encoded scriptPubKey generated by the address. +* `isscript` (boolean): Indicates if the address is a script address (P2SH). +* `iswitness` (boolean): Indicates if the address is a witness address (P2WPKH or P2WSH). +* `witness_version` (numeric, optional): The version number of the witness program, if applicable. +* `witness_program` (string, optional): The hex value of the witness program, if applicable. +* `isspendable` (boolean): Indicates if the address is spendable (has the private key). +* `iswatchonly` (boolean): Indicates if the address is watch-only (wallet has the public key but not the private key). +* `iscompressed` (boolean, optional): Indicates if the associated public key is compressed. +* `account` (string, optional): DEPRECATED. The account associated with the address, if any. Example: + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "validateaddress", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "isvalid": true, + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "scriptPubKey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "isscript": false, + "iswitness": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/verifymessage.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/verifymessage.md new file mode 100644 index 0000000..c9392cb --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/helper-functions/verifymessage.md @@ -0,0 +1,72 @@ +# verifymessage + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.verifyMessage( "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", "Hello, this is a signed message.") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`verifymessage` is a Bitcoin RPC method that allows users to verify a signed message using a Bitcoin address. This method can be used to confirm the authenticity of a message by verifying that the signature was created by the owner of the address, without revealing the private key. Use cases include proving ownership of an address, verifying the content of a message, or validating communications within a trustless system. + +### Parameters + +The `verifymessage` method accepts three required parameters: + +* `address` (string, required): The Bitcoin address that supposedly signed the message. +* `signature` (string, required): The base64-encoded signature of the message. +* `message` (string, required): The message that was signed. + +### Return Object + +The `verifymessage` method returns a single boolean value: + +* `isvalid` (boolean): Indicates if the signature is valid for the given message and address + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifymessage", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", +"HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", + "Hello, this is a signed message." + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": false, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/README.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolancestors.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolancestors.md new file mode 100644 index 0000000..1b4ed59 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolancestors.md @@ -0,0 +1,71 @@ +# getmempoolancestors + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getMempoolAncestors("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getmempoolancestors` is a Bitcoin RPC method that returns information about the ancestors of a transaction in the memory pool. This method can be used to analyze the dependency relationships between unconfirmed transactions and to investigate potential transaction issues, such as chains of unconfirmed transactions or transactions that depend on others with a low fee. + +### Parameters + +* `txid`: The transaction ID (string, required) of the transaction for which you want to retrieve the ancestors. +* `verbose`: Whether to return a JSON object with detailed information about the ancestors (bool, optional, default = false). If `false`, only the transaction IDs of the ancestors are returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of an ancestor. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the ancestors, and the values are JSON objects containing detailed information about the ancestors. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempoolancestors", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempooldescendants.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempooldescendants.md new file mode 100644 index 0000000..4114558 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempooldescendants.md @@ -0,0 +1,71 @@ +# getmempooldescendants + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getMempoolDescendants("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempooldescendants` RPC method allows you to retrieve information about the descendant transactions of a specified transaction in the memory pool. This method is useful for understanding the relationships between unconfirmed transactions and the possible effects of their confirmation on the overall transaction fees and network congestion. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction for which you want to get its descendants. +* `verbose`: (boolean, optional, default=`false`) If set to `true`, detailed information about each descendant transaction will be returned, otherwise only the transaction IDs will be returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of a descendant. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the descendants, and the values are JSON objects containing detailed information about the descendants. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempooldescendants", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolentry.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolentry.md new file mode 100644 index 0000000..8c68e6c --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolentry.md @@ -0,0 +1,100 @@ +# getmempoolentry + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getMempoolEntry("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolentry` RPC method allows you to retrieve information about a specific transaction in the memory pool. This method is useful for tracking the status of unconfirmed transactions and for gathering additional details about their current state. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction you want to retrieve information about. + +### Return Object + +The return object will be an object containing information about the specified transaction. + +**Fields** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with fee deltas used for mining priority. +* `time`: (numeric) The local time the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions. +* `descendantsize`: (numeric) The virtual transaction size of all descendant transactions combined. +* `descendantfees`: (numeric) The total fees of all descendant transactions. +* `ancestorcount`: (numeric) The number of ancestor transactions. +* `ancestorsize`: (numeric) The virtual transaction size of all ancestor transactions combined. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions. +* `wtxid`: (string) The witness transaction ID of the transaction. +* `depends`: (array) An array containing the witness transaction IDs of the transactions this transaction depends on. +* `spentby`: (array) An array containing the witness transaction IDs of the transactions that spend this transaction. +* `bip125-replaceable`: (string) Whether the transaction is BIP125 replaceable. Possible values are "yes", "no", or "unknown". + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolentry", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "vsize": 203, + "weight": 809, + "time": 1682502684, + "height": 787068, + "descendantcount": 1, + "descendantsize": 203, + "ancestorcount": 1, + "ancestorsize": 203, + "wtxid": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "fees": { + "base": 0.00005481, + "modified": 0.00005481, + "ancestor": 0.00005481, + "descendant": 0.00005481 + }, + "depends": [], + "spentby": [], + "bip125-replaceable": false, + "unbroadcast": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolinfo.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolinfo.md new file mode 100644 index 0000000..00966da --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getmempoolinfo.md @@ -0,0 +1,82 @@ +# getmempoolinfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getMempoolInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolinfo` RPC method allows you to retrieve general information about the current memory pool. This method is useful for monitoring the state of the memory pool, such as its size, the total transaction fees, and the minimum fee rate required for transactions to be included in the next block. + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object will be an object containing general information about the current memory pool. + +**Fields** + +* `size`: (numeric) The number of transactions in the memory pool. +* `bytes`: (numeric) The total size of all transactions in the memory pool, in bytes. +* `usage`: (numeric) The total memory usage of the memory pool, in bytes. +* `maxmempool`: (numeric) The maximum memory usage of the memory pool, in bytes. +* `mempoolminfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be included in the memory pool. +* `minrelaytxfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be relayed across the network. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolinfo", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "loaded": true, + "size": 28338, + "bytes": 11367166, + "usage": 63671920, + "total_fee": 0.73841041, + "maxmempool": 4000000000, + "mempoolminfee": 0.00001, + "minrelaytxfee": 0.00001, + "incrementalrelayfee": 0.00001, + "unbroadcastcount": 0, + "fullrbf": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getrawmempool.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getrawmempool.md new file mode 100644 index 0000000..3acdfa0 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/mempool/getrawmempool.md @@ -0,0 +1,109 @@ +# getrawmempool + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getRawMemPool(true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawmempool` RPC method provides information on the transactions currently in the memory pool. This method is useful for getting details about unconfirmed transactions that have not yet been included in a block. + +### Parameters + +* `verbose` (boolean, optional, default=false): Set to `true` to receive a detailed JSON object for each transaction in the memory pool. Set to `false` to receive a simple array of transaction IDs. + +**Example** + +* `verbose`: `true` + +### Return Object + +The return object will depend on the value of the `verbose` parameter. + +* If `verbose` is set to `false`, the method will return an array of transaction IDs. +* If `verbose` is set to `true`, the method will return an object with transaction IDs as keys and detailed transaction information as values. + +**Fields (when verbose is true)** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with descendants in BTC. +* `time`: (numeric) The local time when the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions in the memory pool. +* `descendantsize`: (numeric) The total size of all descendant transactions in the memory pool, in bytes. +* `descendantfees`: (numeric) The total fees of all descendant transactions in the memory pool, in satoshis. +* `ancestorcount`: (numeric) The number of ancestor transactions in the memory pool. +* `ancestorsize`: (numeric) The total size of all ancestor transactions in the memory pool, in bytes. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions in the memory pool, in satoshis. +* `wtxid`: (string) The transaction witness ID. +* `depends`: (array) An array of unconfirmed transactions that this transaction depends on. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawmempool", + "params": [true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ +"result": { + "940352ce2be1f34f2a88ed32ba9bfcd01d4d8cbd68b79c88ce97115d1d8da8ce": { + "vsize": 151, + "weight": 602, + "time": 1682395086, + "height": 787063, + "descendantcount": 1, + "descendantsize": 151, + "ancestorcount": 2, + "ancestorsize": 1334, + "wtxid": "a824488001981d130794c9982afb0aeab3cdef25b5b9505b50ded0724308e976", + "fees": { + "base": 0.00000307, + "modified": 0.00000307, + "ancestor": 0.00002679, + "descendant": 0.00000307 + }, + "depends": [ + "e17275ca632c7083ce2f36415d4a52eda928901624e90f104c51696bc3338379" + ], + "spentby": [], + "bip125-replaceable": true, + "unbroadcast": false + } + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/README.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getbestblockhash.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getbestblockhash.md new file mode 100644 index 0000000..221da2b --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getbestblockhash.md @@ -0,0 +1,63 @@ +# getbestblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBestBlockHash() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getbestblockhash` is a Bitcoin RPC method that returns the hash of the best (tip) block in the longest blockchain. This method is useful for obtaining the latest block hash, which can be used to fetch block details or confirmations for transactions. + +{% embed url="https://codepen.io/tatum-devrel/pen/VwVggpJ" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is a string containing the hash of the best block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getbestblockhash" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": "0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e", + "error": null +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblock.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblock.md new file mode 100644 index 0000000..6e463e4 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblock.md @@ -0,0 +1,116 @@ +# getblock + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlock('000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblock` is a Bitcoin RPC method that returns information about a specified block. This method is useful for obtaining block details such as the hash, height, transactions, and other metadata. It can be used for various purposes, including validating transactions, monitoring the blockchain, and analyzing the network. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQGGwW" %} + +### Parameters + +* `blockhash` (required): The hash of the block to be retrieved. + * Example: `"0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e"` +* `verbosity` (optional): Specifies the level of detail returned for the block. + * `0`: Returns a serialized block as a hex-encoded string (default). + * `1`: Returns a JSON object with block information. + * `2`: Returns a JSON object with block information and detailed transaction data. + * Example: `1` + +### Return Object + +The returned object varies depending on the `verbosity` parameter: + +* If `verbosity` is `0`, the return object is a hex-encoded string of the serialized block. +* If `verbosity` is `1` or `2`, the return object is a JSON object containing the following fields: + * `hash`: The block hash. + * `confirmations`: The number of confirmations for the block. + * `strippedsize`: The block size without witness data. + * `size`: The block size. + * `weight`: The block weight. + * `height`: The block height. + * `version`: The block version. + * `versionHex`: The block version as a hex string. + * `merkleroot`: The Merkle root of the transactions in the block. + * `tx`: An array of transaction identifiers (if `verbosity` is `1`) or detailed transaction objects (if `verbosity` is `2`). + * `time`: The block time in UNIX timestamp format. + * `mediantime`: The median block time of the previous 11 blocks. + * `nonce`: The block nonce. + * `bits`: The block difficulty target as a hex string. + * `difficulty`: The block difficulty. + * `chainwork`: The total work in the blockchain up to this block. + * `nTx`: The number of transactions in the block. + * `previousblockhash`: The hash of the previous block. + * `nextblockhash`: The hash of the next block (if available). + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblock", + "params": [ + "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + 1 + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + "confirmations": 1, + "height": 787065, + "version": 536895488, + "versionHex": "20006000", + "merkleroot": "f4d9edf4e50ed243778b553ae0043683a2a9be84c0996f15b30e2e282e6bd2d8", + "time": 1682499730, + "mediantime": 1682496628, + "nonce": 1195457913, + "bits": "1705c739", + "difficulty": 48712405953118.43, + "chainwork": "000000000000000000000000000000000000000046b01da204f6db69fc714174", + "nTx": 4114, + "previousblockhash": "000000000000000000041dd53066beb0577142582ec56573b5260d915311c773", + "strippedsize": 770704, + "size": 1680952, + "weight": 3993064, + "tx": [ + "63b36961bd94b217382409ceb8ec2f3da3d35a24e962e66089946d333f1af82b" + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockchaininfo.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockchaininfo.md new file mode 100644 index 0000000..ca74b1b --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockchaininfo.md @@ -0,0 +1,93 @@ +# getblockchaininfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlockChainInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockchaininfo` is a Bitcoin RPC method that provides general information about the current state of the blockchain. This method is useful for obtaining an overview of the blockchain, including the best block hash, chain height, difficulty, and network protocol version. It can be used for various purposes, such as monitoring the blockchain, tracking network upgrades, and assessing the current mining difficulty. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOrrvd" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The return object is a JSON object containing the following fields: + +* `chain`: The current network name (e.g., "main", "test", or "regtest"). +* `blocks`: The number of blocks in the local best block chain. +* `headers`: The number of headers the local node has validated. +* `bestblockhash`: The hash of the best (tip) block. +* `difficulty`: The current mining difficulty. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `verificationprogress`: The estimate of the verification progress of the local node as a percentage. +* `initialblockdownload`: A boolean indicating whether the node is in the initial block download mode. +* `chainwork`: The total work in the blockchain up to the best block. +* `size_on_disk`: The estimated size of the block and undo files on disk. +* `pruned`: A boolean indicating whether the block chain is pruned. +* `pruneheight`: The lowest-height complete block stored if the node is pruned (only present if `pruned` is true). +* `softforks`: An array of objects, each containing information about a softfork. +* `bip9_softforks`: An object containing the status of BIP9 softforks in the blockchain. +* `warnings`: Any network and blockchain warnings. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockchaininfo" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "chain": "main", + "blocks": 787066, + "headers": 787066, + "bestblockhash": "00000000000000000005233c5202951a85538b047e62f4c12c25d9ff65e62f07", + "difficulty": 48712405953118.43, + "time": 1682501447, + "mediantime": 1682496904, + "verificationprogress": 0.9999996042025764, + "initialblockdownload": false, + "chainwork": "000000000000000000000000000000000000000046b049efeeebefbd7f5e5cd6", + "size_on_disk": 540374248868, + "pruned": false, + "warnings": "" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockcount.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockcount.md new file mode 100644 index 0000000..86bb25a --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockcount.md @@ -0,0 +1,63 @@ +# getblockcount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlockCount() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockcount` is a Bitcoin RPC method that returns the number of blocks in the local best blockchain. This method is useful for obtaining the current height of the blockchain, which can be used for various purposes, such as monitoring the blockchain, determining the number of confirmations for a transaction, or assessing the progress of the blockchain's growth. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQMMrQ" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is an integer representing the number of blocks in the local best blockchain. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockcount" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 787067, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockhash.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockhash.md new file mode 100644 index 0000000..8785aa3 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockhash.md @@ -0,0 +1,66 @@ +# getblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlockHash(587123) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockhash` is a Bitcoin RPC method that returns the block hash for a specified block height in the local best blockchain. This method is useful for obtaining the hash of a specific block, which can then be used to query for more detailed information about that block using other RPC methods, such as `getblock`. + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQPPmv" %} + +### Parameters + +* `height`: The height of the block for which the hash is requested. This is an integer parameter. + + Example: `587123` + +### Return Object + +The return object is a string representing the hash of the block at the specified height. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockhash", + "params": [587123], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockheader.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockheader.md new file mode 100644 index 0000000..cb1aa92 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockheader.md @@ -0,0 +1,103 @@ +# getblockheader + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlockHeader("0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockheader` is a Bitcoin RPC method that returns information about a specified block header. This method is useful for obtaining a high-level view of a specific block, including its hash, previous block hash, merkle root, timestamp, difficulty target, and nonce, without having to fetch the entire block's contents. + +{% embed url="https://codepen.io/tatum-devrel/pen/OJaddOX" %} + +### Parameters + +* `blockhash`: The hash of the block for which the header information is requested. This is a string parameter. + + Example: `"`0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f`"` +* `verbose` (optional): A boolean parameter that specifies whether to return the header information in a JSON object (true) or as a serialized hex-encoded string (false). Default is true. + + Example: `true` + +### Return Object + +If `verbose` is set to true (default), the return object is a JSON object containing the following fields: + +* `hash`: The hash of the block. +* `confirmations`: The number of confirmations for the block. +* `height`: The height of the block in the block chain. +* `version`: The block version. +* `versionHex`: The block version formatted as a hex string. +* `merkleroot`: The merkle root of the block. +* `time`: The block timestamp in UNIX format. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `nonce`: The nonce value for the block. +* `bits`: The encoded difficulty target for the block. +* `difficulty`: The actual difficulty target for the block as a decimal number. +* `chainwork`: The total work in the block chain up to this block. +* `nTx`: The number of transactions in the block. +* `previousblockhash`: The hash of the previous block. +* `nextblockhash`: The hash of the next block (only present if there is a next block). + +If `verbose` is set to false, the return object is a serialized hex-encoded string of the block header. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockheader", + "params": ["0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "confirmations": 199945, + "height": 587123, + "version": 549453824, + "versionHex": "20c00000", + "merkleroot": "06bc20da616f96fef435445cbf1bbcc9ff00896dd30c73b875aed7e06902666d", + "time": 1564152126, + "mediantime": 1564151358, + "nonce": 444284193, + "bits": "171f3a08", + "difficulty": 9013786945891.682, + "chainwork": "00000000000000000000000000000000000000000768b223a5622f8f0f1ac0a0", + "nTx": 1820, + "previousblockhash": "0000000000000000001683477bc3c17ab029412183952cb4a37f49968e16e6a8", + "nextblockhash": "00000000000000000007aeb07bc2fe4dbd0b55fc4be751050589b59fe95352fc" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockstats.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockstats.md new file mode 100644 index 0000000..58789e7 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getblockstats.md @@ -0,0 +1,137 @@ +# getblockstats + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getBlockStats("0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockstats` is a Bitcoin RPC method that returns various statistics about a specified block. This method is useful for obtaining detailed information about a block, including the number of transactions, transaction volume, fees, and other related data. The results can be used for data analysis, monitoring, and understanding the state of the Bitcoin network at a specific block height. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOrMba" %} +Try this function +{% endembed %} + +### Parameters + +* `hash_or_height`: The block hash or block height for which the statistics are requested. This parameter can be either a string (block hash) or an integer (block height). + + Example (block hash): `"0000000000000000000f92fb968a8d1a2a9c2039e6e99f8c7a0ee3421a44a7d6"` + + Example (block height): `685230` +* `stats` (optional): An array of strings indicating the statistics to be included in the response. If not specified, all available statistics will be returned. + + Example: `["txs", "avgfee"]` + +### Return Object + +The return object is a JSON object containing the requested statistics as key-value pairs. The available statistics are: + +* `avgfee`: The average transaction fee in satoshis. +* `avgfeerate`: The average fee rate in satoshis per virtual byte. +* `avgtxsize`: The average transaction size in bytes. +* `blockhash`: The hash of the block. +* `height`: The height of the block in the block chain. +* `ins`: The total number of inputs in all transactions. +* `maxfee`: The maximum transaction fee in satoshis. +* `maxfeerate`: The maximum fee rate in satoshis per virtual byte. +* `maxtxsize`: The maximum transaction size in bytes. +* `medianfee`: The median transaction fee in satoshis. +* `mediantime`: The median time for the block in UNIX timestamp format. +* `mediantxsize`: The median transaction size in bytes. +* `minfee`: The minimum transaction fee in satoshis. +* `minfeerate`: The minimum fee rate in satoshis per virtual byte. +* `mintxsize`: The minimum transaction size in bytes. +* `outs`: The total number of outputs in all transactions. +* `subsidy`: The block reward in satoshis. +* `swtotal_size`: The total size of all SegWit transactions in bytes. +* `swtotal_weight`: The total weight of all SegWit transactions. +* `swtxs`: The total number of SegWit transactions. +* `time`: The block timestamp in UNIX format. +* `total_size`: The total size of all transactions in bytes. +* `total_weight`: The total weight of all transactions. +* `totalfee`: The total transaction fees in satoshis. +* `txs`: The total number of transactions in the block. +* `utxo_increase`: The increase in the number of unspent transaction outputs. +* `utxo_size_inc`: The increase in the size of the UTXO set. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockstats", + "params": ["0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "avgfee": 10220, + "avgfeerate": 18, + "avgtxsize": 619, + "blockhash": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "feerate_percentiles": [ + 6, + 9, + 9, + 15, + 48 + ], + "height": 587123, + "ins": 3615, + "maxfee": 419448, + "maxfeerate": 393, + "maxtxsize": 17196, + "medianfee": 9528, + "mediantime": 1564151358, + "mediantxsize": 374, + "minfee": 136, + "minfeerate": 1, + "mintxsize": 189, + "outs": 3617, + "subsidy": 1250000000, + "swtotal_size": 323742, + "swtotal_weight": 777804, + "swtxs": 616, + "time": 1564152126, + "total_out": 342467209172, + "total_size": 1127251, + "total_weight": 3991840, + "totalfee": 18590521, + "txs": 1820, + "utxo_increase": 2, + "utxo_size_inc": 4000 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getchaintips.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getchaintips.md new file mode 100644 index 0000000..d38cc81 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getchaintips.md @@ -0,0 +1,231 @@ +# getchaintips + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getChainTips() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getchaintips` is a Bitcoin RPC method that returns information about all known tips in the block tree. This method is useful for identifying and analyzing potential forks or alternative chains in the Bitcoin network. It can be used to monitor the health and status of the network or to investigate discrepancies in blockchain data. + +{% embed url="https://codepen.io/tatum-devrel/pen/JjexVoW" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object is an array of JSON objects, with each object representing a chain tip. The fields in each object are: + +* `height`: The height of the chain tip in the block chain. +* `hash`: The hash of the block corresponding to the chain tip. +* `branchlen`: The length of the branch connected to the main chain. +* `status`: The status of the chain tip, which can be one of the following values: + * `active`: The tip is part of the main chain. + * `valid-fork`: The tip is part of a valid but inactive fork. + * `valid-headers`: The tip is part of a valid fork but with incomplete block data. + * `headers-only`: The tip is a fork with valid headers but incomplete block data and an invalid parent block. + * `invalid`: The tip is part of an invalid fork. + * `unknown`: The tip has an unknown validation state. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getchaintips", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + { + "height": 787067, + "hash": "0000000000000000000348522f4f24304bfcadece8b34c0696faa4f87ec4fdc4", + "branchlen": 0, + "status": "active" + }, + { + "height": 784121, + "hash": "000000000000000000046a2698233ed93bb5e74ba7d2146a68ddb0c2504c980d", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 783830, + "hash": "0000000000000000000366d2c12772a350f507879a5325203424e58ec440249b", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783478, + "hash": "0000000000000000000446f7d3093688ae697386fed3f52a63812678ea6b251d", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783426, + "hash": "00000000000000000002ec935e245f8ae70fc68cc828f05bf4cfa002668599e4", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 782333, + "hash": "00000000000000000001a1abda3a2eb4acc211f64f8748d1a7635aad80690b7a", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 782129, + "hash": "000000000000000000036f461ab63c78f08401d3907a67fd2237166d8a373193", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 781487, + "hash": "0000000000000000000125e5d7c0d2e1b83982e5284ea21e08f5a73b8109d41b", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 781277, + "hash": "0000000000000000000388f42000fa901c01f2bfae36042bbae133ee430e6485", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 780994, + "hash": "00000000000000000001b666391fe81859e96fdfdbb83f1a1eafb7951c738c77", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 777172, + "hash": "0000000000000000000215ac1b6fd564d8d4707631f6b77273521eb1e242cf28", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 776941, + "hash": "00000000000000000004cc87382e38118248ec926716565d50d63f0637c22c07", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 772981, + "hash": "0000000000000000000682990a0dae862b48e0451d619938215dd47ed9560200", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771745, + "hash": "00000000000000000004370a77a30add64bba97c26a90ca9643b45a75219b2a6", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771627, + "hash": "00000000000000000005a92bdb6f9d55ea8d2b42579e0db6ca7764f97b6910e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 763445, + "hash": "000000000000000000065d0f6847466feeeaffa9663895cedde33aa12c262e00", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 759781, + "hash": "000000000000000000025edbf5ea025e4af2674b318ba82206f70681d97ca162", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 741082, + "hash": "00000000000000000004e2891d08337eb9263b703eb1c897e05dc59e8b246a9b", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 737096, + "hash": "00000000000000000002b07a9a9f066d463844960542d96e88b4815e063fab08", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 733430, + "hash": "00000000000000000006ead1cff09f279f7beb31a7290c2a603b0776d98dc334", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 730848, + "hash": "000000000000000000029ec31578132d01696910f299f8d104f29b8f8bbdc24f", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 723102, + "hash": "00000000000000000006a970fdd8e537521747aff917d909bf3a78b4b68143e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715276, + "hash": "00000000000000000009b160476c5f407ccd4957e20346b862d8fc46004759f0", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715139, + "hash": "0000000000000000000407bc4e26035c137869cdb677dfcab268b3faf7d7b5d1", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 714637, + "hash": "00000000000000000009f819d004fea5bcb77bda25f4906d0a39e79c9ba19590", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 714367, + "hash": "0000000000000000000b2e70d7675bc7b4e89d384d0e6e1a7ecc2779e1d93244", + "branchlen": 1, + "status": "valid-headers" + } + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getdifficulty.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getdifficulty.md new file mode 100644 index 0000000..e8a7eef --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/getdifficulty.md @@ -0,0 +1,65 @@ +# getdifficulty + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getDifficulty() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getdifficulty` is a Bitcoin RPC method that returns the current mining difficulty. The mining difficulty is a measure of how difficult it is to find a new block compared to the easiest it can ever be. This method can be used to monitor the mining difficulty, which adjusts every 2016 blocks to maintain a consistent block creation rate of approximately 10 minutes per block. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyOQbK" %} +Try this feature +{% endembed %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +A return object is a floating-point number that represents the current mining difficulty. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getdifficulty", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 48712405953118.43, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxout.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxout.md new file mode 100644 index 0000000..af133af --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxout.md @@ -0,0 +1,98 @@ +# gettxout + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getTxOut("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", 1) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxout` RPC method returns details about an unspent transaction output (UTXO). This method can be used to check if a specific transaction output is still unspent and obtain its details such as the value and scriptPubKey. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQqyad" %} +Try this function +{% endembed %} + +### Parameters + +* `txid` (string, required): The transaction ID of the output. +* `n` (numeric, required): The index of the output within the transaction (vout). +* `include_mempool` (boolean, optional, default=true): Whether to include the mempool. Set to `false` to only check for outputs confirmed in the blockchain. + +**Example** + +* `txid`: `"a12345abcdef67890bcdef1234567890abcdef1234567890abcdef1234567890"` +* `n`: `1` +* `include_mempool`: `true` + +### Return Object + +The return object contains the following fields: + +* `bestblock`: (string) The hash of the block at the tip of the blockchain. +* `confirmations`: (numeric) The number of confirmations for the transaction. -1 if the transaction is not yet confirmed and in the mempool. +* `value`: (numeric) The value of the output in BTC. +* `scriptPubKey`: (object) Information about the output's scriptPubKey. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex representation of the script. + * `type`: (string) The type of the script (e.g., `pubkeyhash`, `scripthash`). + * `addresses`: (array) The Bitcoin addresses associated with this output. +* `coinbase`: (boolean) Whether the transaction is a coinbase transaction. +* `version`: (numeric) The transaction version. +* `height`: (numeric) The height of the block containing this output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxout", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", 1], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "bestblock": "00000000000000000000bb252e11a381e2d9ee948dd8f2c9df9b7cb41adc40b2", + "confirmations": 5, + "value": 0.0027, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + }, + "coinbase": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxoutproof.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxoutproof.md new file mode 100644 index 0000000..f268fcf --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/gettxoutproof.md @@ -0,0 +1,72 @@ +# gettxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getTxOutProof(["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxoutproof` RPC method returns a hex-encoded proof that the specified transaction(s) were included in a block. This method can be used to provide proof of inclusion for one or more transactions in the blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGMEjv" %} +Try the function +{% endembed %} + +### Parameters + +* `txids` (array, required): An array of transaction IDs to create a proof for. +* `blockhash` (string, optional): The hash of the block that contains the transactions. If not provided, the method will search for the transactions in the most recent blocks. + +**Example** + +* `txids`: `["`c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2`"]` +* `blockhash`: `"`00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2`"` + +### Return Object + +* `hex`: (string) The hex-encoded proof of the transaction(s) inclusion in the block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxoutproof", + "params": [["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "00800020208d9c3576f57c3f0c35bd94440f37fe7971cf2b914001000000000000000000db47732e70243f1ae818f635ae4f5cacbacf1230f4dc226f0e62c0871d6e8692a4f5486439c705171a71df638e1100000e8c9aa54adefc4c7b9ccd760b4ee1369bdd5cc7cb8b3e426b4a3b490c2eee5473e8f8f4134d4035e4241a929b9cdac2c22b6d74e0cae88e9ad1f50eeba06ae52659f1c0be83c1705e6642336d47356c39632ca55d11c04f24d09132fd081f5144caf6c733deed2366cd75a4e5a355920cd31c889239e78e195fb15435451f82398b683b27258ff3523cf63a276f38ffe296dd541b99f80cc87ecb40f473e1af2656ac06a0d999105c71c293e571bb62bdd3f0509fe8d5be381d92a76d1659cafcfea20ac316c4cc72a4d81fd7e9d94227cf6457d5412e4ef0d0b32e195a092321e1ad6c16ff7c6a28b39104f3e38a21775f4ea730b25269de7a54eb4dee8752735fe3e7add927cb2f0813a5bddda182776a559d7ba91c3580fb55e49a0bef8186f274f6dccad47742cdab8d3cab06c26c1336a23675bbc2ad36d1396ae451adc759fa97499c565c252524eed6934be8f18f3784f1f7d74a1471c1778af5aa65b6e6ebb5c3625ce00ac09a644aaa8b0b86b679e65c9fa204582ac285368b97eaa7ef2c43019754f8a3e9442c9a6820a25b3d7037fe53ba9d89732f5835939225fa30b5d86694bb5fc5a384e799a22ae82017fb0cf95e70e7bb529725a81e0f96f704afaa5a00", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/verifytxoutproof.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/verifytxoutproof.md new file mode 100644 index 0000000..68aca08 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/network-state/verifytxoutproof.md @@ -0,0 +1,68 @@ +# verifytxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.verifyTxOutProof("") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `verifytxoutproof` RPC method verifies the given transaction proof (in the form of a Merkle block) and returns an array of transaction hashes contained in the verified Merkle block. This method can be used to confirm that specific transactions are included in a block without having to download the entire block. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQNZWO" %} + +### Parameters + +* `proof`: (string, required) The hex-encoded proof generated by the `gettxoutproof` RPC method. + +### Return Object + +* (array of strings) An array of transaction hashes contained in the verified Merkle block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifytxoutproof", + "params": [ + "00000020fc61cc9f1bda9ef9e5d6bcccc7f210a0e87e7ccbc017d8487031b91d0000000047451bc9b84a546eafbe39baedb3cda967ea57cf1ab650b24d88395f2e4e3d413e4f22e8d9d9ea1c000000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a01000000434104e70b81e35e7cf03f6238471f7d9c903d48aea7c1d067e3010b9000000000000" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + "3e4f22e8d9d9ea1c123456789abcdef0123456789abcdef0123456789abcdef" + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/README.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/README.md new file mode 100644 index 0000000..30549c3 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/README.md @@ -0,0 +1,2 @@ +# Transactions + diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/createrawtransaction.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/createrawtransaction.md new file mode 100644 index 0000000..d2c45d7 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/createrawtransaction.md @@ -0,0 +1,89 @@ +# createrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.createRawTransaction([ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `createrawtransaction` RPC method creates an unsigned raw transaction that spends a set of previous transaction outputs to a set of new addresses with specific amounts. The method can be used to create custom transactions, which can then be signed and broadcasted to the Bitcoin network. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQGBNv" %} + +### Parameters + +* `inputs`: (array, required) An array of objects, each specifying a previous transaction output to spend. + * `txid`: (string, required) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric, required) The index of the output to spend from the previous transaction. + * `sequence`: (numeric, optional) default=depends on the value of the 'replaceable' and 'locktime' arguments) The sequence number +* `outputs`: (object, required) An object with the key-value pairs representing the receiving address and the amount to be sent (in BTC). +* `locktime`: (numeric, optional, default=0) The lock time for the transaction. It can be used to specify the earliest time or block height at which the transaction can be included in a block. +* `replaceable`: (boolean, optional, default=false) **Marks this transaction as BIP125-replaceable.** Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible. + +### Return Object + +* (string) A hex-encoded raw transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "createrawtransaction", + "params": [ + [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + } + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decoderawtransaction.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decoderawtransaction.md new file mode 100644 index 0000000..29bc39f --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decoderawtransaction.md @@ -0,0 +1,120 @@ +# decoderawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.decodeRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decoderawtransaction` RPC method decodes a serialized (hex-encoded) raw transaction and displays its information in a human-readable format. This method is useful for inspecting raw transactions before broadcasting them to the Bitcoin network or for debugging purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQMegr" %} + +### Parameters + +* `hex_string`: (string, required) The serialized raw transaction in hex format. + +### Return Object + +An object containing the decoded raw transaction information: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size in bytes. +* `vsize`: (numeric) The virtual transaction size in bytes. +* `weight`: (numeric) The transaction weight. +* `locktime`: (numeric) The lock time for the transaction. +* `vin`: (array) An array of objects, each representing an input of the transaction. + * `txid`: (string) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric) The index of the output to spend from the previous transaction. + * `scriptSig`: (object) The script used to redeem the previous transaction output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `sequence`: (numeric) The sequence number. +* `vout`: (array) An array of objects, each representing an output of the transaction. + * `value`: (numeric) The amount sent to the output in BTC. + * `n`: (numeric) The index of the output. + * `scriptPubKey`: (object) The script used to lock the output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `reqSigs`: (numeric) The required number of signatures. + * `type`: (string) The type of the script (e.g., 'pubkeyhash'). + * `addresses`: (array) An array of Bitcoin addresses associated with the output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decoderawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "hash": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "version": 2, + "size": 85, + "vsize": 85, + "weight": 340, + "locktime": 0, + "vin": [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0, + "scriptSig": { + "asm": "", + "hex": "" + }, + "sequence": 4294967293 + } + ], + "vout": [ + { + "value": 0.01, + "n": 0, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG", + "desc": "addr(1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa)#632p52jr", + "hex": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "type": "pubkeyhash" + } + } + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decodescript.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decodescript.md new file mode 100644 index 0000000..b1c8dac --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/decodescript.md @@ -0,0 +1,75 @@ +# decodescript + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.decodeScript("3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decodescript` RPC method decodes a serialized (hex-encoded) script and provides information about the script in a human-readable format. This method is useful for inspecting scripts for debugging purposes or for understanding their structure. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJYPpL" %} + +### Parameters + +* `hex_string`: (string, required) The serialized script in hex format. + +### Return Object + +An object containing the decoded script information: + +* `asm`: (string) The assembly representation of the script. +* `hex`: (string) The hex-encoded script. +* `type`: (string) The type of the script (e.g., 'pubkeyhash', 'multisig'). +* `reqSigs`: (numeric, optional) The required number of signatures if the script is a multisig script. +* `addresses`: (array, optional) An array of Bitcoin addresses associated with the script if applicable. +* `p2sh`: (string, optional) The P2SH address for this script if applicable. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decodescript", + "params": ["3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "asm": "44022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86 OP_MAX OP_UNKNOWN OP_UNKNOWN [error]", + "desc": "raw(3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501)#3x5hf724", + "type": "nonstandard" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/estimatesmartfee.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/estimatesmartfee.md new file mode 100644 index 0000000..7d82e1d --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/estimatesmartfee.md @@ -0,0 +1,75 @@ +# estimatesmartfee + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.estimateSmartFee(20) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `estimatesmartfee` method provides an estimated fee rate (in BTC/kB) for a transaction to be confirmed within a certain number of blocks. The estimation is based on recent transactions in the Bitcoin network. + +This method can be useful for users or applications trying to decide on an appropriate fee for their transactions, based on the desired confirmation speed. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGMEQb" %} + +### Parameters + +The `estimatesmartfee` method accepts the following parameters: + +* `conf_target`: An integer representing the number of blocks within which the transaction should be confirmed. +* `estimate_mode` _(optional)_: A string that determines the estimation mode. Possible values are "UNSET", "ECONOMICAL", and "CONSERVATIVE". Default is "CONSERVATIVE". + +### Return Object + +The `estimatesmartfee` method returns an object containing the following fields: + +* `feerate`: A decimal number representing the estimated fee rate in BTC/kB. +* `blocks`: An integer representing the number of blocks within which the transaction is expected to be confirmed. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "estimatesmartfee", + "params": [20], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "feerate": 0.00017258, + "blocks": 20 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/getrawtransaction.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/getrawtransaction.md new file mode 100644 index 0000000..b5684ae --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/getrawtransaction.md @@ -0,0 +1,166 @@ +# getrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.getRawTransaction("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawtransaction` RPC method retrieves a raw transaction from the blockchain or mempool. It returns the serialized (hex-encoded) transaction data. This method can be used to inspect a transaction's content before it's included in a block or to decode the transaction for further analysis. + +{% embed url="https://codepen.io/tatum-devrel/pen/oNQmOYp" %} + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction to fetch. +* `verbose`: (bool, optional, default=false) If set to `true`, the method returns a JSON object containing information about the transaction. + +### Return Object + +If `verbose` is `false`, the method returns a hex-encoded string representing the serialized transaction data. If `verbose` is `true`, the method returns a JSON object with the following fields: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size. +* `vsize`: (numeric) The virtual transaction size. +* `weight`: (numeric) The transaction's weight. +* `locktime`: (numeric) The transaction locktime. +* `vin`: (array) The transaction inputs. Each object within the array has the following properties: + 1. `txid`: A string representing the transaction ID of the output being spent. This refers to the transaction where the bitcoin being spent in the current transaction was received. + 2. `vout`: An integer representing the index of the output in the transaction specified by `txid`. This is the position of the output in that transaction's `vout` array. + 3. `scriptSig`: An object containing two fields, `asm` and `hex`, which represent the unlocking script that satisfies the conditions of the spent output's locking script. `asm` contains the assembly representation of the script, while `hex` contains the hexadecimal representation. + 4. `sequence`: A number representing the sequence number of the input. It can be used to signal relative locktime constraints on the transaction. +* `vout`: (array) The transaction outputs. Each object within the array has the following properties: + 1. `value`: A decimal number representing the amount of bitcoin being sent to the output's address. This value is expressed in bitcoins (BTC). + 2. `n`: An integer representing the index of the output in the transaction's `vout` array. + 3. `scriptPubKey`: An object containing information about the locking script used to lock the output. The object has the following fields: + * `asm`: The assembly representation of the locking script. + * `hex`: The hexadecimal representation of the locking script. + * `reqSigs`: The number of required signatures to unlock the output (relevant for multisig addresses). + * `type`: The type of the locking script (e.g., 'pubkeyhash', 'scripthash', 'multisig', etc.). + * `addresses`: An array of Bitcoin addresses associated with the output. +* `hex`: (string) The serialized transaction data in hex format. +* `blockhash`: (string, optional) The block hash containing the transaction. +* `confirmations`: (numeric, optional) The number of confirmations the transaction has. +* `time`: (numeric, optional) The transaction time in UNIX timestamp format. +* `blocktime`: (numeric, optional) The block time in UNIX timestamp format. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawtransaction", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "hash": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "version": 2, + "size": 284, + "vsize": 203, + "weight": 809, + "locktime": 0, + "vin": [ + { + "txid": "aaeb16390ca5209d8c72a0090a9ca87e6ff6491f239b3496cdb5c99977643583", + "vout": 9, + "scriptSig": { + "asm": "", + "hex": "" + }, + "txinwitness": [ + "3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501", + "03c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c0" + ], + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 0.00112825, + "n": 0, + "scriptPubKey": { + "asm": "0 29a7007eabae2ac56f221aad9c983b77a9f96c3b", + "desc": "addr(bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k)#3al0qk8v", + "hex": "001429a7007eabae2ac56f221aad9c983b77a9f96c3b", + "address": "bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.0027, + "n": 1, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.00104468, + "n": 2, + "scriptPubKey": { + "asm": "0 c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "desc": "addr(bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa)#5rw0gs2m", + "hex": "0014c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "address": "bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.41658346, + "n": 3, + "scriptPubKey": { + "asm": "0 b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "desc": "addr(bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4)#savgw9p6", + "hex": "0014b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "address": "bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4", + "type": "witness_v0_keyhash" + } + } + ], + "hex": "020000000001018335647799c9b5cd96349b231f49f66f7ea89c0a09a0728c9d20a50c3916ebaa0900000000feffffff04b9b801000000000016001429a7007eabae2ac56f221aad9c983b77a9f96c3bb01e04000000000016001424007ed98749dbb504fdea2bd07715c94d4c77511498010000000000160014c4c04e31613e2c3dfadaedde383bbfdd7a107d8aeaa77b0200000000160014b33b0a68aba1d4697d8329f2b7939fb2a46b733202473044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c85012103c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c000000000", + "blockhash": "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2", + "confirmations": 7, + "time": 1682503076, + "blocktime": 1682503076 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/sendrawtransaction.md b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/sendrawtransaction.md new file mode 100644 index 0000000..dd5ef53 --- /dev/null +++ b/docs/rpc/utxo-blockchains/bitcoin-rpc-documentation/transactions/sendrawtransaction.md @@ -0,0 +1,67 @@ +# sendrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const result = await tatum.rpc.sendRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `sendrawtransaction` method submits a serialized raw transaction to the Bitcoin network. If the transaction is well-formed and valid, it will be propagated to the network and included in a mined block. + +This method is commonly used in conjunction with [`createrawtransaction`](createrawtransaction.md), or other methods to construct and sign raw transactions before broadcasting them. + +### Parameters + +The `sendrawtransaction` method accepts the following parameters: + +* `hexstring`: A string representing the serialized raw transaction in hexadecimal format. + +### Return Object + +The `sendrawtransaction` method returns a string containing the transaction ID (txid) of the broadcasted transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "sendrawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/README.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/README.md new file mode 100644 index 0000000..2d7686e --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/README.md @@ -0,0 +1,3 @@ +# Dogecoin RPC documentation + +Dogecoin RPC (Remote Procedure Call) is a powerful tool for developers seeking to interact with the Litecoin blockchain network. It provides a standardised interface for communication, enabling developers to retrieve data, send transactions, deploy smart contracts, and more. Dogecoin RPC plays a vital role in building decentralised applications, integrating blockchain functionality, and exploring the diverse ecosystem of Litecoin. Getting Started with Dogecoin diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/README.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/README.md new file mode 100644 index 0000000..ab4eb02 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/README.md @@ -0,0 +1,2 @@ +# Helper Functions + diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/validateaddress.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/validateaddress.md new file mode 100644 index 0000000..36f99e2 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/validateaddress.md @@ -0,0 +1,86 @@ +# validateaddress + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.validateAddress("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`validateaddress` is an Dogecoin RPC method that enables users to verify if a given Dogecoin address is valid. This method provides important information about the address, such as its type and whether it's a spendable or watch-only address. It can be particularly useful in applications where address validation is necessary before performing transactions or when dealing with user-generated addresses to ensure their validity. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/OJaqWLp?editors=1111" %} + +### Parameters + +The `validateaddress` method accepts one required parameter: + +* `address` (string, required): The Dogecoin address to be validated. + +### Return Object + +The `validateaddress` method returns an object with the following fields: + +* `isvalid` (boolean): Indicates if the supplied address is valid. +* `address` (string): The validated Dogecoin address. +* `scriptPubKey` (string): The hex-encoded scriptPubKey generated by the address. +* `isscript` (boolean): Indicates if the address is a script address (P2SH). +* `iswitness` (boolean): Indicates if the address is a witness address (P2WPKH or P2WSH). +* `witness_version` (numeric, optional): The version number of the witness program, if applicable. +* `witness_program` (string, optional): The hex value of the witness program, if applicable. +* `isspendable` (boolean): Indicates if the address is spendable (has the private key). +* `iswatchonly` (boolean): Indicates if the address is watch-only (wallet has the public key but not the private key). +* `iscompressed` (boolean, optional): Indicates if the associated public key is compressed. +* `account` (string, optional): DEPRECATED. The account associated with the address, if any. Example: + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "validateaddress", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "isvalid": true, + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "scriptPubKey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "isscript": false, + "iswitness": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/verifymessage.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/verifymessage.md new file mode 100644 index 0000000..70d04bc --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/helper-functions/verifymessage.md @@ -0,0 +1,72 @@ +# verifymessage + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.verifyMessage( "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", "Hello, this is a signed message.") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`verifymessage` is an Dogecoin RPC method that allows users to verify a signed message using a Dogecoin address. This method can be used to confirm the authenticity of a message by verifying that the signature was created by the owner of the address, without revealing the private key. Use cases include proving ownership of an address, verifying the content of a message, or validating communications within a trustless system. + +### Parameters + +The `verifymessage` method accepts three required parameters: + +* `address` (string, required): The Dogecoin address that supposedly signed the message. +* `signature` (string, required): The base64-encoded signature of the message. +* `message` (string, required): The message that was signed. + +### Return Object + +The `verifymessage` method returns a single boolean value: + +* `isvalid` (boolean): Indicates if the signature is valid for the given message and address + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifymessage", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", +"HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", + "Hello, this is a signed message." + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": false, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/README.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolancestors.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolancestors.md new file mode 100644 index 0000000..c7c9d78 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolancestors.md @@ -0,0 +1,71 @@ +# getmempoolancestors + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getMempoolAncestors("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getmempoolancestors` is a Dogecoin RPC method that returns information about the ancestors of a transaction in the memory pool. This method can be used to analyze the dependency relationships between unconfirmed transactions and to investigate potential transaction issues, such as chains of unconfirmed transactions or transactions that depend on others with a low fee. + +### Parameters + +* `txid`: The transaction ID (string, required) of the transaction for which you want to retrieve the ancestors. +* `verbose`: Whether to return a JSON object with detailed information about the ancestors (bool, optional, default = false). If `false`, only the transaction IDs of the ancestors are returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of an ancestor. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the ancestors, and the values are JSON objects containing detailed information about the ancestors. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempoolancestors", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempooldescendants.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempooldescendants.md new file mode 100644 index 0000000..f526187 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempooldescendants.md @@ -0,0 +1,71 @@ +# getmempooldescendants + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getMempoolDescendants("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempooldescendants` RPC method allows you to retrieve information about the descendant transactions of a specified transaction in the memory pool. This method is useful for understanding the relationships between unconfirmed transactions and the possible effects of their confirmation on the overall transaction fees and network congestion. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction for which you want to get its descendants. +* `verbose`: (boolean, optional, default=`false`) If set to `true`, detailed information about each descendant transaction will be returned, otherwise only the transaction IDs will be returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of a descendant. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the descendants, and the values are JSON objects containing detailed information about the descendants. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempooldescendants", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolentry.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolentry.md new file mode 100644 index 0000000..c17bf16 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolentry.md @@ -0,0 +1,100 @@ +# getmempoolentry + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getMempoolEntry("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolentry` RPC method allows you to retrieve information about a specific transaction in the memory pool. This method is useful for tracking the status of unconfirmed transactions and for gathering additional details about their current state. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction you want to retrieve information about. + +### Return Object + +The return object will be an object containing information about the specified transaction. + +**Fields** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with fee deltas used for mining priority. +* `time`: (numeric) The local time the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions. +* `descendantsize`: (numeric) The virtual transaction size of all descendant transactions combined. +* `descendantfees`: (numeric) The total fees of all descendant transactions. +* `ancestorcount`: (numeric) The number of ancestor transactions. +* `ancestorsize`: (numeric) The virtual transaction size of all ancestor transactions combined. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions. +* `wtxid`: (string) The witness transaction ID of the transaction. +* `depends`: (array) An array containing the witness transaction IDs of the transactions this transaction depends on. +* `spentby`: (array) An array containing the witness transaction IDs of the transactions that spend this transaction. +* `bip125-replaceable`: (string) Whether the transaction is BIP125 replaceable. Possible values are "yes", "no", or "unknown". + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolentry", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "vsize": 203, + "weight": 809, + "time": 1682502684, + "height": 787068, + "descendantcount": 1, + "descendantsize": 203, + "ancestorcount": 1, + "ancestorsize": 203, + "wtxid": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "fees": { + "base": 0.00005481, + "modified": 0.00005481, + "ancestor": 0.00005481, + "descendant": 0.00005481 + }, + "depends": [], + "spentby": [], + "bip125-replaceable": false, + "unbroadcast": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolinfo.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolinfo.md new file mode 100644 index 0000000..eff8905 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getmempoolinfo.md @@ -0,0 +1,84 @@ +# getmempoolinfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getMempoolInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolinfo` RPC method allows you to retrieve general information about the current memory pool. This method is useful for monitoring the state of the memory pool, such as its size, the total transaction fees, and the minimum fee rate required for transactions to be included in the next block. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/poQYRoV" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object will be an object containing general information about the current memory pool. + +**Fields** + +* `size`: (numeric) The number of transactions in the memory pool. +* `bytes`: (numeric) The total size of all transactions in the memory pool, in bytes. +* `usage`: (numeric) The total memory usage of the memory pool, in bytes. +* `maxmempool`: (numeric) The maximum memory usage of the memory pool, in bytes. +* `mempoolminfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be included in the memory pool. +* `minrelaytxfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be relayed across the network. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolinfo", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "loaded": true, + "size": 28338, + "bytes": 11367166, + "usage": 63671920, + "total_fee": 0.73841041, + "maxmempool": 4000000000, + "mempoolminfee": 0.00001, + "minrelaytxfee": 0.00001, + "incrementalrelayfee": 0.00001, + "unbroadcastcount": 0, + "fullrbf": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getrawmempool.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getrawmempool.md new file mode 100644 index 0000000..7d4158b --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/mempool/getrawmempool.md @@ -0,0 +1,109 @@ +# getrawmempool + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getRawMemPool(true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawmempool` RPC method provides information on the transactions currently in the memory pool. This method is useful for getting details about unconfirmed transactions that have not yet been included in a block. + +### Parameters + +* `verbose` (boolean, optional, default=false): Set to `true` to receive a detailed JSON object for each transaction in the memory pool. Set to `false` to receive a simple array of transaction IDs. + +**Example** + +* `verbose`: `true` + +### Return Object + +The return object will depend on the value of the `verbose` parameter. + +* If `verbose` is set to `false`, the method will return an array of transaction IDs. +* If `verbose` is set to `true`, the method will return an object with transaction IDs as keys and detailed transaction information as values. + +**Fields (when verbose is true)** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with descendants in BTC. +* `time`: (numeric) The local time when the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions in the memory pool. +* `descendantsize`: (numeric) The total size of all descendant transactions in the memory pool, in bytes. +* `descendantfees`: (numeric) The total fees of all descendant transactions in the memory pool, in satoshis. +* `ancestorcount`: (numeric) The number of ancestor transactions in the memory pool. +* `ancestorsize`: (numeric) The total size of all ancestor transactions in the memory pool, in bytes. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions in the memory pool, in satoshis. +* `wtxid`: (string) The transaction witness ID. +* `depends`: (array) An array of unconfirmed transactions that this transaction depends on. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawmempool", + "params": [true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ +"result": { + "940352ce2be1f34f2a88ed32ba9bfcd01d4d8cbd68b79c88ce97115d1d8da8ce": { + "vsize": 151, + "weight": 602, + "time": 1682395086, + "height": 787063, + "descendantcount": 1, + "descendantsize": 151, + "ancestorcount": 2, + "ancestorsize": 1334, + "wtxid": "a824488001981d130794c9982afb0aeab3cdef25b5b9505b50ded0724308e976", + "fees": { + "base": 0.00000307, + "modified": 0.00000307, + "ancestor": 0.00002679, + "descendant": 0.00000307 + }, + "depends": [ + "e17275ca632c7083ce2f36415d4a52eda928901624e90f104c51696bc3338379" + ], + "spentby": [], + "bip125-replaceable": true, + "unbroadcast": false + } + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/README.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getbestblockhash.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getbestblockhash.md new file mode 100644 index 0000000..04f4bf3 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getbestblockhash.md @@ -0,0 +1,63 @@ +# getbestblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: DOGECOIN}) + +const result = await tatum.rpc.getBestBlockHash() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getbestblockhash` is a Dogecoin RPC method that returns the hash of the best (tip) block in the longest blockchain. This method is useful for obtaining the latest block hash, which can be used to fetch block details or confirmations for transactions. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/zYMbowj" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is a string containing the hash of the best block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getbestblockhash" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": "0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e", + "error": null +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblock.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblock.md new file mode 100644 index 0000000..deb4a4c --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblock.md @@ -0,0 +1,116 @@ +# getblock + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getBlock('000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblock` is a Dogecoin RPC method that returns information about a specified block. This method is useful for obtaining block details such as the hash, height, transactions, and other metadata. It can be used for various purposes, including validating transactions, monitoring the blockchain, and analyzing the network. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/QWJopve" %} + +### Parameters + +* `blockhash` (required): The hash of the block to be retrieved. + * Example: `"0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e"` +* `verbosity` (optional): Specifies the level of detail returned for the block. + * `0`: Returns a serialized block as a hex-encoded string (default). + * `1`: Returns a JSON object with block information. + * `2`: Returns a JSON object with block information and detailed transaction data. + * Example: `1` + +### Return Object + +The returned object varies depending on the `verbosity` parameter: + +* If `verbosity` is `0`, the return object is a hex-encoded string of the serialized block. +* If `verbosity` is `1` or `2`, the return object is a JSON object containing the following fields: + * `hash`: The block hash. + * `confirmations`: The number of confirmations for the block. + * `strippedsize`: The block size without witness data. + * `size`: The block size. + * `weight`: The block weight. + * `height`: The block height. + * `version`: The block version. + * `versionHex`: The block version as a hex string. + * `merkleroot`: The Merkle root of the transactions in the block. + * `tx`: An array of transaction identifiers (if `verbosity` is `1`) or detailed transaction objects (if `verbosity` is `2`). + * `time`: The block time in UNIX timestamp format. + * `mediantime`: The median block time of the previous 11 blocks. + * `nonce`: The block nonce. + * `bits`: The block difficulty target as a hex string. + * `difficulty`: The block difficulty. + * `chainwork`: The total work in the blockchain up to this block. + * `nTx`: The number of transactions in the block. + * `previousblockhash`: The hash of the previous block. + * `nextblockhash`: The hash of the next block (if available). + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblock", + "params": [ + "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + 1 + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + "confirmations": 1, + "height": 787065, + "version": 536895488, + "versionHex": "20006000", + "merkleroot": "f4d9edf4e50ed243778b553ae0043683a2a9be84c0996f15b30e2e282e6bd2d8", + "time": 1682499730, + "mediantime": 1682496628, + "nonce": 1195457913, + "bits": "1705c739", + "difficulty": 48712405953118.43, + "chainwork": "000000000000000000000000000000000000000046b01da204f6db69fc714174", + "nTx": 4114, + "previousblockhash": "000000000000000000041dd53066beb0577142582ec56573b5260d915311c773", + "strippedsize": 770704, + "size": 1680952, + "weight": 3993064, + "tx": [ + "63b36961bd94b217382409ceb8ec2f3da3d35a24e962e66089946d333f1af82b" + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockchaininfo.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockchaininfo.md new file mode 100644 index 0000000..1bf8ace --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockchaininfo.md @@ -0,0 +1,93 @@ +# getblockchaininfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getBlockChainInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockchaininfo` is a Dogecoin RPC method that provides general information about the current state of the blockchain. This method is useful for obtaining an overview of the blockchain, including the best block hash, chain height, difficulty, and network protocol version. It can be used for various purposes, such as monitoring the blockchain, tracking network upgrades, and assessing the current mining difficulty. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/rNQRyje" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The return object is a JSON object containing the following fields: + +* `chain`: The current network name (e.g., "main", "test", or "regtest"). +* `blocks`: The number of blocks in the local best block chain. +* `headers`: The number of headers the local node has validated. +* `bestblockhash`: The hash of the best (tip) block. +* `difficulty`: The current mining difficulty. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `verificationprogress`: The estimate of the verification progress of the local node as a percentage. +* `initialblockdownload`: A boolean indicating whether the node is in the initial block download mode. +* `chainwork`: The total work in the blockchain up to the best block. +* `size_on_disk`: The estimated size of the block and undo files on disk. +* `pruned`: A boolean indicating whether the block chain is pruned. +* `pruneheight`: The lowest-height complete block stored if the node is pruned (only present if `pruned` is true). +* `softforks`: An array of objects, each containing information about a softfork. +* `bip9_softforks`: An object containing the status of BIP9 softforks in the blockchain. +* `warnings`: Any network and blockchain warnings. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockchaininfo" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "chain": "main", + "blocks": 787066, + "headers": 787066, + "bestblockhash": "00000000000000000005233c5202951a85538b047e62f4c12c25d9ff65e62f07", + "difficulty": 48712405953118.43, + "time": 1682501447, + "mediantime": 1682496904, + "verificationprogress": 0.9999996042025764, + "initialblockdownload": false, + "chainwork": "000000000000000000000000000000000000000046b049efeeebefbd7f5e5cd6", + "size_on_disk": 540374248868, + "pruned": false, + "warnings": "" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockcount.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockcount.md new file mode 100644 index 0000000..0e8e583 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockcount.md @@ -0,0 +1,63 @@ +# getblockcount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @@tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getBlockCount() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockcount` is a Dogecoin RPC method that returns the number of blocks in the local best blockchain. This method is useful for obtaining the current height of the blockchain, which can be used for various purposes, such as monitoring the blockchain, determining the number of confirmations for a transaction, or assessing the progress of the blockchain's growth. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/xxQBqdd" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is an integer representing the number of blocks in the local best blockchain. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockcount" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 787067, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockhash.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockhash.md new file mode 100644 index 0000000..c08855e --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockhash.md @@ -0,0 +1,66 @@ +# getblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getBlockHash(587123) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockhash` is a Dogecoin RPC method that returns the block hash for a specified block height in the local best blockchain. This method is useful for obtaining the hash of a specific block, which can then be used to query for more detailed information about that block using other RPC methods, such as `getblock`. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/zYMbowj" %} + +### Parameters + +* `height`: The height of the block for which the hash is requested. This is an integer parameter. + + Example: `587123` + +### Return Object + +The return object is a string representing the hash of the block at the specified height. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockhash", + "params": [587123], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockheader.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockheader.md new file mode 100644 index 0000000..75c44b0 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getblockheader.md @@ -0,0 +1,103 @@ +# getblockheader + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getBlockHeader("0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockheader` is a Dogecoin RPC method that returns information about a specified block header. This method is useful for obtaining a high-level view of a specific block, including its hash, previous block hash, merkle root, timestamp, difficulty target, and nonce, without having to fetch the entire block's contents. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/XWyGMXd" %} + +### Parameters + +* `blockhash`: The hash of the block for which the header information is requested. This is a string parameter. + + Example: `"`0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f`"` +* `verbose` (optional): A boolean parameter that specifies whether to return the header information in a JSON object (true) or as a serialized hex-encoded string (false). Default is true. + + Example: `true` + +### Return Object + +If `verbose` is set to true (default), the return object is a JSON object containing the following fields: + +* `hash`: The hash of the block. +* `confirmations`: The number of confirmations for the block. +* `height`: The height of the block in the block chain. +* `version`: The block version. +* `versionHex`: The block version formatted as a hex string. +* `merkleroot`: The merkle root of the block. +* `time`: The block timestamp in UNIX format. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `nonce`: The nonce value for the block. +* `bits`: The encoded difficulty target for the block. +* `difficulty`: The actual difficulty target for the block as a decimal number. +* `chainwork`: The total work in the block chain up to this block. +* `nTx`: The number of transactions in the block. +* `previousblockhash`: The hash of the previous block. +* `nextblockhash`: The hash of the next block (only present if there is a next block). + +If `verbose` is set to false, the return object is a serialized hex-encoded string of the block header. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockheader", + "params": ["0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "confirmations": 199945, + "height": 587123, + "version": 549453824, + "versionHex": "20c00000", + "merkleroot": "06bc20da616f96fef435445cbf1bbcc9ff00896dd30c73b875aed7e06902666d", + "time": 1564152126, + "mediantime": 1564151358, + "nonce": 444284193, + "bits": "171f3a08", + "difficulty": 9013786945891.682, + "chainwork": "00000000000000000000000000000000000000000768b223a5622f8f0f1ac0a0", + "nTx": 1820, + "previousblockhash": "0000000000000000001683477bc3c17ab029412183952cb4a37f49968e16e6a8", + "nextblockhash": "00000000000000000007aeb07bc2fe4dbd0b55fc4be751050589b59fe95352fc" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getchaintips.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getchaintips.md new file mode 100644 index 0000000..87d5706 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getchaintips.md @@ -0,0 +1,231 @@ +# getchaintips + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatums' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getChainTips() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getchaintips` is a Dogecoin RPC method that returns information about all known tips in the block tree. This method is useful for identifying and analyzing potential forks or alternative chains in the Litecoin network. It can be used to monitor the health and status of the network or to investigate discrepancies in blockchain data. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/dyQrNQN" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object is an array of JSON objects, with each object representing a chain tip. The fields in each object are: + +* `height`: The height of the chain tip in the block chain. +* `hash`: The hash of the block corresponding to the chain tip. +* `branchlen`: The length of the branch connected to the main chain. +* `status`: The status of the chain tip, which can be one of the following values: + * `active`: The tip is part of the main chain. + * `valid-fork`: The tip is part of a valid but inactive fork. + * `valid-headers`: The tip is part of a valid fork but with incomplete block data. + * `headers-only`: The tip is a fork with valid headers but incomplete block data and an invalid parent block. + * `invalid`: The tip is part of an invalid fork. + * `unknown`: The tip has an unknown validation state. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getchaintips", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + { + "height": 787067, + "hash": "0000000000000000000348522f4f24304bfcadece8b34c0696faa4f87ec4fdc4", + "branchlen": 0, + "status": "active" + }, + { + "height": 784121, + "hash": "000000000000000000046a2698233ed93bb5e74ba7d2146a68ddb0c2504c980d", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 783830, + "hash": "0000000000000000000366d2c12772a350f507879a5325203424e58ec440249b", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783478, + "hash": "0000000000000000000446f7d3093688ae697386fed3f52a63812678ea6b251d", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783426, + "hash": "00000000000000000002ec935e245f8ae70fc68cc828f05bf4cfa002668599e4", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 782333, + "hash": "00000000000000000001a1abda3a2eb4acc211f64f8748d1a7635aad80690b7a", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 782129, + "hash": "000000000000000000036f461ab63c78f08401d3907a67fd2237166d8a373193", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 781487, + "hash": "0000000000000000000125e5d7c0d2e1b83982e5284ea21e08f5a73b8109d41b", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 781277, + "hash": "0000000000000000000388f42000fa901c01f2bfae36042bbae133ee430e6485", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 780994, + "hash": "00000000000000000001b666391fe81859e96fdfdbb83f1a1eafb7951c738c77", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 777172, + "hash": "0000000000000000000215ac1b6fd564d8d4707631f6b77273521eb1e242cf28", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 776941, + "hash": "00000000000000000004cc87382e38118248ec926716565d50d63f0637c22c07", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 772981, + "hash": "0000000000000000000682990a0dae862b48e0451d619938215dd47ed9560200", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771745, + "hash": "00000000000000000004370a77a30add64bba97c26a90ca9643b45a75219b2a6", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771627, + "hash": "00000000000000000005a92bdb6f9d55ea8d2b42579e0db6ca7764f97b6910e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 763445, + "hash": "000000000000000000065d0f6847466feeeaffa9663895cedde33aa12c262e00", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 759781, + "hash": "000000000000000000025edbf5ea025e4af2674b318ba82206f70681d97ca162", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 741082, + "hash": "00000000000000000004e2891d08337eb9263b703eb1c897e05dc59e8b246a9b", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 737096, + "hash": "00000000000000000002b07a9a9f066d463844960542d96e88b4815e063fab08", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 733430, + "hash": "00000000000000000006ead1cff09f279f7beb31a7290c2a603b0776d98dc334", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 730848, + "hash": "000000000000000000029ec31578132d01696910f299f8d104f29b8f8bbdc24f", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 723102, + "hash": "00000000000000000006a970fdd8e537521747aff917d909bf3a78b4b68143e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715276, + "hash": "00000000000000000009b160476c5f407ccd4957e20346b862d8fc46004759f0", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715139, + "hash": "0000000000000000000407bc4e26035c137869cdb677dfcab268b3faf7d7b5d1", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 714637, + "hash": "00000000000000000009f819d004fea5bcb77bda25f4906d0a39e79c9ba19590", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 714367, + "hash": "0000000000000000000b2e70d7675bc7b4e89d384d0e6e1a7ecc2779e1d93244", + "branchlen": 1, + "status": "valid-headers" + } + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getdifficulty.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getdifficulty.md new file mode 100644 index 0000000..022cbdf --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/getdifficulty.md @@ -0,0 +1,63 @@ +# getdifficulty + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getDifficulty() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getdifficulty` is a Dogecoin RPC method that returns the current mining difficulty. The mining difficulty is a measure of how difficult it is to find a new block compared to the easiest it can ever be. This method can be used to monitor the mining difficulty, which adjusts every 2016 blocks to maintain a consistent block creation rate of approximately 10 minutes per block. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/yLQwgRr" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +A return object is a floating-point number that represents the current mining difficulty. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getdifficulty", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 48712405953118.43, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxout.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxout.md new file mode 100644 index 0000000..e6b2fba --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxout.md @@ -0,0 +1,96 @@ +# gettxout + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getTxOut("39589032c66cb5e79b7120a41181b6f81bf0b6b2c019b4e85249ede65c8b0a35", 1) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxout` RPC method returns details about an unspent transaction output (UTXO). This method can be used to check if a specific transaction output is still unspent and obtain its details such as the value and scriptPubKey. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/KKrEaBb" %} + +### Parameters + +* `txid` (string, required): The transaction ID of the output. +* `n` (numeric, required): The index of the output within the transaction (vout). +* `include_mempool` (boolean, optional, default=true): Whether to include the mempool. Set to `false` to only check for outputs confirmed in the blockchain. + +**Example** + +* `txid`: `"`39589032c66cb5e79b7120a41181b6f81bf0b6b2c019b4e85249ede65c8b0a35`"` +* `n`: `1` +* `include_mempool`: `true` + +### Return Object + +The return object contains the following fields: + +* `bestblock`: (string) The hash of the block at the tip of the blockchain. +* `confirmations`: (numeric) The number of confirmations for the transaction. -1 if the transaction is not yet confirmed and in the mempool. +* `value`: (numeric) The value of the output in BTC. +* `scriptPubKey`: (object) Information about the output's scriptPubKey. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex representation of the script. + * `type`: (string) The type of the script (e.g., `pubkeyhash`, `scripthash`). + * `addresses`: (array) The Dogecoin addresses associated with this output. +* `coinbase`: (boolean) Whether the transaction is a coinbase transaction. +* `version`: (numeric) The transaction version. +* `height`: (numeric) The height of the block containing this output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxout", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", 1], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "bestblock": "00000000000000000000bb252e11a381e2d9ee948dd8f2c9df9b7cb41adc40b2", + "confirmations": 5, + "value": 0.0027, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + }, + "coinbase": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxoutproof.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxoutproof.md new file mode 100644 index 0000000..4ee67ac --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/gettxoutproof.md @@ -0,0 +1,70 @@ +# gettxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getTxOutProof(["0cd40ddd4650c833ffbd7c9cc7c174715014ea26ce4655fdf543351f72ff83f8"], "e97879aa74d9d8e9645fab2032bc5ee19ae9874c30b1d8f9197374207db488b6") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxoutproof` RPC method returns a hex-encoded proof that the specified transaction(s) were included in a block. This method can be used to provide proof of inclusion for one or more transactions in the blockchain. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/xxQBgjw?editors=1111" %} + +### Parameters + +* `txids` (array, required): An array of transaction IDs to create a proof for. +* `blockhash` (string, optional): The hash of the block that contains the transactions. If not provided, the method will search for the transactions in the most recent blocks. + +**Example** + +* `txids`: `["`c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2`"]` +* `blockhash`: `"`00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2`"` + +### Return Object + +* `hex`: (string) The hex-encoded proof of the transaction(s) inclusion in the block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxoutproof", + "params": [["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "00800020208d9c3576f57c3f0c35bd94440f37fe7971cf2b914001000000000000000000db47732e70243f1ae818f635ae4f5cacbacf1230f4dc226f0e62c0871d6e8692a4f5486439c705171a71df638e1100000e8c9aa54adefc4c7b9ccd760b4ee1369bdd5cc7cb8b3e426b4a3b490c2eee5473e8f8f4134d4035e4241a929b9cdac2c22b6d74e0cae88e9ad1f50eeba06ae52659f1c0be83c1705e6642336d47356c39632ca55d11c04f24d09132fd081f5144caf6c733deed2366cd75a4e5a355920cd31c889239e78e195fb15435451f82398b683b27258ff3523cf63a276f38ffe296dd541b99f80cc87ecb40f473e1af2656ac06a0d999105c71c293e571bb62bdd3f0509fe8d5be381d92a76d1659cafcfea20ac316c4cc72a4d81fd7e9d94227cf6457d5412e4ef0d0b32e195a092321e1ad6c16ff7c6a28b39104f3e38a21775f4ea730b25269de7a54eb4dee8752735fe3e7add927cb2f0813a5bddda182776a559d7ba91c3580fb55e49a0bef8186f274f6dccad47742cdab8d3cab06c26c1336a23675bbc2ad36d1396ae451adc759fa97499c565c252524eed6934be8f18f3784f1f7d74a1471c1778af5aa65b6e6ebb5c3625ce00ac09a644aaa8b0b86b679e65c9fa204582ac285368b97eaa7ef2c43019754f8a3e9442c9a6820a25b3d7037fe53ba9d89732f5835939225fa30b5d86694bb5fc5a384e799a22ae82017fb0cf95e70e7bb529725a81e0f96f704afaa5a00", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/verifytxoutproof.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/verifytxoutproof.md new file mode 100644 index 0000000..ce9b3ba --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/network-state/verifytxoutproof.md @@ -0,0 +1,68 @@ +# verifytxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.verifyTxOutProof("") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `verifytxoutproof` RPC method verifies the given transaction proof (in the form of a Merkle block) and returns an array of transaction hashes contained in the verified Merkle block. This method can be used to confirm that specific transactions are included in a block without having to download the entire block. + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/LYXaxdN" %} + +### Parameters + +* `proof`: (string, required) The hex-encoded proof generated by the `gettxoutproof` RPC method. + +### Return Object + +* (array of strings) An array of transaction hashes contained in the verified Merkle block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifytxoutproof", + "params": [ + "00000020fc61cc9f1bda9ef9e5d6bcccc7f210a0e87e7ccbc017d8487031b91d0000000047451bc9b84a546eafbe39baedb3cda967ea57cf1ab650b24d88395f2e4e3d413e4f22e8d9d9ea1c000000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a01000000434104e70b81e35e7cf03f6238471f7d9c903d48aea7c1d067e3010b9000000000000" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + "3e4f22e8d9d9ea1c123456789abcdef0123456789abcdef0123456789abcdef" + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/README.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/README.md new file mode 100644 index 0000000..30549c3 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/README.md @@ -0,0 +1,2 @@ +# Transactions + diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/createrawtransaction.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/createrawtransaction.md new file mode 100644 index 0000000..c39e642 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/createrawtransaction.md @@ -0,0 +1,89 @@ +# createrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.createRawTransaction([ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +{% embed url="https://codepen.io/Jan-Musil-the-lessful/pen/RwqdKPR?editors=1111" %} + +The `createrawtransaction` RPC method creates an unsigned raw transaction that spends a set of previous transaction outputs to a set of new addresses with specific amounts. The method can be used to create custom transactions, which can then be signed and broadcast to the Dogecoin network. + +### Parameters + +* `inputs`: (array, required) An array of objects, each specifying a previous transaction output to spend. + * `txid`: (string, required) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric, required) The index of the output to spend from the previous transaction. + * `sequence`: (numeric, optional) default=depends on the value of the 'replaceable' and 'locktime' arguments) The sequence number +* `outputs`: (object, required) An object with the key-value pairs representing the receiving address and the amount to be sent (in BTC). +* `locktime`: (numeric, optional, default=0) The lock time for the transaction. It can be used to specify the earliest time or block height at which the transaction can be included in a block. +* `replaceable`: (boolean, optional, default=false) **Marks this transaction as BIP125-replaceable.** Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible. + +### Return Object + +* (string) A hex-encoded raw transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "createrawtransaction", + "params": [ + [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + } + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decoderawtransaction.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decoderawtransaction.md new file mode 100644 index 0000000..3cd8b10 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decoderawtransaction.md @@ -0,0 +1,120 @@ +# decoderawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.decodeRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decoderawtransaction` RPC method decodes a serialized (hex-encoded) raw transaction and displays its information in a human-readable format. This method is useful for inspecting raw transactions before broadcasting them to the Dogecoin network or for debugging purposes. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/YzRgZYv" %} + +### Parameters + +* `hex_string`: (string, required) The serialized raw transaction in hex format. + +### Return Object + +An object containing the decoded raw transaction information: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size in bytes. +* `vsize`: (numeric) The virtual transaction size in bytes. +* `weight`: (numeric) The transaction weight. +* `locktime`: (numeric) The lock time for the transaction. +* `vin`: (array) An array of objects, each representing an input of the transaction. + * `txid`: (string) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric) The index of the output to spend from the previous transaction. + * `scriptSig`: (object) The script used to redeem the previous transaction output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `sequence`: (numeric) The sequence number. +* `vout`: (array) An array of objects, each representing an output of the transaction. + * `value`: (numeric) The amount sent to the output in BTC. + * `n`: (numeric) The index of the output. + * `scriptPubKey`: (object) The script used to lock the output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `reqSigs`: (numeric) The required number of signatures. + * `type`: (string) The type of the script (e.g., 'pubkeyhash'). + * `addresses`: (array) An array of Dogecoin addresses associated with the output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decoderawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "hash": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "version": 2, + "size": 85, + "vsize": 85, + "weight": 340, + "locktime": 0, + "vin": [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0, + "scriptSig": { + "asm": "", + "hex": "" + }, + "sequence": 4294967293 + } + ], + "vout": [ + { + "value": 0.01, + "n": 0, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG", + "desc": "addr(1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa)#632p52jr", + "hex": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "type": "pubkeyhash" + } + } + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decodescript.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decodescript.md new file mode 100644 index 0000000..b8b2e3e --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/decodescript.md @@ -0,0 +1,75 @@ +# decodescript + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.decodeScript("3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decodescript` RPC method decodes a serialized (hex-encoded) script and provides information about the script in a human-readable format. This method is useful for inspecting scripts for debugging purposes or for understanding their structure. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/dyQrvdm" %} + +### Parameters + +* `hex_string`: (string, required) The serialized script in hex format. + +### Return Object + +An object containing the decoded script information: + +* `asm`: (string) The assembly representation of the script. +* `hex`: (string) The hex-encoded script. +* `type`: (string) The type of the script (e.g., 'pubkeyhash', 'multisig'). +* `reqSigs`: (numeric, optional) The required number of signatures if the script is a multisig script. +* `addresses`: (array, optional) An array of Litecoin addresses associated with the script if applicable. +* `p2sh`: (string, optional) The P2SH address for this script if applicable. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decodescript", + "params": ["3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "asm": "44022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86 OP_MAX OP_UNKNOWN OP_UNKNOWN [error]", + "desc": "raw(3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501)#3x5hf724", + "type": "nonstandard" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/estimatesmartfee.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/estimatesmartfee.md new file mode 100644 index 0000000..116c705 --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/estimatesmartfee.md @@ -0,0 +1,75 @@ +# estimatesmartfee + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.estimateSmartFee(20) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `estimatesmartfee` method provides an estimated fee rate (in DOGE/kB) for a transaction to be confirmed within a certain number of blocks. The estimation is based on recent transactions in the Dogecoin network. + +This method can be useful for users or applications trying to decide on an appropriate fee for their transactions, based on the desired confirmation speed. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/MWzxpEK" %} + +### Parameters + +The `estimatesmartfee` method accepts the following parameters: + +* `conf_target`: An integer representing the number of blocks within which the transaction should be confirmed. +* `estimate_mode` _(optional)_: A string that determines the estimation mode. Possible values are "UNSET", "ECONOMICAL", and "CONSERVATIVE". Default is "CONSERVATIVE". + +### Return Object + +The `estimatesmartfee` method returns an object containing the following fields: + +* `feerate`: A decimal number representing the estimated fee rate in DOGE/kB. +* `blocks`: An integer representing the number of blocks within which the transaction is expected to be confirmed. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "estimatesmartfee", + "params": [20], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "feerate": 0.00017258, + "blocks": 20 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/getrawtransaction.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/getrawtransaction.md new file mode 100644 index 0000000..63585bf --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/getrawtransaction.md @@ -0,0 +1,166 @@ +# getrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.getRawTransaction("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawtransaction` RPC method retrieves a raw transaction from the blockchain or mempool. It returns the serialized (hex-encoded) transaction data. This method can be used to inspect a transaction's content before it's included in a block or to decode the transaction for further analysis. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/ZEmPeJW" %} + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction to fetch. +* `verbose`: (bool, optional, default=false) If set to `true`, the method returns a JSON object containing information about the transaction. + +### Return Object + +If `verbose` is `false`, the method returns a hex-encoded string representing the serialized transaction data. If `verbose` is `true`, the method returns a JSON object with the following fields: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size. +* `vsize`: (numeric) The virtual transaction size. +* `weight`: (numeric) The transaction's weight. +* `locktime`: (numeric) The transaction locktime. +* `vin`: (array) The transaction inputs. Each object within the array has the following properties: + 1. `txid`: A string representing the transaction ID of the output being spent. This refers to the transaction where the LTC being spent in the current transaction was received. + 2. `vout`: An integer representing the index of the output in the transaction specified by `txid`. This is the position of the output in that transaction's `vout` array. + 3. `scriptSig`: An object containing two fields, `asm` and `hex`, which represents the unlocking script that satisfies the conditions of the spent output's locking script. `asm` contains the assembly representation of the script while `hex` containing the hexadecimal representation. + 4. `sequence`: A number representing the sequence number of the input. It can be used to signal relative locktime constraints on the transaction. +* `vout`: (array) The transaction outputs. Each object within the array has the following properties: + 1. `value`: A decimal number representing the amount of DOGE being sent to the output's address. This value is expressed in dogecoins (DOGE). + 2. `n`: An integer representing the index of the output in the transaction's `vout` array. + 3. `scriptPubKey`: An object containing information about the locking script used to lock the output. The object has the following fields: + * `asm`: The assembly representation of the locking script. + * `hex`: The hexadecimal representation of the locking script. + * `reqSigs`: The number of required signatures to unlock the output (relevant for multisig addresses). + * `type`: The type of the locking script (e.g., 'pubkeyhash', 'scripthash', 'multisig', etc.). + * `addresses`: An array of Dogecoin addresses associated with the output. +* `hex`: (string) The serialized transaction data in hex format. +* `blockhash`: (string, optional) The block hash containing the transaction. +* `confirmations`: (numeric, optional) The number of confirmations the transaction has. +* `time`: (numeric, optional) The transaction time in UNIX timestamp format. +* `blocktime`: (numeric, optional) The block time in UNIX timestamp format. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawtransaction", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "hash": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "version": 2, + "size": 284, + "vsize": 203, + "weight": 809, + "locktime": 0, + "vin": [ + { + "txid": "aaeb16390ca5209d8c72a0090a9ca87e6ff6491f239b3496cdb5c99977643583", + "vout": 9, + "scriptSig": { + "asm": "", + "hex": "" + }, + "txinwitness": [ + "3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501", + "03c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c0" + ], + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 0.00112825, + "n": 0, + "scriptPubKey": { + "asm": "0 29a7007eabae2ac56f221aad9c983b77a9f96c3b", + "desc": "addr(bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k)#3al0qk8v", + "hex": "001429a7007eabae2ac56f221aad9c983b77a9f96c3b", + "address": "bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.0027, + "n": 1, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.00104468, + "n": 2, + "scriptPubKey": { + "asm": "0 c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "desc": "addr(bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa)#5rw0gs2m", + "hex": "0014c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "address": "bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.41658346, + "n": 3, + "scriptPubKey": { + "asm": "0 b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "desc": "addr(bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4)#savgw9p6", + "hex": "0014b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "address": "bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4", + "type": "witness_v0_keyhash" + } + } + ], + "hex": "020000000001018335647799c9b5cd96349b231f49f66f7ea89c0a09a0728c9d20a50c3916ebaa0900000000feffffff04b9b801000000000016001429a7007eabae2ac56f221aad9c983b77a9f96c3bb01e04000000000016001424007ed98749dbb504fdea2bd07715c94d4c77511498010000000000160014c4c04e31613e2c3dfadaedde383bbfdd7a107d8aeaa77b0200000000160014b33b0a68aba1d4697d8329f2b7939fb2a46b733202473044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c85012103c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c000000000", + "blockhash": "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2", + "confirmations": 7, + "time": 1682503076, + "blocktime": 1682503076 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/sendrawtransaction.md b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/sendrawtransaction.md new file mode 100644 index 0000000..74c475a --- /dev/null +++ b/docs/rpc/utxo-blockchains/dogecoin-rpc-documentation/transactions/sendrawtransaction.md @@ -0,0 +1,67 @@ +# sendrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Dogecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.DOGECOIN}) + +const result = await tatum.rpc.sendRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `sendrawtransaction` method submits a serialized raw transaction to the Dogecoin network. If the transaction is well-formed and valid, it will be propagated to the network and included in a mined block. + +This method is commonly used in conjunction with [`createrawtransaction`](../../bitcoin-rpc-documentation/transactions/createrawtransaction.md), or other methods to construct and sign raw transactions before broadcasting them. + +### Parameters + +The `sendrawtransaction` method accepts the following parameters: + +* `hexstring`: A string representing the serialized raw transaction in hexadecimal format. + +### Return Object + +The `sendrawtransaction` method returns a string containing the transaction ID (txid) of the broadcasted transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "sendrawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/README.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/README.md new file mode 100644 index 0000000..f7045ba --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/README.md @@ -0,0 +1,9 @@ +# Litecoin RPC documentation + +Litecoin RPC (Remote Procedure Call) is a powerful tool for developers seeking to interact with the Litecoin blockchain network. It provides a standardised interface for communication, enabling developers to retrieve data, send transactions, deploy smart contracts, and more. Litecoin RPC plays a vital role in building decentralised applications, integrating blockchain functionality, and exploring the diverse ecosystem of Litecoin. Getting Started with Litecoin + +Here's how you can get started using LTC RPC using RPC Submodule: + +{% embed url="https://youtu.be/ODqheBSEyMI" %} + +In this video tutorial, we will guide you through the process of getting started with Litecoin RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including Litecoin. By following the tutorial, you will learn how to set up your development environment, establish a connection to the Litecoin network via RPC, and perform common operations such as getBestBlockHash. Whether you are a beginner or an experienced developer, this tutorial will provide you with the necessary steps to kickstart your web3 app development journey on Litecoin. diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/README.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/README.md new file mode 100644 index 0000000..ab4eb02 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/README.md @@ -0,0 +1,2 @@ +# Helper Functions + diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/validateaddress.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/validateaddress.md new file mode 100644 index 0000000..73807b7 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/validateaddress.md @@ -0,0 +1,86 @@ +# validateaddress + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.validateAddress("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`validateaddress` is an Litecoin RPC method that enables users to verify if a given Litecoin address is valid. This method provides important information about the address, such as its type and whether it's a spendable or watch-only address. It can be particularly useful in applications where address validation is necessary before performing transactions or when dealing with user-generated addresses to ensure their validity. + +{% embed url="https://codepen.io/tatum-devrel/pen/wvQOMNw" %} + +### Parameters + +The `validateaddress` method accepts one required parameter: + +* `address` (string, required): The Litecoin address to be validated. + +### Return Object + +The `validateaddress` method returns an object with the following fields: + +* `isvalid` (boolean): Indicates if the supplied address is valid. +* `address` (string): The validated Litecoin address. +* `scriptPubKey` (string): The hex-encoded scriptPubKey generated by the address. +* `isscript` (boolean): Indicates if the address is a script address (P2SH). +* `iswitness` (boolean): Indicates if the address is a witness address (P2WPKH or P2WSH). +* `witness_version` (numeric, optional): The version number of the witness program, if applicable. +* `witness_program` (string, optional): The hex value of the witness program, if applicable. +* `isspendable` (boolean): Indicates if the address is spendable (has the private key). +* `iswatchonly` (boolean): Indicates if the address is watch-only (wallet has the public key but not the private key). +* `iscompressed` (boolean, optional): Indicates if the associated public key is compressed. +* `account` (string, optional): DEPRECATED. The account associated with the address, if any. Example: + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "validateaddress", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "isvalid": true, + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "scriptPubKey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "isscript": false, + "iswitness": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/verifymessage.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/verifymessage.md new file mode 100644 index 0000000..ff2d8ba --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/helper-functions/verifymessage.md @@ -0,0 +1,72 @@ +# verifymessage + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.verifyMessage( "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", "Hello, this is a signed message.") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`verifymessage` is an Litecoin RPC method that allows users to verify a signed message using a Litecoin address. This method can be used to confirm the authenticity of a message by verifying that the signature was created by the owner of the address, without revealing the private key. Use cases include proving ownership of an address, verifying the content of a message, or validating communications within a trustless system. + +### Parameters + +The `verifymessage` method accepts three required parameters: + +* `address` (string, required): The Litecoin address that supposedly signed the message. +* `signature` (string, required): The base64-encoded signature of the message. +* `message` (string, required): The message that was signed. + +### Return Object + +The `verifymessage` method returns a single boolean value: + +* `isvalid` (boolean): Indicates if the signature is valid for the given message and address + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifymessage", + "params": [ + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", +"HxK7Mw0K6Uox7iGcOe9v9Ll+OZzG7TjTkeTJCD7VHw4yKP4O4a4gFtgm9XNmxfH1tK7JRgYrP/+20xP/ek8iQ2E=", + "Hello, this is a signed message." + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": false, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/README.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/README.md new file mode 100644 index 0000000..563f334 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/README.md @@ -0,0 +1,2 @@ +# Mempool + diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolancestors.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolancestors.md new file mode 100644 index 0000000..0c9c7a2 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolancestors.md @@ -0,0 +1,71 @@ +# getmempoolancestors + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getMempoolAncestors("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getmempoolancestors` is a Litecoin RPC method that returns information about the ancestors of a transaction in the memory pool. This method can be used to analyze the dependency relationships between unconfirmed transactions and to investigate potential transaction issues, such as chains of unconfirmed transactions or transactions that depend on others with a low fee. + +### Parameters + +* `txid`: The transaction ID (string, required) of the transaction for which you want to retrieve the ancestors. +* `verbose`: Whether to return a JSON object with detailed information about the ancestors (bool, optional, default = false). If `false`, only the transaction IDs of the ancestors are returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of an ancestor. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the ancestors, and the values are JSON objects containing detailed information about the ancestors. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempoolancestors", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempooldescendants.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempooldescendants.md new file mode 100644 index 0000000..4575b8c --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempooldescendants.md @@ -0,0 +1,71 @@ +# getmempooldescendants + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getMempoolDescendants("3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempooldescendants` RPC method allows you to retrieve information about the descendant transactions of a specified transaction in the memory pool. This method is useful for understanding the relationships between unconfirmed transactions and the possible effects of their confirmation on the overall transaction fees and network congestion. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction for which you want to get its descendants. +* `verbose`: (boolean, optional, default=`false`) If set to `true`, detailed information about each descendant transaction will be returned, otherwise only the transaction IDs will be returned. + +### Return Object + +The return object depends on the `verbose` parameter: + +* If `verbose` is `false`, the return object is an array of strings, each representing the transaction ID of a descendant. +* If `verbose` is `true`, the return object is a JSON object, where the keys are the transaction IDs of the descendants, and the values are JSON objects containing detailed information about the descendants. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getmempooldescendants", + "params": [ + "3b3c3bc559deddb0991e1fe9fb6d9f10c1c4a0dab4a18c12e8566b37ad4f06e4" + ] +} + +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": [ + "1d1c1bc9a9a7d7b0990e0e1f1b5b5a5a5c5b5a5a5a5a5a5a5a5a5a5a5a5a5a5a" + ] +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolentry.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolentry.md new file mode 100644 index 0000000..eab2762 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolentry.md @@ -0,0 +1,100 @@ +# getmempoolentry + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getMempoolEntry("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolentry` RPC method allows you to retrieve information about a specific transaction in the memory pool. This method is useful for tracking the status of unconfirmed transactions and for gathering additional details about their current state. + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction you want to retrieve information about. + +### Return Object + +The return object will be an object containing information about the specified transaction. + +**Fields** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with fee deltas used for mining priority. +* `time`: (numeric) The local time the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions. +* `descendantsize`: (numeric) The virtual transaction size of all descendant transactions combined. +* `descendantfees`: (numeric) The total fees of all descendant transactions. +* `ancestorcount`: (numeric) The number of ancestor transactions. +* `ancestorsize`: (numeric) The virtual transaction size of all ancestor transactions combined. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions. +* `wtxid`: (string) The witness transaction ID of the transaction. +* `depends`: (array) An array containing the witness transaction IDs of the transactions this transaction depends on. +* `spentby`: (array) An array containing the witness transaction IDs of the transactions that spend this transaction. +* `bip125-replaceable`: (string) Whether the transaction is BIP125 replaceable. Possible values are "yes", "no", or "unknown". + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolentry", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "vsize": 203, + "weight": 809, + "time": 1682502684, + "height": 787068, + "descendantcount": 1, + "descendantsize": 203, + "ancestorcount": 1, + "ancestorsize": 203, + "wtxid": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "fees": { + "base": 0.00005481, + "modified": 0.00005481, + "ancestor": 0.00005481, + "descendant": 0.00005481 + }, + "depends": [], + "spentby": [], + "bip125-replaceable": false, + "unbroadcast": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolinfo.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolinfo.md new file mode 100644 index 0000000..508bdfa --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getmempoolinfo.md @@ -0,0 +1,84 @@ +# getmempoolinfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getMempoolInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getmempoolinfo` RPC method allows you to retrieve general information about the current memory pool. This method is useful for monitoring the state of the memory pool, such as its size, the total transaction fees, and the minimum fee rate required for transactions to be included in the next block. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGbjGX" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object will be an object containing general information about the current memory pool. + +**Fields** + +* `size`: (numeric) The number of transactions in the memory pool. +* `bytes`: (numeric) The total size of all transactions in the memory pool, in bytes. +* `usage`: (numeric) The total memory usage of the memory pool, in bytes. +* `maxmempool`: (numeric) The maximum memory usage of the memory pool, in bytes. +* `mempoolminfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be included in the memory pool. +* `minrelaytxfee`: (numeric) The minimum fee rate (in BTC/kB) required for transactions to be relayed across the network. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getmempoolinfo", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "loaded": true, + "size": 28338, + "bytes": 11367166, + "usage": 63671920, + "total_fee": 0.73841041, + "maxmempool": 4000000000, + "mempoolminfee": 0.00001, + "minrelaytxfee": 0.00001, + "incrementalrelayfee": 0.00001, + "unbroadcastcount": 0, + "fullrbf": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getrawmempool.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getrawmempool.md new file mode 100644 index 0000000..38f7aa1 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/mempool/getrawmempool.md @@ -0,0 +1,109 @@ +# getrawmempool + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getRawMemPool(true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawmempool` RPC method provides information on the transactions currently in the memory pool. This method is useful for getting details about unconfirmed transactions that have not yet been included in a block. + +### Parameters + +* `verbose` (boolean, optional, default=false): Set to `true` to receive a detailed JSON object for each transaction in the memory pool. Set to `false` to receive a simple array of transaction IDs. + +**Example** + +* `verbose`: `true` + +### Return Object + +The return object will depend on the value of the `verbose` parameter. + +* If `verbose` is set to `false`, the method will return an array of transaction IDs. +* If `verbose` is set to `true`, the method will return an object with transaction IDs as keys and detailed transaction information as values. + +**Fields (when verbose is true)** + +* `size`: (numeric) The transaction size in bytes. +* `fee`: (numeric) The transaction fee in BTC. +* `modifiedfee`: (numeric) The transaction fee with descendants in BTC. +* `time`: (numeric) The local time when the transaction entered the memory pool. +* `height`: (numeric) The block height when the transaction entered the memory pool. +* `descendantcount`: (numeric) The number of descendant transactions in the memory pool. +* `descendantsize`: (numeric) The total size of all descendant transactions in the memory pool, in bytes. +* `descendantfees`: (numeric) The total fees of all descendant transactions in the memory pool, in satoshis. +* `ancestorcount`: (numeric) The number of ancestor transactions in the memory pool. +* `ancestorsize`: (numeric) The total size of all ancestor transactions in the memory pool, in bytes. +* `ancestorfees`: (numeric) The total fees of all ancestor transactions in the memory pool, in satoshis. +* `wtxid`: (string) The transaction witness ID. +* `depends`: (array) An array of unconfirmed transactions that this transaction depends on. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawmempool", + "params": [true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ +"result": { + "940352ce2be1f34f2a88ed32ba9bfcd01d4d8cbd68b79c88ce97115d1d8da8ce": { + "vsize": 151, + "weight": 602, + "time": 1682395086, + "height": 787063, + "descendantcount": 1, + "descendantsize": 151, + "ancestorcount": 2, + "ancestorsize": 1334, + "wtxid": "a824488001981d130794c9982afb0aeab3cdef25b5b9505b50ded0724308e976", + "fees": { + "base": 0.00000307, + "modified": 0.00000307, + "ancestor": 0.00002679, + "descendant": 0.00000307 + }, + "depends": [ + "e17275ca632c7083ce2f36415d4a52eda928901624e90f104c51696bc3338379" + ], + "spentby": [], + "bip125-replaceable": true, + "unbroadcast": false + } + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/README.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/README.md new file mode 100644 index 0000000..cbe8e09 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/README.md @@ -0,0 +1,2 @@ +# Network state + diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getbestblockhash.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getbestblockhash.md new file mode 100644 index 0000000..fbf5e74 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getbestblockhash.md @@ -0,0 +1,63 @@ +# getbestblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBestBlockHash() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getbestblockhash` is a Litecoin RPC method that returns the hash of the best (tip) block in the longest blockchain. This method is useful for obtaining the latest block hash, which can be used to fetch block details or confirmations for transactions. + +{% embed url="https://codepen.io/tatum-devrel/pen/vYQPLOd" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is a string containing the hash of the best block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getbestblockhash" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "result": "0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e", + "error": null +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblock.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblock.md new file mode 100644 index 0000000..af2bab0 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblock.md @@ -0,0 +1,116 @@ +# getblock + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlock('000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblock` is a Litecoin RPC method that returns information about a specified block. This method is useful for obtaining block details such as the hash, height, transactions, and other metadata. It can be used for various purposes, including validating transactions, monitoring the blockchain, and analyzing the network. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQBZZg" %} + +### Parameters + +* `blockhash` (required): The hash of the block to be retrieved. + * Example: `"0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e"` +* `verbosity` (optional): Specifies the level of detail returned for the block. + * `0`: Returns a serialized block as a hex-encoded string (default). + * `1`: Returns a JSON object with block information. + * `2`: Returns a JSON object with block information and detailed transaction data. + * Example: `1` + +### Return Object + +The returned object varies depending on the `verbosity` parameter: + +* If `verbosity` is `0`, the return object is a hex-encoded string of the serialized block. +* If `verbosity` is `1` or `2`, the return object is a JSON object containing the following fields: + * `hash`: The block hash. + * `confirmations`: The number of confirmations for the block. + * `strippedsize`: The block size without witness data. + * `size`: The block size. + * `weight`: The block weight. + * `height`: The block height. + * `version`: The block version. + * `versionHex`: The block version as a hex string. + * `merkleroot`: The Merkle root of the transactions in the block. + * `tx`: An array of transaction identifiers (if `verbosity` is `1`) or detailed transaction objects (if `verbosity` is `2`). + * `time`: The block time in UNIX timestamp format. + * `mediantime`: The median block time of the previous 11 blocks. + * `nonce`: The block nonce. + * `bits`: The block difficulty target as a hex string. + * `difficulty`: The block difficulty. + * `chainwork`: The total work in the blockchain up to this block. + * `nTx`: The number of transactions in the block. + * `previousblockhash`: The hash of the previous block. + * `nextblockhash`: The hash of the next block (if available). + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblock", + "params": [ + "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + 1 + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "000000000000000000013d0a85b72c591500abe074a7f9175c596a194f67b82d", + "confirmations": 1, + "height": 787065, + "version": 536895488, + "versionHex": "20006000", + "merkleroot": "f4d9edf4e50ed243778b553ae0043683a2a9be84c0996f15b30e2e282e6bd2d8", + "time": 1682499730, + "mediantime": 1682496628, + "nonce": 1195457913, + "bits": "1705c739", + "difficulty": 48712405953118.43, + "chainwork": "000000000000000000000000000000000000000046b01da204f6db69fc714174", + "nTx": 4114, + "previousblockhash": "000000000000000000041dd53066beb0577142582ec56573b5260d915311c773", + "strippedsize": 770704, + "size": 1680952, + "weight": 3993064, + "tx": [ + "63b36961bd94b217382409ceb8ec2f3da3d35a24e962e66089946d333f1af82b" + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockchaininfo.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockchaininfo.md new file mode 100644 index 0000000..0ef914e --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockchaininfo.md @@ -0,0 +1,93 @@ +# getblockchaininfo + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlockChainInfo() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockchaininfo` is a Litecoin RPC method that provides general information about the current state of the blockchain. This method is useful for obtaining an overview of the blockchain, including the best block hash, chain height, difficulty, and network protocol version. It can be used for various purposes, such as monitoring the blockchain, tracking network upgrades, and assessing the current mining difficulty. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQEPrd" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The return object is a JSON object containing the following fields: + +* `chain`: The current network name (e.g., "main", "test", or "regtest"). +* `blocks`: The number of blocks in the local best block chain. +* `headers`: The number of headers the local node has validated. +* `bestblockhash`: The hash of the best (tip) block. +* `difficulty`: The current mining difficulty. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `verificationprogress`: The estimate of the verification progress of the local node as a percentage. +* `initialblockdownload`: A boolean indicating whether the node is in the initial block download mode. +* `chainwork`: The total work in the blockchain up to the best block. +* `size_on_disk`: The estimated size of the block and undo files on disk. +* `pruned`: A boolean indicating whether the block chain is pruned. +* `pruneheight`: The lowest-height complete block stored if the node is pruned (only present if `pruned` is true). +* `softforks`: An array of objects, each containing information about a softfork. +* `bip9_softforks`: An object containing the status of BIP9 softforks in the blockchain. +* `warnings`: Any network and blockchain warnings. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockchaininfo" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "chain": "main", + "blocks": 787066, + "headers": 787066, + "bestblockhash": "00000000000000000005233c5202951a85538b047e62f4c12c25d9ff65e62f07", + "difficulty": 48712405953118.43, + "time": 1682501447, + "mediantime": 1682496904, + "verificationprogress": 0.9999996042025764, + "initialblockdownload": false, + "chainwork": "000000000000000000000000000000000000000046b049efeeebefbd7f5e5cd6", + "size_on_disk": 540374248868, + "pruned": false, + "warnings": "" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockcount.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockcount.md new file mode 100644 index 0000000..d795d5a --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockcount.md @@ -0,0 +1,63 @@ +# getblockcount + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @@tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlockCount() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockcount` is a Litecoin RPC method that returns the number of blocks in the local best blockchain. This method is useful for obtaining the current height of the blockchain, which can be used for various purposes, such as monitoring the blockchain, determining the number of confirmations for a transaction, or assessing the progress of the blockchain's growth. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOMPKN" %} + +### Parameters + +This method does not have any parameters. + +### Return Object + +The returned object is an integer representing the number of blocks in the local best blockchain. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "getblockcount" +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 787067, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockhash.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockhash.md new file mode 100644 index 0000000..d58a414 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockhash.md @@ -0,0 +1,66 @@ +# getblockhash + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlockHash(587123) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockhash` is a Litecoin RPC method that returns the block hash for a specified block height in the local best blockchain. This method is useful for obtaining the hash of a specific block, which can then be used to query for more detailed information about that block using other RPC methods, such as `getblock`. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQJWPj" %} + +### Parameters + +* `height`: The height of the block for which the hash is requested. This is an integer parameter. + + Example: `587123` + +### Return Object + +The return object is a string representing the hash of the block at the specified height. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockhash", + "params": [587123], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockheader.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockheader.md new file mode 100644 index 0000000..e468334 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockheader.md @@ -0,0 +1,103 @@ +# getblockheader + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlockHeader("0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockheader` is a Litecoin RPC method that returns information about a specified block header. This method is useful for obtaining a high-level view of a specific block, including its hash, previous block hash, merkle root, timestamp, difficulty target, and nonce, without having to fetch the entire block's contents. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOMPom" %} + +### Parameters + +* `blockhash`: The hash of the block for which the header information is requested. This is a string parameter. + + Example: `"`0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f`"` +* `verbose` (optional): A boolean parameter that specifies whether to return the header information in a JSON object (true) or as a serialized hex-encoded string (false). Default is true. + + Example: `true` + +### Return Object + +If `verbose` is set to true (default), the return object is a JSON object containing the following fields: + +* `hash`: The hash of the block. +* `confirmations`: The number of confirmations for the block. +* `height`: The height of the block in the block chain. +* `version`: The block version. +* `versionHex`: The block version formatted as a hex string. +* `merkleroot`: The merkle root of the block. +* `time`: The block timestamp in UNIX format. +* `mediantime`: The median block time of the last 11 blocks in UNIX timestamp format. +* `nonce`: The nonce value for the block. +* `bits`: The encoded difficulty target for the block. +* `difficulty`: The actual difficulty target for the block as a decimal number. +* `chainwork`: The total work in the block chain up to this block. +* `nTx`: The number of transactions in the block. +* `previousblockhash`: The hash of the previous block. +* `nextblockhash`: The hash of the next block (only present if there is a next block). + +If `verbose` is set to false, the return object is a serialized hex-encoded string of the block header. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockheader", + "params": ["0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "hash": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "confirmations": 199945, + "height": 587123, + "version": 549453824, + "versionHex": "20c00000", + "merkleroot": "06bc20da616f96fef435445cbf1bbcc9ff00896dd30c73b875aed7e06902666d", + "time": 1564152126, + "mediantime": 1564151358, + "nonce": 444284193, + "bits": "171f3a08", + "difficulty": 9013786945891.682, + "chainwork": "00000000000000000000000000000000000000000768b223a5622f8f0f1ac0a0", + "nTx": 1820, + "previousblockhash": "0000000000000000001683477bc3c17ab029412183952cb4a37f49968e16e6a8", + "nextblockhash": "00000000000000000007aeb07bc2fe4dbd0b55fc4be751050589b59fe95352fc" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockstats.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockstats.md new file mode 100644 index 0000000..76ea64b --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getblockstats.md @@ -0,0 +1,135 @@ +# getblockstats + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getBlockStats("614c1c4c6336a2ac9aba7b3c91f21fc89b974a38f7844a230accb2165e61a128") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getblockstats` is a Litecoin RPC method that returns various statistics about a specified block. This method is useful for obtaining detailed information about a block, including the number of transactions, transaction volume, fees, and other related data. The results can be used for data analysis, monitoring, and understanding the state of the Litecoin network at a specific block height. + +{% embed url="https://codepen.io/tatum-devrel/pen/LYXaGee" %} + +### Parameters + +* `hash_or_height`: The block hash or block height for which the statistics are requested. This parameter can be either a string (block hash) or an integer (block height). + + Example (block hash): `"0000000000000000000f92fb968a8d1a2a9c2039e6e99f8c7a0ee3421a44a7d6"` + + Example (block height): `685230` +* `stats` (optional): An array of strings indicating the statistics to be included in the response. If not specified, all available statistics will be returned. + + Example: `["txs", "avgfee"]` + +### Return Object + +The return object is a JSON object containing the requested statistics as key-value pairs. The available statistics are: + +* `avgfee`: The average transaction fee in satoshis. +* `avgfeerate`: The average fee rate in satoshis per virtual byte. +* `avgtxsize`: The average transaction size in bytes. +* `blockhash`: The hash of the block. +* `height`: The height of the block in the block chain. +* `ins`: The total number of inputs in all transactions. +* `maxfee`: The maximum transaction fee in satoshis. +* `maxfeerate`: The maximum fee rate in satoshis per virtual byte. +* `maxtxsize`: The maximum transaction size in bytes. +* `medianfee`: The median transaction fee in satoshis. +* `mediantime`: The median time for the block in UNIX timestamp format. +* `mediantxsize`: The median transaction size in bytes. +* `minfee`: The minimum transaction fee in satoshis. +* `minfeerate`: The minimum fee rate in satoshis per virtual byte. +* `mintxsize`: The minimum transaction size in bytes. +* `outs`: The total number of outputs in all transactions. +* `subsidy`: The block reward in satoshis. +* `swtotal_size`: The total size of all SegWit transactions in bytes. +* `swtotal_weight`: The total weight of all SegWit transactions. +* `swtxs`: The total number of SegWit transactions. +* `time`: The block timestamp in UNIX format. +* `total_size`: The total size of all transactions in bytes. +* `total_weight`: The total weight of all transactions. +* `totalfee`: The total transaction fees in satoshis. +* `txs`: The total number of transactions in the block. +* `utxo_increase`: The increase in the number of unspent transaction outputs. +* `utxo_size_inc`: The increase in the size of the UTXO set. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getblockstats", + "params": ["0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "avgfee": 10220, + "avgfeerate": 18, + "avgtxsize": 619, + "blockhash": "0000000000000000001b4fedbfb3672963c37f965686c2bf6350e32e77f9941f", + "feerate_percentiles": [ + 6, + 9, + 9, + 15, + 48 + ], + "height": 587123, + "ins": 3615, + "maxfee": 419448, + "maxfeerate": 393, + "maxtxsize": 17196, + "medianfee": 9528, + "mediantime": 1564151358, + "mediantxsize": 374, + "minfee": 136, + "minfeerate": 1, + "mintxsize": 189, + "outs": 3617, + "subsidy": 1250000000, + "swtotal_size": 323742, + "swtotal_weight": 777804, + "swtxs": 616, + "time": 1564152126, + "total_out": 342467209172, + "total_size": 1127251, + "total_weight": 3991840, + "totalfee": 18590521, + "txs": 1820, + "utxo_increase": 2, + "utxo_size_inc": 4000 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getchaintips.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getchaintips.md new file mode 100644 index 0000000..0530c22 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getchaintips.md @@ -0,0 +1,231 @@ +# getchaintips + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatums' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getChainTips() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getchaintips` is a Litecoin RPC method that returns information about all known tips in the block tree. This method is useful for identifying and analyzing potential forks or alternative chains in the Litecoin network. It can be used to monitor the health and status of the network or to investigate discrepancies in blockchain data. + +{% embed url="https://codepen.io/tatum-devrel/pen/mdQoVpz" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The return object is an array of JSON objects, with each object representing a chain tip. The fields in each object are: + +* `height`: The height of the chain tip in the block chain. +* `hash`: The hash of the block corresponding to the chain tip. +* `branchlen`: The length of the branch connected to the main chain. +* `status`: The status of the chain tip, which can be one of the following values: + * `active`: The tip is part of the main chain. + * `valid-fork`: The tip is part of a valid but inactive fork. + * `valid-headers`: The tip is part of a valid fork but with incomplete block data. + * `headers-only`: The tip is a fork with valid headers but incomplete block data and an invalid parent block. + * `invalid`: The tip is part of an invalid fork. + * `unknown`: The tip has an unknown validation state. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getchaintips", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + { + "height": 787067, + "hash": "0000000000000000000348522f4f24304bfcadece8b34c0696faa4f87ec4fdc4", + "branchlen": 0, + "status": "active" + }, + { + "height": 784121, + "hash": "000000000000000000046a2698233ed93bb5e74ba7d2146a68ddb0c2504c980d", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 783830, + "hash": "0000000000000000000366d2c12772a350f507879a5325203424e58ec440249b", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783478, + "hash": "0000000000000000000446f7d3093688ae697386fed3f52a63812678ea6b251d", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 783426, + "hash": "00000000000000000002ec935e245f8ae70fc68cc828f05bf4cfa002668599e4", + "branchlen": 1, + "status": "invalid" + }, + { + "height": 782333, + "hash": "00000000000000000001a1abda3a2eb4acc211f64f8748d1a7635aad80690b7a", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 782129, + "hash": "000000000000000000036f461ab63c78f08401d3907a67fd2237166d8a373193", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 781487, + "hash": "0000000000000000000125e5d7c0d2e1b83982e5284ea21e08f5a73b8109d41b", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 781277, + "hash": "0000000000000000000388f42000fa901c01f2bfae36042bbae133ee430e6485", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 780994, + "hash": "00000000000000000001b666391fe81859e96fdfdbb83f1a1eafb7951c738c77", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 777172, + "hash": "0000000000000000000215ac1b6fd564d8d4707631f6b77273521eb1e242cf28", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 776941, + "hash": "00000000000000000004cc87382e38118248ec926716565d50d63f0637c22c07", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 772981, + "hash": "0000000000000000000682990a0dae862b48e0451d619938215dd47ed9560200", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771745, + "hash": "00000000000000000004370a77a30add64bba97c26a90ca9643b45a75219b2a6", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 771627, + "hash": "00000000000000000005a92bdb6f9d55ea8d2b42579e0db6ca7764f97b6910e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 763445, + "hash": "000000000000000000065d0f6847466feeeaffa9663895cedde33aa12c262e00", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 759781, + "hash": "000000000000000000025edbf5ea025e4af2674b318ba82206f70681d97ca162", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 741082, + "hash": "00000000000000000004e2891d08337eb9263b703eb1c897e05dc59e8b246a9b", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 737096, + "hash": "00000000000000000002b07a9a9f066d463844960542d96e88b4815e063fab08", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 733430, + "hash": "00000000000000000006ead1cff09f279f7beb31a7290c2a603b0776d98dc334", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 730848, + "hash": "000000000000000000029ec31578132d01696910f299f8d104f29b8f8bbdc24f", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 723102, + "hash": "00000000000000000006a970fdd8e537521747aff917d909bf3a78b4b68143e1", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715276, + "hash": "00000000000000000009b160476c5f407ccd4957e20346b862d8fc46004759f0", + "branchlen": 1, + "status": "valid-headers" + }, + { + "height": 715139, + "hash": "0000000000000000000407bc4e26035c137869cdb677dfcab268b3faf7d7b5d1", + "branchlen": 1, + "status": "headers-only" + }, + { + "height": 714637, + "hash": "00000000000000000009f819d004fea5bcb77bda25f4906d0a39e79c9ba19590", + "branchlen": 1, + "status": "valid-fork" + }, + { + "height": 714367, + "hash": "0000000000000000000b2e70d7675bc7b4e89d384d0e6e1a7ecc2779e1d93244", + "branchlen": 1, + "status": "valid-headers" + } + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getdifficulty.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getdifficulty.md new file mode 100644 index 0000000..0f88374 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/getdifficulty.md @@ -0,0 +1,63 @@ +# getdifficulty + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getDifficulty() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +`getdifficulty` is a Litecoin RPC method that returns the current mining difficulty. The mining difficulty is a measure of how difficult it is to find a new block compared to the easiest it can ever be. This method can be used to monitor the mining difficulty, which adjusts every 2016 blocks to maintain a consistent block creation rate of approximately 10 minutes per block. + +{% embed url="https://codepen.io/tatum-devrel/pen/qBQvbxp" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +A return object is a floating-point number that represents the current mining difficulty. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getdifficulty", + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": 48712405953118.43, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxout.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxout.md new file mode 100644 index 0000000..c614a04 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxout.md @@ -0,0 +1,96 @@ +# gettxout + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getTxOut("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", 1) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxout` RPC method returns details about an unspent transaction output (UTXO). This method can be used to check if a specific transaction output is still unspent and obtain its details such as the value and scriptPubKey. + +{% embed url="https://codepen.io/Ivan-Sramko/pen/zYmVELO" %} + +### Parameters + +* `txid` (string, required): The transaction ID of the output. +* `n` (numeric, required): The index of the output within the transaction (vout). +* `include_mempool` (boolean, optional, default=true): Whether to include the mempool. Set to `false` to only check for outputs confirmed in the blockchain. + +**Example** + +* `txid`: `"a12345abcdef67890bcdef1234567890abcdef1234567890abcdef1234567890"` +* `n`: `1` +* `include_mempool`: `true` + +### Return Object + +The return object contains the following fields: + +* `bestblock`: (string) The hash of the block at the tip of the blockchain. +* `confirmations`: (numeric) The number of confirmations for the transaction. -1 if the transaction is not yet confirmed and in the mempool. +* `value`: (numeric) The value of the output in BTC. +* `scriptPubKey`: (object) Information about the output's scriptPubKey. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex representation of the script. + * `type`: (string) The type of the script (e.g., `pubkeyhash`, `scripthash`). + * `addresses`: (array) The Litecoin addresses associated with this output. +* `coinbase`: (boolean) Whether the transaction is a coinbase transaction. +* `version`: (numeric) The transaction version. +* `height`: (numeric) The height of the block containing this output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxout", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", 1], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "bestblock": "00000000000000000000bb252e11a381e2d9ee948dd8f2c9df9b7cb41adc40b2", + "confirmations": 5, + "value": 0.0027, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + }, + "coinbase": false + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxoutproof.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxoutproof.md new file mode 100644 index 0000000..3c3da54 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/gettxoutproof.md @@ -0,0 +1,70 @@ +# gettxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getTxOutProof(["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `gettxoutproof` RPC method returns a hex-encoded proof that the specified transaction(s) were included in a block. This method can be used to provide proof of inclusion for one or more transactions in the blockchain. + +{% embed url="https://codepen.io/tatum-devrel/pen/mdQoVxQ" %} + +### Parameters + +* `txids` (array, required): An array of transaction IDs to create a proof for. +* `blockhash` (string, optional): The hash of the block that contains the transactions. If not provided, the method will search for the transactions in the most recent blocks. + +**Example** + +* `txids`: `["`c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2`"]` +* `blockhash`: `"`00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2`"` + +### Return Object + +* `hex`: (string) The hex-encoded proof of the transaction(s) inclusion in the block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "gettxoutproof", + "params": [["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2"], "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "00800020208d9c3576f57c3f0c35bd94440f37fe7971cf2b914001000000000000000000db47732e70243f1ae818f635ae4f5cacbacf1230f4dc226f0e62c0871d6e8692a4f5486439c705171a71df638e1100000e8c9aa54adefc4c7b9ccd760b4ee1369bdd5cc7cb8b3e426b4a3b490c2eee5473e8f8f4134d4035e4241a929b9cdac2c22b6d74e0cae88e9ad1f50eeba06ae52659f1c0be83c1705e6642336d47356c39632ca55d11c04f24d09132fd081f5144caf6c733deed2366cd75a4e5a355920cd31c889239e78e195fb15435451f82398b683b27258ff3523cf63a276f38ffe296dd541b99f80cc87ecb40f473e1af2656ac06a0d999105c71c293e571bb62bdd3f0509fe8d5be381d92a76d1659cafcfea20ac316c4cc72a4d81fd7e9d94227cf6457d5412e4ef0d0b32e195a092321e1ad6c16ff7c6a28b39104f3e38a21775f4ea730b25269de7a54eb4dee8752735fe3e7add927cb2f0813a5bddda182776a559d7ba91c3580fb55e49a0bef8186f274f6dccad47742cdab8d3cab06c26c1336a23675bbc2ad36d1396ae451adc759fa97499c565c252524eed6934be8f18f3784f1f7d74a1471c1778af5aa65b6e6ebb5c3625ce00ac09a644aaa8b0b86b679e65c9fa204582ac285368b97eaa7ef2c43019754f8a3e9442c9a6820a25b3d7037fe53ba9d89732f5835939225fa30b5d86694bb5fc5a384e799a22ae82017fb0cf95e70e7bb529725a81e0f96f704afaa5a00", + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/verifytxoutproof.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/verifytxoutproof.md new file mode 100644 index 0000000..94742d5 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/network-state/verifytxoutproof.md @@ -0,0 +1,68 @@ +# verifytxoutproof + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.verifyTxOutProof("") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `verifytxoutproof` RPC method verifies the given transaction proof (in the form of a Merkle block) and returns an array of transaction hashes contained in the verified Merkle block. This method can be used to confirm that specific transactions are included in a block without having to download the entire block. + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQZEvX" %} + +### Parameters + +* `proof`: (string, required) The hex-encoded proof generated by the `gettxoutproof` RPC method. + +### Return Object + +* (array of strings) An array of transaction hashes contained in the verified Merkle block. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "verifytxoutproof", + "params": [ + "00000020fc61cc9f1bda9ef9e5d6bcccc7f210a0e87e7ccbc017d8487031b91d0000000047451bc9b84a546eafbe39baedb3cda967ea57cf1ab650b24d88395f2e4e3d413e4f22e8d9d9ea1c000000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a01000000434104e70b81e35e7cf03f6238471f7d9c903d48aea7c1d067e3010b9000000000000" + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": [ + "3e4f22e8d9d9ea1c123456789abcdef0123456789abcdef0123456789abcdef" + ], + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/README.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/README.md new file mode 100644 index 0000000..30549c3 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/README.md @@ -0,0 +1,2 @@ +# Transactions + diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/createrawtransaction.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/createrawtransaction.md new file mode 100644 index 0000000..c485e85 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/createrawtransaction.md @@ -0,0 +1,89 @@ +# createrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.createRawTransaction([ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `createrawtransaction` RPC method creates an unsigned raw transaction that spends a set of previous transaction outputs to a set of new addresses with specific amounts. The method can be used to create custom transactions, which can then be signed and broadcast to the Litecoin network. + +{% embed url="https://codepen.io/tatum-devrel/pen/jOQJWpb" %} + +### Parameters + +* `inputs`: (array, required) An array of objects, each specifying a previous transaction output to spend. + * `txid`: (string, required) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric, required) The index of the output to spend from the previous transaction. + * `sequence`: (numeric, optional) default=depends on the value of the 'replaceable' and 'locktime' arguments) The sequence number +* `outputs`: (object, required) An object with the key-value pairs representing the receiving address and the amount to be sent (in BTC). +* `locktime`: (numeric, optional, default=0) The lock time for the transaction. It can be used to specify the earliest time or block height at which the transaction can be included in a block. +* `replaceable`: (boolean, optional, default=false) **Marks this transaction as BIP125-replaceable.** Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible. + +### Return Object + +* (string) A hex-encoded raw transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "createrawtransaction", + "params": [ + [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0 + } + ], + { + "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa": 0.01 + } + ] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decoderawtransaction.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decoderawtransaction.md new file mode 100644 index 0000000..dc5044b --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decoderawtransaction.md @@ -0,0 +1,120 @@ +# decoderawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.decodeRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decoderawtransaction` RPC method decodes a serialized (hex-encoded) raw transaction and displays its information in a human-readable format. This method is useful for inspecting raw transactions before broadcasting them to the Litecoin network or for debugging purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOMPev" %} + +### Parameters + +* `hex_string`: (string, required) The serialized raw transaction in hex format. + +### Return Object + +An object containing the decoded raw transaction information: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size in bytes. +* `vsize`: (numeric) The virtual transaction size in bytes. +* `weight`: (numeric) The transaction weight. +* `locktime`: (numeric) The lock time for the transaction. +* `vin`: (array) An array of objects, each representing an input of the transaction. + * `txid`: (string) The transaction ID of the previous transaction output to spend. + * `vout`: (numeric) The index of the output to spend from the previous transaction. + * `scriptSig`: (object) The script used to redeem the previous transaction output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `sequence`: (numeric) The sequence number. +* `vout`: (array) An array of objects, each representing an output of the transaction. + * `value`: (numeric) The amount sent to the output in BTC. + * `n`: (numeric) The index of the output. + * `scriptPubKey`: (object) The script used to lock the output. + * `asm`: (string) The assembly representation of the script. + * `hex`: (string) The hex-encoded script. + * `reqSigs`: (numeric) The required number of signatures. + * `type`: (string) The type of the script (e.g., 'pubkeyhash'). + * `addresses`: (array) An array of Litecoin addresses associated with the output. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decoderawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "hash": "9f5f5e6d36b6a284f52626be505175e43900009e7aa1b88fce74fcd30f0dc258", + "version": 2, + "size": 85, + "vsize": 85, + "weight": 340, + "locktime": 0, + "vin": [ + { + "txid": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", + "vout": 0, + "scriptSig": { + "asm": "", + "hex": "" + }, + "sequence": 4294967293 + } + ], + "vout": [ + { + "value": 0.01, + "n": 0, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG", + "desc": "addr(1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa)#632p52jr", + "hex": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac", + "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", + "type": "pubkeyhash" + } + } + ] + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decodescript.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decodescript.md new file mode 100644 index 0000000..4bc0251 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/decodescript.md @@ -0,0 +1,75 @@ +# decodescript + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.decodeScript("3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `decodescript` RPC method decodes a serialized (hex-encoded) script and provides information about the script in a human-readable format. This method is useful for inspecting scripts for debugging purposes or for understanding their structure. + +{% embed url="https://codepen.io/tatum-devrel/pen/BaGbjOg" %} + +### Parameters + +* `hex_string`: (string, required) The serialized script in hex format. + +### Return Object + +An object containing the decoded script information: + +* `asm`: (string) The assembly representation of the script. +* `hex`: (string) The hex-encoded script. +* `type`: (string) The type of the script (e.g., 'pubkeyhash', 'multisig'). +* `reqSigs`: (numeric, optional) The required number of signatures if the script is a multisig script. +* `addresses`: (array, optional) An array of Litecoin addresses associated with the script if applicable. +* `p2sh`: (string, optional) The P2SH address for this script if applicable. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "decodescript", + "params": ["3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501"], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "asm": "44022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86 OP_MAX OP_UNKNOWN OP_UNKNOWN [error]", + "desc": "raw(3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501)#3x5hf724", + "type": "nonstandard" + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/estimatesmartfee.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/estimatesmartfee.md new file mode 100644 index 0000000..39c2198 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/estimatesmartfee.md @@ -0,0 +1,75 @@ +# estimatesmartfee + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.estimateSmartFee(20) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `estimatesmartfee` method provides an estimated fee rate (in BTC/kB) for a transaction to be confirmed within a certain number of blocks. The estimation is based on recent transactions in the Litecoin network. + +This method can be useful for users or applications trying to decide on an appropriate fee for their transactions, based on the desired confirmation speed. + +{% embed url="https://codepen.io/tatum-devrel/pen/NWEJxLW" %} + +### Parameters + +The `estimatesmartfee` method accepts the following parameters: + +* `conf_target`: An integer representing the number of blocks within which the transaction should be confirmed. +* `estimate_mode` _(optional)_: A string that determines the estimation mode. Possible values are "UNSET", "ECONOMICAL", and "CONSERVATIVE". Default is "CONSERVATIVE". + +### Return Object + +The `estimatesmartfee` method returns an object containing the following fields: + +* `feerate`: A decimal number representing the estimated fee rate in BTC/kB. +* `blocks`: An integer representing the number of blocks within which the transaction is expected to be confirmed. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "estimatesmartfee", + "params": [20], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "feerate": 0.00017258, + "blocks": 20 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/getrawtransaction.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/getrawtransaction.md new file mode 100644 index 0000000..3954208 --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/getrawtransaction.md @@ -0,0 +1,166 @@ +# getrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.getRawTransaction("c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `getrawtransaction` RPC method retrieves a raw transaction from the blockchain or mempool. It returns the serialized (hex-encoded) transaction data. This method can be used to inspect a transaction's content before it's included in a block or to decode the transaction for further analysis. + +{% embed url="https://codepen.io/tatum-devrel/pen/VwVReBB" %} + +### Parameters + +* `txid`: (string, required) The transaction ID of the transaction to fetch. +* `verbose`: (bool, optional, default=false) If set to `true`, the method returns a JSON object containing information about the transaction. + +### Return Object + +If `verbose` is `false`, the method returns a hex-encoded string representing the serialized transaction data. If `verbose` is `true`, the method returns a JSON object with the following fields: + +* `txid`: (string) The transaction ID. +* `hash`: (string) The transaction hash. +* `version`: (numeric) The transaction version. +* `size`: (numeric) The transaction size. +* `vsize`: (numeric) The virtual transaction size. +* `weight`: (numeric) The transaction's weight. +* `locktime`: (numeric) The transaction locktime. +* `vin`: (array) The transaction inputs. Each object within the array has the following properties: + 1. `txid`: A string representing the transaction ID of the output being spent. This refers to the transaction where the LTC being spent in the current transaction was received. + 2. `vout`: An integer representing the index of the output in the transaction specified by `txid`. This is the position of the output in that transaction's `vout` array. + 3. `scriptSig`: An object containing two fields, `asm` and `hex`, which represents the unlocking script that satisfies the conditions of the spent output's locking script. `asm` contains the assembly representation of the script while `hex` containing the hexadecimal representation. + 4. `sequence`: A number representing the sequence number of the input. It can be used to signal relative locktime constraints on the transaction. +* `vout`: (array) The transaction outputs. Each object within the array has the following properties: + 1. `value`: A decimal number representing the amount of litecoin being sent to the output's address. This value is expressed in litecoins (LTC). + 2. `n`: An integer representing the index of the output in the transaction's `vout` array. + 3. `scriptPubKey`: An object containing information about the locking script used to lock the output. The object has the following fields: + * `asm`: The assembly representation of the locking script. + * `hex`: The hexadecimal representation of the locking script. + * `reqSigs`: The number of required signatures to unlock the output (relevant for multisig addresses). + * `type`: The type of the locking script (e.g., 'pubkeyhash', 'scripthash', 'multisig', etc.). + * `addresses`: An array of Litecoin addresses associated with the output. +* `hex`: (string) The serialized transaction data in hex format. +* `blockhash`: (string, optional) The block hash containing the transaction. +* `confirmations`: (numeric, optional) The number of confirmations the transaction has. +* `time`: (numeric, optional) The transaction time in UNIX timestamp format. +* `blocktime`: (numeric, optional) The block time in UNIX timestamp format. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "method": "getrawtransaction", + "params": ["c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", true], + "id": 1 +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": { + "txid": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "hash": "c00fc27056ad4305dc65a40a78381a6c923b4311a460ceccd81401016f5c8984", + "version": 2, + "size": 284, + "vsize": 203, + "weight": 809, + "locktime": 0, + "vin": [ + { + "txid": "aaeb16390ca5209d8c72a0090a9ca87e6ff6491f239b3496cdb5c99977643583", + "vout": 9, + "scriptSig": { + "asm": "", + "hex": "" + }, + "txinwitness": [ + "3044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c8501", + "03c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c0" + ], + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 0.00112825, + "n": 0, + "scriptPubKey": { + "asm": "0 29a7007eabae2ac56f221aad9c983b77a9f96c3b", + "desc": "addr(bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k)#3al0qk8v", + "hex": "001429a7007eabae2ac56f221aad9c983b77a9f96c3b", + "address": "bc1q9xnsql4t4c4v2mezr2keexpmw75ljmpm0we75k", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.0027, + "n": 1, + "scriptPubKey": { + "asm": "0 24007ed98749dbb504fdea2bd07715c94d4c7751", + "desc": "addr(bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88)#2wxgfkqe", + "hex": "001424007ed98749dbb504fdea2bd07715c94d4c7751", + "address": "bc1qysq8akv8f8dm2p8aag4aqac4e9x5ca63yq4c88", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.00104468, + "n": 2, + "scriptPubKey": { + "asm": "0 c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "desc": "addr(bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa)#5rw0gs2m", + "hex": "0014c4c04e31613e2c3dfadaedde383bbfdd7a107d8a", + "address": "bc1qcnqyuvtp8ckrm7k6ah0rswalm4apqlv2ku24fa", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.41658346, + "n": 3, + "scriptPubKey": { + "asm": "0 b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "desc": "addr(bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4)#savgw9p6", + "hex": "0014b33b0a68aba1d4697d8329f2b7939fb2a46b7332", + "address": "bc1qkvas569t582xjlvr98et0yulk2jxkuejx27yh4", + "type": "witness_v0_keyhash" + } + } + ], + "hex": "020000000001018335647799c9b5cd96349b231f49f66f7ea89c0a09a0728c9d20a50c3916ebaa0900000000feffffff04b9b801000000000016001429a7007eabae2ac56f221aad9c983b77a9f96c3bb01e04000000000016001424007ed98749dbb504fdea2bd07715c94d4c77511498010000000000160014c4c04e31613e2c3dfadaedde383bbfdd7a107d8aeaa77b0200000000160014b33b0a68aba1d4697d8329f2b7939fb2a46b733202473044022070cc08500b2203b6ebe7c8285295bc1914a9d252504416e1cde4de4a7dc6c3c8022079af2be6db34efcf147e86a4cbf61cf9995106e5b5e95270d47c40b082052c85012103c9f7cff5a1d1a5fc107f37609c99d2e0fd699cacdef9696753b626b7508921c000000000", + "blockhash": "00000000000000000004c6125026f00b76e7b762e645a0b0b7ecfa7a7dafdba2", + "confirmations": 7, + "time": 1682503076, + "blocktime": 1682503076 + }, + "error": null, + "id": 1 +} +``` +{% endcode %} + +\ diff --git a/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/sendrawtransaction.md b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/sendrawtransaction.md new file mode 100644 index 0000000..d6459fb --- /dev/null +++ b/docs/rpc/utxo-blockchains/litecoin-rpc-documentation/transactions/sendrawtransaction.md @@ -0,0 +1,67 @@ +# sendrawtransaction + +### How to use it + +{% tabs %} +{% tab title="TypeScript/JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Litecoin, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.LITECOIN}) + +const result = await tatum.rpc.sendRawTransaction("02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000") + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Overview + +The `sendrawtransaction` method submits a serialized raw transaction to the Litecoin network. If the transaction is well-formed and valid, it will be propagated to the network and included in a mined block. + +This method is commonly used in conjunction with [`createrawtransaction`](../../bitcoin-rpc-documentation/transactions/createrawtransaction.md), or other methods to construct and sign raw transactions before broadcasting them. + +### Parameters + +The `sendrawtransaction` method accepts the following parameters: + +* `hexstring`: A string representing the serialized raw transaction in hexadecimal format. + +### Return Object + +The `sendrawtransaction` method returns a string containing the transaction ID (txid) of the broadcasted transaction. + +### JSON Examples + +Request example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "sendrawtransaction", + "params": ["02000000013412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab3412cdab0000000000fdffffff0140420f00000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000"] +} +``` +{% endcode %} + +Response example: + +{% code overflow="wrap" lineNumbers="true" %} +```json +{ + "result": "c7ad51e46a39d136adc2bb7536a236136cc206ab3c8dabcd4277d4cadcf674f2", + "error": null, + "id": 1 +} + +``` +{% endcode %} + +\ diff --git a/docs/rpc/xrp-rpc-documentation/README.md b/docs/rpc/xrp-rpc-documentation/README.md new file mode 100644 index 0000000..36b9b7a --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/README.md @@ -0,0 +1,9 @@ +# XRP RPC documentation + +XRP RPC (Remote Procedure Call) is an essential tool for developers seeking to interact with the XRP Ledger network. It provides a standardised interface for communication, enabling developers to retrieve data, send transactions, query account information, and more. XRP RPC plays a vital role in building applications, integrating blockchain functionality, and exploring the possibilities offered by the XRP Ledger. + +Getting Started with XRP RPC using Tatum SDK (Video Tutorial): + +{% embed url="https://youtu.be/jZ68HVhcujY" %} + +In this video tutorial, we will walk you through the process of getting started with XRP RPC using the Tatum SDK. Tatum SDK is a comprehensive blockchain development toolkit that simplifies the interaction with various blockchain networks, including the XRP Ledger. By following the tutorial, you will learn how to set up your development environment, establish a connection to the XRP Ledger network via RPC, and perform common operations such as retrieving transaction data. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/README.md new file mode 100644 index 0000000..4e11e05 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/README.md @@ -0,0 +1,2 @@ +# API calls for account methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_channels.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_channels.md new file mode 100644 index 0000000..f018966 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_channels.md @@ -0,0 +1,106 @@ +# account\_channels + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountChannels('rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn', { + destinationAccount: 'ra5nK24KXen9AHvsdFTKHSANinZseWnPcX', + ledgerIndex: 'validated', +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `account_channels` RPC method allows you to retrieve information about an account's Payment Channels on the XRP Ledger. This includes only channels where the specified account is the source (or owner) of the channel, not the destination. The information returned is relative to a particular version of the ledger. + +Use cases for `account_channels` include: + +* Tracking the status of open Payment Channels +* Auditing total outbound XRP from an account via Payment Channels +* Monitoring Payment Channel balances to determine if they need to be topped up + +{% embed url="https://codepen.io/tatum-devrel/pen/dyQLjEX" %} + +### Parameters + +The `account_channels` RPC method includes the following parameters: + +* `account`: The unique identifier of an account, typically the account's Address. The request returns channels where this account is the channel's owner/source. +* `destination_account` (Optional): The unique identifier of an account, typically the account's Address. If provided, filter results to payment channels whose destination is this account. +* `ledger_hash` (Optional): A 20-byte hex string for the ledger version to use. +* `ledger_index` (Optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. +* `limit` (Optional): Limit the number of transactions to retrieve. Cannot be less than 10 or more than 400. The default is 200. +* `marker` (Optional): Value from a previous paginated response. Resume retrieving data where that response left off. + +### Return Object + +The response to the `account_channels` RPC call includes an array of Channel Objects, each containing the following fields: + +* `account` (String): The address of the source/owner of the payment channels. This corresponds to the account field of the request. +* `channels` (Array of Channel Objects): Payment channels owned by this account. Each Channel Object includes: + * `account` (String): The owner of the channel, as an Address. + * `amount` (String): The total amount of XRP, in drops allocated to this channel. + * `balance` (String): The total amount of XRP, in drops, paid out from this channel, as of the ledger version used. + * `channel_id` (String): A unique ID for this channel, as a 64-character hexadecimal string. This is also the ID of the channel object in the ledger's state data. + * `destination_account` (String): The destination account of the channel, as an Address. Only this account can receive the XRP in the channel while it is open. + * `settle_delay` (Unsigned Integer): The number of seconds the payment channel must stay open after the owner of the channel requests to close it. + * `public_key` (String): May be omitted. The public key for the payment channel in the XRP Ledger's base58 format. + * `public_key_hex` (String): May be omitted. The public key for the payment channel in hexadecimal format. + * `expiration` (Unsigned Integer): May be omitted. Time, in seconds since the Ripple Epoch, when this channel is set to expire. + * `cancel_after` (Unsigned Integer): May be omitted. Time, in seconds since the Ripple Epoch, of this channel's immutable expiration. + * `source_tag` (Unsigned Integer): May be omitted. A 32-bit unsigned integer to use as a source tag for payments through this payment channel. + * `destination_tag` (Unsigned Integer): May be omitted. A 32-bit unsigned integer to use as a destination tag for payments through this channel. +* `ledger_hash` (String): May be omitted. The identifying hash of the ledger version used to generate this response. +* `ledger_index` (Number): The ledger index of the ledger version used to generate this response. +* `validated` (Boolean): May be omitted. If true, this data comes from a validated ledger version. +* `limit` (Number): May be omitted. The limit to how many channel objects were actually returned by this request. +* `marker` (Marker): May be omitted. Server-defined value for pagination. Pass this to the next call to resume getting results where this call left off. + +### JSON-RPC Request Example + +```json +{ + "method": "account_channels", + "params": [{ + "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "ledger_index": "validated" + }] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "channels": [ + { + "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "amount": "1000", + "balance": "0", + "channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7", + "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw", + "public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2", + "settle_delay": 60 + } + ], + "ledger_hash": "27F530E5C93ED5C13994812787C1ED073C822BAEC7597964608F2C049C2ACD2D", + "ledger_index": 71766343, + "status": "success", + "validated": true + } +} +``` + +Please note, the response may contain an array of channel objects if there are multiple channels associated with the provided account. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_currencies.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_currencies.md new file mode 100644 index 0000000..d082a27 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_currencies.md @@ -0,0 +1,75 @@ +# account\_currencies + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountCurrencies('r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', { + ledgerIndex: 'validated', + strict: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `accountCurrencies` method retrieves a list of currencies that an account can send or receive, based on its trust lines. This isn't a thoroughly confirmed list but can be used to populate user interfaces. + +{% embed url="https://codepen.io/tatum-devrel/pen/gOQyjNx" %} + +### Parameters + +The method accepts two parameters: + +* `account` (**required**): A unique identifier for the account, most commonly the account's Address. +* `options` (**optional**): An object with the following properties: + * `ledgerHash`: A 20-byte hex string for the ledger version to use. + * `ledgerIndex`: The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. + * `strict`: If true, then the `account` field only accepts a public key or XRP Ledger address. Otherwise, `account` can be a secret or passphrase (not recommended). The default is false. + +### Return Object + +The `accountCurrencies` method returns an object with following fields: + +* `ledger_hash` (String - Hash): May be omitted. The identifying hash of the ledger version used to retrieve this data, as hex. +* `ledger_index` (Integer - Ledger Index): The ledger index of the ledger version used to retrieve this data. +* `receive_currencies` (Array of Strings): Array of Currency Codes for currencies that this account can receive. +* `send_currencies` (Array of Strings): Array of Currency Codes for currencies that this account can send. +* `validated` (Boolean): If true, this data comes from a validated ledger.\ + + +### JSON-RPC Request Example + +Here's an example of how the JSON-RPC request might look like: + +```json +{ + "command": "account_currencies", + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "strict": true, + "ledger_index": "validated" +} +``` + +### JSON-RPC Response Example + +Here's an example of how the JSON-RPC response might look like: + +```json +{ + "result": { + "ledger_index": 11775844, + "receive_currencies": ["BTC", "CNY", "DYM", "EUR", "JOE", "MXN", "USD", "015841551A748AD2C1F76FF6ECB0CCCD00000000"], + "send_currencies": ["ASP", "BTC", "CHF", "CNY", "DYM", "EUR", "JOE", "JPY", "MXN", "USD"], + "validated": true + }, + "status": "success", + "type": "response" +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_info.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_info.md new file mode 100644 index 0000000..9e26a2d --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_info.md @@ -0,0 +1,134 @@ +# account\_info + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountInfo('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', { + ledgerIndex: 'current', + strict: true, + queue: true, + signerLists: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `accountInfo` method retrieves information about an account, its activity, and its XRP balance. All information retrieved is relative to a particular version of the ledger. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqOYKL" %} + +### Parameters + +The method accepts two parameters: + +* `account` (**required**): A unique identifier for the account, most commonly the account's Address. +* `options` (**optional**): An object with the following properties: + * `ledgerHash`: A 20-byte hex string for the ledger version to use. + * `ledgerIndex`: The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. + * `queue`: If true, also returns stats about queued transactions associated with this account. Can only be used when querying for the data from the current open ledger. + * `signerLists`: If true, also returns any SignerList objects associated with this account. + * `strict`: If true, then the `account` field only accepts a public key or XRP Ledger address. Otherwise, `account` can be a secret or passphrase (not recommended). The default is false. + +### Return Object + +The `accountInfo` method returns object with following fields: + +* `account_data`: This is an object that contains the AccountRoot ledger object with this account's information, as stored in the ledger. +* `signer_lists`: This is an array of SignerList ledger objects associated with this account for Multi-Signing. This field is omitted unless the request specified signer\_lists and at least one SignerList is associated with the account. Since an account can own at most one SignerList, this array must have exactly one member if it is present. +* `ledger_current_index`: This is the ledger index of the current in-progress ledger, which was used when retrieving this information. This is omitted if ledger\_index is provided instead. +* `ledger_index`: This is the ledger index of the ledger version used when retrieving this information. The information does not contain any changes from ledger versions newer than this one. This is omitted if ledger\_current\_index is provided instead. +* `queue_data`: This is an object that contains information about queued transactions sent by this account. This information describes the state of the local rippled server, which may be different from other servers in the peer-to-peer XRP Ledger network. Some fields may be omitted because the values are calculated "lazily" by the queuing mechanism. This is omitted unless queue specified as true and querying the current open ledger. +* `validated`: This is a boolean value that is true if this data is from a validated ledger version. If omitted or set to false, this data is not final. + +The `queue_data` parameter, if present, contains the following fields: + +* `txn_count`: The number of queued transactions from this address. +* `auth_change_queued`: Whether a transaction in the queue changes this address's ways of authorizing transactions. If true, this address can queue no further transactions until that transaction has been executed or dropped from the queue. +* `lowest_sequence`: The lowest Sequence Number among transactions queued by this address. +* `highest_sequence`: The highest Sequence Number among transactions queued by this address. +* `max_spend_drops_total`: The integer amount of drops of XRP that could be debited from this address if every transaction in the queue consumes the maximum amount of XRP possible. +* `transactions`: An array containing information about each queued transaction from this address. Each object in the `transactions` array, if present, may contain any or all of the following fields: + * `auth_change`: Whether this transaction changes this address's ways of authorizing transactions. + * `fee`: The Transaction Cost of this transaction, in drops of XRP. + * `fee_level`: The transaction cost of this transaction, relative to the minimum cost for this type of transaction, in fee levels. + * `max_spend_drops`: The maximum amount of XRP, in drops, this transaction could send or destroy. + * `seq`: The Sequence Number of this transaction. + +\ + + +### JSON-RPC Request Example + +Here's an example of how the JSON-RPC request might look like: + +```json +{ + "id": 2, + "command": "account_info", + "account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn", + "strict": true, + "ledger_index": "current", + "queue": true +} +``` + +### JSON-RPC Response Example + +Here's an example of how the JSON-RPC response might look like: + +```json +{ + "id": 5, + "status": "success", + "type": "response", + "result": { + "account_data": { + "Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn", + "Balance": "999999999960", + "Flags": 8388608, + "LedgerEntryType": "AccountRoot", + "OwnerCount": 0, + "PreviousTxnID": "4294BEBE5B569A18C0A2702387C9B1E7146DC3A5850C1E87204951C6FDAA4C42", + "PreviousTxnLgrSeq": 3, + "Sequence": 6, + "index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F" + }, + "ledger_current_index": 4, + "queue_data": { + "auth_change_queued": true, + "highest_sequence": 10, + "lowest_sequence": 6, + "max_spend_drops_total": "500", + "transactions": [ + { + "auth_change": false, + "fee": "100", + "fee_level": "2560", + "max_spend_drops": "100", + "seq": 6 + }, + ... (trimmed for length) ... + { + "LastLedgerSequence": 10, + "auth_change": true, + "fee": "100", + "fee_level": "2560", + "max_spend_drops": "100", + "seq": 10 + } + ], + "txn_count": 5 + }, + "status": "success", + "validated": false + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_lines.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_lines.md new file mode 100644 index 0000000..de24968 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_lines.md @@ -0,0 +1,116 @@ +# account\_lines + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountLines('r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', { + ledgerIndex: 'validated', + peer: 'r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z', + limit: 10, + marker: 'example_marker', +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `account_lines` method returns information about an account's trust lines, which contain balances in all non-XRP currencies and assets. All information retrieved is relative to a particular version of the ledger. + +{% embed url="https://codepen.io/tatum-devrel/pen/abQxawN" %} + +### Parameters + +* `account`: (String) A unique identifier for the account, most commonly the account's Address. +* `options`: (AccountLinesOptions) An object with optional parameters: + * `ledgerHash`: (Optional, String) A 20-byte hex string for the ledger version to use. + * `ledgerIndex`: (Optional, LedgerIndex) The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. Can be 'validated', 'closed', 'current', or a number. + * `peer`: (Optional, String) The Address of a second account. If provided, show only lines of trust connecting the two accounts. + * `limit`: (Optional, Number) Limit the number of results to retrieve. + * `marker`: (Optional, unknown) Value from a previous paginated response. Resume retrieving data where that response left off. + +### Return Object + +The response object has the following properties: + +* `account`: (String) Unique Address of the account this request corresponds to. This is the "perspective account" for the purpose of the trust lines. +* `lines`: (Array) Array of trust line objects, as described below. If the number of trust lines is large, only returns up to the limit at a time. +* `ledger_current_index`: (Optional, Integer) The ledger index of the current open ledger, which was used when retrieving this information. +* `ledger_index`: (Optional, Integer) The ledger index of the ledger version that was used when retrieving this data. +* `ledger_hash`: (Optional, String) The identifying hash of the ledger version that was used when retrieving this data. +* `marker`: (Optional, Marker) Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. + +Each trust line object has some combination of the following fields: + +* `account`: (String) The unique Address of the counterparty to this trust line. +* `balance`: (String) Representation of the numeric balance currently held against this line. A positive balance means that the perspective account holds value; a negative balance means that the perspective account owes value. +* `currency`: (String) A Currency Code identifying what currency this trust line can hold. +* `limit`: (String) The maximum amount of the given currency that this account is willing to owe the peer account. +* `limit_peer`: (String) The maximum amount of currency that the counterparty account is willing to owe the perspective account. +* `quality_in`: (Unsigned Integer) Rate at which the account values incoming balances on this trust line, as a ratio of this value per 1 billion units. +* `quality_out`: (Unsigned Integer) Rate at which the account values outgoing balances on + +this trust line, as a ratio of this value per 1 billion units. + +* `no_ripple`: (Optional, Boolean) If true, this account has enabled the No Ripple flag for this trust line. +* `no_ripple_peer`: (Optional, Boolean) If true, the peer account has enabled the No Ripple flag for this trust line. +* `authorized`: (Optional, Boolean) If true, this account has authorized this trust line. +* `peer_authorized`: (Optional, Boolean) If true, the peer account has authorized this trust line. +* `freeze`: (Optional, Boolean) If true, this account has frozen this trust line. +* `freeze_peer`: (Optional, Boolean) If true, the peer account has frozen this trust line. + +### JSON-RPC Request Example + +```json +{ + "id": 1, + "command": "account_lines", + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "ledger_index": "validated", + "peer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "limit": 10, + "marker": "example_marker" +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": 1, + "status": "success", + "type": "response", + "result": { + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "lines": [ + { + "account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "balance": "0", + "currency": "ASP", + "limit": "0", + "limit_peer": "10", + "quality_in": 0, + "quality_out": 0 + }, + { + "account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "balance": "0", + "currency": "XAU", + "limit": "0", + "limit_peer": "0", + "no_ripple": true, + "no_ripple_peer": true, + "quality_in": 0, + "quality_out": 0 + } + ], + "ledger_index": 1000000 + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_nfts.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_nfts.md new file mode 100644 index 0000000..06a235b --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_nfts.md @@ -0,0 +1,88 @@ +# account\_nfts + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountNfts('rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx', { + ledger_index: 'validated', + limit: 100 +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `accountNfts` method returns a list of Non-Fungible Tokens (NFTs) objects for a specific account. This method is useful when you want to retrieve all the NFTs owned by a particular account. The method is available due to the NonFungibleTokensV1\_1 amendment. + +{% embed url="https://codepen.io/tatum-devrel/pen/NWEmLae" %} + +### Parameters + +#### Main Parameters + +* `account`: A unique identifier for the account, most commonly the account's Address. + +#### Optional Parameters (part of `options?: Ledger & Pagination` object) + +* `ledger_hash`: A 20-byte hex string for the ledger version to use. +* `ledger_index`: The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. +* `limit`: Limit the number of token pages to retrieve. Each page can contain up to 32 NFTs. The limit value cannot be lower than 20 or more than 400. The default is 100. +* `marker`: Value from a previous paginated response. Resume retrieving data where that response left off. + +### Return Object + +The returned object will be a successful result containing the account's address and an array of NFT objects. + +Here are the fields in the response: + +* `Flags`: This is a number that represents a bit-map of boolean flags enabled for this NFToken. This can provide additional information about the token, such as whether it's transferable, mintable, etc. The specific flags and their meanings can vary based on the implementation. +* `Issuer`: This is a string that represents the address of the account that issued this NFToken. It's the unique identifier of the account that created and originally owned this token. +* `NFTokenID`: This is a string that represents the unique identifier of this NFToken, in hexadecimal. This is typically a unique identifier that differentiates this token from all others on the ledger. +* `NFTokenTaxon`: This is a number that represents the unscrambled version of this token's taxon. Several tokens with the same taxon might represent instances of a limited series. This can be used to group similar tokens together. +* `URI`: This is a string that represents the URI data associated with this NFToken, in hexadecimal. This often points to a resource that has more information about the token, such as an image, audio file, or a webpage. +* `nft_serial`: This is a number that represents the token sequence number of this NFToken, which is unique for its issuer. This can be used to determine the order in which the tokens were created. + +### JSON-RPC Request Example + +```json +{ + "method": "account_nfts", + "params": [ + { + "account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx", + "ledger_index": "validated", + "limit": 100 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx", + "account_nfts": [ + { + "Flags": 1, + "Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm", + "NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004", + "NFTokenTaxon": 0, + "URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469", + "nft_serial": 4 + }, + // More NFTs... + ], + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_objects.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_objects.md new file mode 100644 index 0000000..8ac5069 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_objects.md @@ -0,0 +1,163 @@ +# account\_objects + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountObjects('r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', { + ledger_index: 'validated', + type: 'state', + deletion_blockers_only: false, + limit: 10 +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `accountObjects` method returns the raw ledger format for all objects owned by an account. This includes Offer objects for orders that are currently live, unfunded, or expired but not yet removed, RippleState objects for trust lines where this account's side is not in the default state, the account's SignerList, if the account has multi-signing enabled, Escrow objects for held payments that have not yet been executed or canceled, PayChannel objects for open payment channels, Check objects for pending Checks, DepositPreauth objects for deposit preauthorizations, Ticket objects for Tickets, and NFTokenPage objects for collections of NFTs. + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQJxYQ" %} + +### Parameters + +#### Main Parameters + +* `account`: A unique identifier for the account, most commonly the account's Address. + +#### Optional Parameters (part of `options?: AccountObjectsOptions` object) + +* `deletion_blockers_only`: If true, the response only includes objects that would block this account from being deleted. The default is false. +* `ledger_hash`: A 20-byte hex string for the ledger version to use. +* `ledger_index`: The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. +* `limit`: The maximum number of objects to include in the results. Must be within the inclusive range 10 to 400 on non-admin connections. The default is 200. +* `marker`: Value from a previous paginated response. Resume retrieving data where that response left off. +* `type`: Filter results by a ledger entry type. The valid types are: check, deposit\_preauth, escrow, nft\_offer, offer, payment\_channel, signer\_list, state (trust line), and ticket. + +### Return Object + +The returned object will be a successful result containing the account's address and an array of objects owned by this account. + +Here are the fields in the response: + +* `account`: This is a string that represents the unique address of the account that this request corresponds to. +* `account_objects`: This is an array of objects owned by the account. Each object is in its raw ledger format. The specific fields in each object can vary depending on the type of the object. Common ledger object types include Offer, RippleState, AccountRoot, and others. +* `ledger_hash`: This is a string that may be omitted. It represents the identifying hash of the ledger that was used to generate this response. +* `ledger_index`: This is a number that may be omitted. It represents the ledger index of the ledger version that was used to generate this response. +* `ledger_current_index`: This is a number that may be omitted. It represents the ledger index of the current in-progress ledger version, which was used to generate this response. +* `limit`: This is a number that may be omitted. It represents the limit that was used in this request, if any. +* `marker`: This is a server-defined value indicating the response is paginated. You can pass this to the next call to resume where this call left off. It is omitted when there are no additional pages after this one. +* `validated`: This is a boolean. If included and set to true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change. + +### JSON-RPC Request Example + +```json +{ + "method": "account_objects", + "params": [ + { + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "ledger_index": "validated", + "type": "state", + "deletion_blockers_only": false, + "limit": 10 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "account_objects": [ + { + "Balance": { + "currency": "ASP", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "0" + }, + "Flags": 65536, + "HighLimit": { + "currency": "ASP", + "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "value": "0" + }, + "HighNode": "0000000000000000", + "LedgerEntryType": "RippleState", + "LowLimit": { + "currency": "ASP", + "issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "value": "10" + }, + "LowNode": "0000000000000000", + "PreviousTxnID": "BF7555B0F018E3C5E2A3FF9437A1A5092F32903BE246202F988181B9CED0D862", + "PreviousTxnLgrSeq": 1438879, + "index": "2243B0B630EA6F7330B654EFA53E27A7609D9484E535AB11B7F946DF3D247CE9" + }, + { + "Balance": { + "currency": "XAU", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "0" + }, + "Flags": 3342336, + "HighLimit": { + "currency": "XAU", + "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "value": "0" + }, + "HighNode": "0000000000000000", + "LedgerEntryType": "RippleState", + "LowLimit": { + "currency": "XAU", + "issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "value": "0" + }, + "LowNode": "0000000000000000", + "PreviousTxnID": "79B26D7D34B950AC2C2F91A299A6888FABB376DD76CFF79D56E805BF439F6942", + "PreviousTxnLgrSeq": 5982530, + "index": "9ED4406351B7A511A012A9B5E7FE4059FA2F7650621379C0013492C315E25B97" + }, + { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "0" + }, + "Flags": 1114112, + "HighLimit": { + "currency": "USD", + "issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", + "value": "0" + }, + "HighNode": "0000000000000000", + "LedgerEntryType": "RippleState", + "LowLimit": { + "currency": "USD", + "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "value": "5" + }, + "LowNode": "0000000000000000", + "PreviousTxnID": "6FE8C824364FB1195BCFEDCB368DFEE3980F7F78D3BF4DC4174BB4C86CF8C5CE", + "PreviousTxnLgrSeq": 10555014, + "index": "2DECFAC23B77D5AEA6116C15F5C6D4669EBAEE9E7EE050A40FE2B1E47B6A9419" + } + ], + "ledger_hash": "4C99E5F63C0D0B1C2283B4F5DCE2239F80CE92E8B1A6AED1E110C198FC96E659", + "ledger_index": 14380380, + "limit": 10, + "marker": "F60ADF645E78B69857D2E4AEC8B7742FEABC8431BD8611D099B428C3E816DF93,94A9F05FEF9A153229E2E997E64919FD75AAE2028C8153E8EBDB4440BD3ECBB5", + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_offers.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_offers.md new file mode 100644 index 0000000..2787634 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_offers.md @@ -0,0 +1,108 @@ +# account\_offers + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +// Initialize the SDK for the XRP network +const tatum = await TatumSDK.init({network: Network.XRP}) + +// Use the account_offers method +const res = await tatum.rpc.accountOffers('rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM', { + ledgerIndex: 'validated', +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `account_offers` method retrieves a list of offers made by a given account that are outstanding as of a particular ledger version. It is typically used for monitoring the open offers that a particular account has made on the XRP Ledger's decentralised exchange. + +{% embed url="https://codepen.io/tatum-devrel/pen/mdQgGpx" %} + +### Parameters + +The `account_offers` method accepts the following parameters: + +* `account`: A unique identifier for the account, most commonly the account's Address. +* `ledger_hash` (Optional): A 20-byte hex string identifying the ledger version to use. +* `ledger_index` (Optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. +* `limit` (Optional): Limit the number of Offers to retrieve. The server may return fewer than this number of results. Must be within the inclusive range 10 to 400. The default is 200. +* `marker` (Optional): Value from a previous paginated response. Resume retrieving data where that response left off. +* `strict` (Optional): If true, then the account field only accepts a public key or XRP Ledger address. Otherwise, account can be a secret or passphrase (not recommended). The default is false. + +### Return Object + +The response follows the standard format, with a successful result containing the following fields: + +* `account`: Unique Address identifying the account that made the offers +* `offers`: Array of objects, where each object represents an offer made by this account that is outstanding as of the requested ledger version. +* `ledger_current_index` (Optional): The ledger index of the current in-progress ledger version, which was used when retrieving this data. +* `ledger_index` (Optional): The ledger index of the ledger version that was used when retrieving this data, as requested. +* `ledger_hash` (Optional): The identifying hash of the ledger version that was used when retrieving this data. +* `marker` (Optional): Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. + +### JSON-RPC Request Example + +```json +{ + "method": "account_offers", + "params": [ + { + "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM", + "ledger_current_index": 18539596, + "offers": [{ + "flags": 0, + "quality": "0.000000007599140009999998", + "seq": 6578020, + "taker_gets": "29740867287", + "taker_pays": { + "currency": "USD", + "issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", + "value": "226.0050145327418" + } + }, { + "flags": 0, + "quality": "7989247009094510e-27", + "seq": 6572128, + "taker_gets": "2361918758", + "taker_pays": { + "currency": "XAU", + "issuer": "rrh7rf1gV2pXAoqA8oYbpHd8TKv5ZQeo67", + "value": "0.01886995237307572" + } + }, { + "flags": 0, + "quality": "0.00000004059594001318974", + "seq": 6576905, + "taker_gets": "3892952574", + "taker_pays": { + "currency": "CNY", + "issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y", + "value": "158.0380691682966" + } + }, + + ... + + ], + "status": "success", + "validated": false + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_tx.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_tx.md new file mode 100644 index 0000000..b65b7a2 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/account_tx.md @@ -0,0 +1,222 @@ +# account\_tx + +### How to use It + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.accountTx('rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w', { + ledgerIndexMin: -1, + ledgerIndexMax: -1, + binary: false, + forward: false, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `account_tx` method is a part of the XRP Ledger's RPC API, allowing you to retrieve a list of transactions that involve a specified account. This method is useful when you need to track and analyze transactions related to a particular account, which can be necessary for various operations such as auditing, debugging or just for general monitoring purposes. + +{% embed url="https://codepen.io/tatum-devrel/pen/abQxaqm" %} + +### Parameters + +The `accountTx` method accepts the following parameters: + +* `account`: A unique identifier for the account, most commonly the account's address. +* `ledgerIndexMin`: (Optional) Use to specify the earliest ledger to include transactions from. A value of -1 instructs the server to use the earliest validated ledger version available. +* `ledgerIndexMax`: (Optional) Use to specify the most recent ledger to include transactions from. A value of -1 instructs the server to use the most recent validated ledger version available. +* `binary`: (Optional) Defaults to false. If set to true, returns transactions as hex strings instead of JSON. +* `forward`: (Optional) Defaults to false. If set to true, returns values indexed with the oldest ledger first. Otherwise, the results are indexed with the newest ledger first. + +### Return Object + +The response object includes the following fields: + +* `account`: Unique Address identifying the related account. +* `ledger_index_min`: The ledger index of the earliest ledger actually searched for transactions. +* `ledger_index_max`: The ledger index of the most recent ledger actually searched for transactions. +* `limit`: The limit value used in the request. +* `marker`: Server-defined value indicating the response is paginated. +* `transactions`: Array of transactions matching the request's criteria. +* `validated`: If included and set to true, the information in this response comes from a validated ledger version. + +Each transaction object includes the following fields: + +* `ledger_index`: The ledger index of the ledger version that included this transaction. +* `meta`: If binary is True, then this is a hex string of the transaction metadata. Otherwise, the transaction metadata is included in JSON format. +* `tx`: (JSON mode only) JSON object defining the transaction. +* `validated`: Whether or not the transaction is included in a validated ledger. + +### JSON-RPC Request Example + +```json +{ + "method": "account_tx", + "params": [ + { + "account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "binary": false, + "forward": false, + "ledger_index_max": -1, + "ledger_index_min": -1, + "limit": 2 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "ledger_index_max": 57112019, + "ledger_index_min": 56248229, + "limit": 2, + "marker": { + "ledger": 57112007, + "seq": 13 + }, + "status": "success", + "transactions": [ + { + "meta": { + "AffectedNodes": [ + { + "ModifiedNode": { + "FinalFields": { + "Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "Balance": "3732290013101", + "Flags": 131072, + "OwnerCount": 0, + "Sequence": 702820 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574", + "PreviousFields": { + "Balance": "3732745656171", + "Sequence": 702819 + }, + "PreviousTxnID": "7C031FD5B710E3C048EEF31254089BEEC505900BCC9A842257A0319453333998", + "PreviousTxnLgrSeq": 57112010 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Account": "raLPjTYeGezfdb6crXZzcC8RkLBEwbBHJ5", + "Balance": "4231510602153", + "Flags": 0, + "OwnerCount": 0, + "Sequence": 96486 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "39DC5D448DECEFC3CD20818788E3DA891CA943935E8D7B12FCB5B5871FCB1638", + "PreviousFields": { + "Balance": "4231054959123" + }, + "PreviousTxnID": "33D2014C832610293730028CA37857AC183BFCE3E42B9979C491FB8B82B3E9DC", + "PreviousTxnLgrSeq": 57112004 + } + } + ], + "TransactionIndex": 12, + "TransactionResult": "tesSUCCESS", + "delivered_amount": "455643030" + }, + "tx": { + "Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "Amount": "455643030", + "Destination": "raLPjTYeGezfdb6crXZzcC8RkLBEwbBHJ5", + "DestinationTag": 18240312, + "Fee": "40", + "Flags": 2147483648, + "LastLedgerSequence": 57112037, + "Sequence": 702819, + "SigningPubKey": "020A46D8D02AC780C59853ACA309EAA92E7D8E02DD72A0B6AC315A7D18A6C3276A", + "TransactionType": "Payment", + "TxnSignature": "30450221008602B2E390C0C7B65182C6DBC86292052C1961B2BEFB79C2C8431722C0ADB911022024B74DCF910A4C8C95572CF662EB7F5FF67E1AC4D7B9B7BFE2A8EE851EC16576", + "date": 649200322, + "hash": "08EF5BDA2825D7A28099219621CDBECCDECB828FEA202DEB6C7ACD5222D36C2C", + "inLedger": 57112015, + "ledger_index": 57112015 + }, + "validated": true + }, + { + "meta": { + "AffectedNodes": [ + { + "ModifiedNode": { + "FinalFields": { + "Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "Balance": "3732745656171", + "Flags": 131072, + "OwnerCount": 0, + "Sequence": 702819 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574", + "PreviousFields": { + "Balance": "3732246155784" + }, + "PreviousTxnID": "CCBCCB528F602007C937C496F0828C118E073DF180084CCD3646EC1E414844E4", + "PreviousTxnLgrSeq": 57112007 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg", + "Balance": "236476361", + "Flags": 131072, + "OwnerCount": 0, + "Sequence": 466335 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "CC20FEBEA6D2AF969EC46F2BD92684D9FBABC3F238E841B5E056FE4EBF4379A9", + "PreviousFields": { + "Balance": "735976788", + "Sequence": 466334 + }, + "PreviousTxnID": "C528B32DD588EFAE2FE833E8AA92E6AE2DF2C8DB3DB8C6C4F334AD37B253D72A", + "PreviousTxnLgrSeq": 57112010 + } + } + ], + "TransactionIndex": 33, + "TransactionResult": "tesSUCCESS", + "delivered_amount": "499500387" + }, + "tx": { + "Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg", + "Amount": "499500387", + "Destination": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w", + "DestinationTag": 1, + "Fee": "40", + "Flags": 2147483648, + "LastLedgerSequence": 57112032, + "Sequence": 466334, + "SigningPubKey": "0381575032E254BF4D699C3D8D6EFDB63B3A71F97475C6F6885BC7DAEEE55D9A01", + "TransactionType": "Payment", + "TxnSignature": "3045022100C7EA1701FE48C75508EEBADBC9864CD3FFEDCEB48AB99AEA960BFA360AE163ED0220453C9577502924C9E1A9A450D4B950A44016813BC70E1F16A65A402528D730B7", + "date": 649200302, + "hash": "7C031FD5B710E3C048EEF31254089BEEC505900BCC9A842257A0319453333998", + "inLedger": 57112010, + "ledger_index": 57112010 + }, + "validated": true + } + ], + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/gateway_balances.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/gateway_balances.md new file mode 100644 index 0000000..0a79fca --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/gateway_balances.md @@ -0,0 +1,129 @@ +# gateway\_balances + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.gatewayBalances('rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q', { + hotwallet: ['rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ', 'ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt'], + ledgerIndex: 'validated', + strict: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `gateway_balances` method allows you to calculate the total balances issued by a given account, excluding amounts held by operational addresses if needed. This method is beneficial when you want to retrieve the total amount of assets issued by a given Ripple address, especially useful for gateway businesses who need to keep track of the amount of each currency they have issued. + +{% embed url="https://codepen.io/tatum-devrel/pen/yLQrxKB" %} + +### Parameters + +* `account` (string): The Ripple address to check. This should be the issuing address. +* `strict` (boolean, optional): If true, only accept an address or public key for the account parameter. Defaults to false. +* `hotwallet` (string or array, optional): An operational address or an array of such addresses to exclude from the balances issued. +* `ledger_hash` (string, optional): A 20-byte hex string for the ledger version to use. +* `ledger_index` (string or unsigned integer, optional): The ledger index of the ledger version to use, or a shortcut string to choose a ledger automatically. + +### Return Object + +The `gateway_balances` method returns an object that contains the following fields: + +* `account`: The address of the account that issued the balances. +* `obligations`: Total amounts issued to addresses not excluded, as a map of currencies to the total value issued. +* `balances`: Amounts issued to the hotwallet addresses from the request. +* `assets`: Total amounts held that are issued by others. In the recommended configuration, the issuing address should have none. +* `ledger_hash`: The identifying hash of the ledger version that was used to generate this response. +* `ledger_index`: The ledger index of the ledger version that was used to generate this response. + +### JSON-RPC Request Example + +```json +{ + "method": "gateway_balances", + "params": [ + { + "account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", + "hotwallet": [ + "rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ", + "ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt" + ], + "ledger_index": "validated", + "strict": true + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", + "assets": { + "r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH": [ + { + "currency": "BTC", + "value": "5444166510000000e-26" + } + ], + "rPFLkxQk6xUGdGYEykqe7PR25Gr7mLHDc8": [ + { + "currency": "EUR", + "value": "4000000000000000e-27" + } + ], + "rPU6VbckqCLW4kb51CWqZdxvYyQrQVsnSj": [ + { + "currency": "BTC", + "value": "1029900000000000e-26" + } + ], + "rpR95n1iFkTqpoy1e878f4Z1pVHVtWKMNQ": [ + { + "currency": "BTC", + "value": "4000000000000000e-30" + } + ], + "rwmUaXsWtXU4Z843xSYwgt1is97bgY8yj6": [ + { + "currency": "BTC", + "value": "8700000000000000e-30" + } + ] + }, + "balances": { + "rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ": [ + { + "currency": "EUR", + "value": "29826.1965999999" + } + ], + "ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt": [ + { + "currency": "USD", + "value": "13857.70416" + } + ] + }, + "ledger_hash": "980FECF48CA4BFDEC896692C31A50D484BDFE865EC101B00259C413AA3DBD672", + "ledger_index": 14483212, + "obligations": { + "BTC": "5908.324927635318", + "EUR": "992471.7419793958", + "GBP": "4991.38706013193", + "USD": "1997134.20229482" + }, + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/noripple_check.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/noripple_check.md new file mode 100644 index 0000000..69a0282 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-account-methods/noripple_check.md @@ -0,0 +1,106 @@ +# noripple\_check + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const result = await tatum.rpc.norippleCheck('r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', 'gateway', { + transactions: true, + limit: 2 +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `noripple_check` method provides a quick way to check the status of the Default Ripple field for an account and the No Ripple flag of its trust lines, compared with the recommended settings. This can be useful for developers and administrators who want to ensure that their accounts are configured correctly, especially when managing the accounts of large or complex financial organisations. + +{% embed url="https://codepen.io/tatum-devrel/pen/poQBOLM" %} + +### Parameters + +* `account` (String): A unique identifier for the account, most commonly the account's address. +* `role` (String): Whether the address refers to a gateway or user. Recommendations depend on the role of the account. Issuers must have Default Ripple enabled and must disable No Ripple on all trust lines. Users should have Default Ripple disabled, and should enable No Ripple on all trust lines. +* `transactions` (Boolean, optional): If true, include an array of suggested transactions, as JSON objects, that you can sign and submit to fix the problems. Defaults to false. +* `limit` (Number, optional): The maximum number of trust line problems to include in the results. Defaults to 300. + +### Return Object + +The `noripple_check` method returns an object with the following fields: + +* `ledger_current_index` (Number): The ledger index of the ledger used to calculate these results. +* `problems` (Array): Array of strings with human-readable descriptions of the problems. This includes up to one entry if the account's Default Ripple setting is not as recommended, plus up to limit entries for trust lines whose No Ripple setting is not as recommended. +* `transactions` (Array): If the request specified transactions as true, this is an array of JSON objects, each of which is the JSON form of a transaction that should fix one of the described problems. The length of this array is the same as the problems array, and each entry is intended to fix the problem described at the same index into that array. + +### JSON-RPC Request Example + +```json +{ + "method": "noripple_check", + "params": [ + { + "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "ledger_index": "current", + "limit": 2, + "role": "gateway", + "transactions": true + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "ledger_current_index": 14380381, + "problems": [ + "You should immediately set your default ripple flag", + "You should clear the no ripple flag on your XAU line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "You should clear the no ripple flag on your USD line to rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q" + ], + "status": "success", + "transactions": [ + { + "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "Fee": 10000, + "Sequence": 1406, + "SetFlag": 8, + "TransactionType": "AccountSet" + }, + { + "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "Fee": 10000, + "Flags": 262144, + "LimitAmount": { + "currency": "XAU", + "issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z", + "value": "0" + }, + "Sequence": 1407, + "TransactionType": "TrustSet" + }, + { + "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "Fee": 10000, + "Flags": 262144, + "LimitAmount": { + "currency": "USD", + "issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", + "value": "5" + }, + "Sequence": 1408, + "TransactionType": "TrustSet" + } + ], + "validated": false + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/README.md new file mode 100644 index 0000000..2956152 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/README.md @@ -0,0 +1,2 @@ +# API calls for ledger methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger.md new file mode 100644 index 0000000..c1d48bd --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger.md @@ -0,0 +1,125 @@ +# ledger + +### How to use it + +```javascript +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ledger({ + ledgerIndex: 'validated', + full: false, + accounts: false, + transactions: false, + expand: false, + ownerFunds: false, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ledger` RPC method is used to retrieve information about the public ledger in XRP. You can specify various options to customize the returned information, such as the ledger version, whether to include full information on the entire ledger, the ledger's entire state data, information on transactions in the specified ledger version, and so on. + +Use cases for this method include retrieving information about a specific ledger, examining the transactions that have occurred in a specific ledger version, examining the state data of a ledger, and more. + +{% embed url="https://codepen.io/tatum-devrel/pen/GRwLXGG?editors=1111" %} + +### Parameters + +The `ledger` method takes an optional `LedgerOptions` object. This object can contain the following fields: + +* `full` (boolean): If true, return full information on the entire ledger. +* `accounts` (boolean): If true, return the ledger's entire state data. +* `transactions` (boolean): If true, return information on transactions in the specified ledger version. +* `expand` (boolean): Provide full JSON-formatted information for transaction/account information instead of only hashes. +* `ownerFunds` (boolean): If true, include owner\_funds field in the metadata of OfferCreate transactions in the response. +* `binary` (boolean): If true, return the requested ledger object's contents as a hex string in the XRP Ledger's binary format. + +### Return Object + +The method returns a promise that resolves to an `XrpResult` object. This object contains information about the ledger, including the following fields: + +* `ledger.account_hash`: A string representing the hash of all account state information in this ledger, as hexadecimal. +* `ledger.accountState`: An array of all the account-state information in this ledger. This field is omitted unless explicitly requested. +* `ledger.close_flags`: An integer representing a bitmap of flags relating to the closing of this ledger. +* `ledger.close_time`: An integer representing the time this ledger was closed, in seconds since the Ripple Epoch. +* `ledger.close_time_human`: A string representing the time this ledger was closed, in human-readable format. Always uses the UTC time zone. +* `ledger.close_time_resolution`: An integer representing how ledger close times are rounded. Ledger close times are rounded to within this many seconds. +* `ledger.closed`: A boolean indicating whether or not this ledger has been closed. +* `ledger.ledger_hash`: A string representing the unique identifying hash of the entire ledger. +* `ledger.ledger_index`: A string representing the Ledger Index of this ledger, as a quoted integer. +* `ledger.parent_close_time`: An integer representing the time at which the previous ledger was closed. +* `ledger.parent_hash`: A string representing the unique identifying hash of the ledger that came immediately before this one. +* `ledger.total_coins`: A string representing the total number of XRP drops in the network, as a quoted integer. This decreases as transaction costs destroy XRP. +* `ledger.transaction_hash`: A string representing the hash of the transaction information included in this ledger, as hexadecimal. +* `ledger.transactions`: An array of transactions applied in this ledger version. By default, members are the transactions' identifying Hash strings. If the request specified `expand` as true, members are full representations of the transactions instead, in either JSON or binary depending on whether the request specified binary as true. + +Within the `queue_data` object, which is an array of objects describing queued transactions, you can find the following fields: + +* `account`: The Address of the sender for this queued transaction. +* `tx`: By default, this is a string containing the identifying hash of the transaction. If transactions are expanded in binary format, this is an object whose only field is `tx_blob`, containing the binary form of the transaction as a decimal string. If transactions are expanded in JSON format, this is an object containing the transaction object including the transaction's identifying hash in the `hash` field. +* `retries_remaining`: The number of times this transaction can be retried before being dropped. +* `preflight_result`: The tentative result from preliminary transaction checking. This is always `tesSUCCESS`. +* `last_result`: If this transaction was left in the queue after getting a retriable (ter) result, this is the exact ter result code it got. This field may be omitted. +* `auth_change`: Indicates whether this transaction changes this address's ways of authorizing transactions. This field may be omitted. +* `fee`: The Transaction Cost of this transaction, in drops of XRP. This field may be omitted. +* `fee_level`: The transaction cost of this transaction, relative to the minimum cost for this type of transaction, in fee levels. This field may be omitted. +* `max_spend_drops`: The maximum amount of XRP, in drops, this transaction could potentially send or destroy. This field may be omitted. + + + +### JSON-RPC Request Example + +Here is an example of a JSON-RPC request using the `ledger` method: + +```json +{ + "method": "ledger", + "params": [ + { + "ledger_index": "validated", + "accounts": false, + "full": false, + "transactions": false, + "expand": false, + "owner_funds": false + } + ] +} +``` + +### JSON-RPC Response Example + +Here is an example of a successful JSON-RPC response: + +```json +{ + "result": { + "ledger": { + "accepted": true, + "account_hash": "B258A8BB4743FB74CBBD6E9F67E4A56C4432EA09E5805E4CC2DA26F2DBE8F3D1", + "close_flags": 0, + "close_time": 638329271, + "close_time_human": "2020-Mar-24 01:41:11.000000000 UTC", + "close_time_resolution": 10, + "closed": true, + "hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_index": "54300940", + "parent_close_time": 638329270, + "parent_hash": "AE996778246BC81F85D5AF051241DAA577C23BCA04C034A7074F93700194520D", + "seqNum": "54300940", + "totalCoins": "99991024049618156", + "total_coins": "99991024049618156", + "transaction_hash": "FC6FFCB71B2527DDD630EE5409D38913B4D4C026AA6C3B14A3E9D4ED45CFE30D" + }, + "ledger_hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_index": 54300940, + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_closed.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_closed.md new file mode 100644 index 0000000..9d0d4e5 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_closed.md @@ -0,0 +1,61 @@ +# ledger\_closed + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ledgerClosed() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ledger_closed` method is used to fetch the unique identifiers of the most recently closed ledger. Note that the ledger might not be validated and immutable yet, so use this method when you need information about the latest ledger and not necessarily the final state. + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzRPbb" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `ledger_closed` method returns an object with the following fields: + +* `ledger_hash` (String): The unique hash of this ledger version, in hexadecimal. +* `ledger_index` (Unsigned Integer): The ledger index of this ledger version. + +### JSON-RPC Request Example + +Here's an example of the `ledger_closed` method request: + +```json +{ + "id": 2, + "command": "ledger_closed" +} +``` + +### JSON-RPC Response Example + +Here's an example of a successful response: + +```json +{ + "id": 1, + "status": "success", + "type": "response", + "result": { + "ledger_hash": "17ACB57A0F73B5160713E81FE72B2AC9F6064541004E272BD09F257D57C30C02", + "ledger_index": 6643099 + } +} +``` + +In this response, `ledger_hash` is the unique identifier of the ledger, and `ledger_index` is the index number of this ledger version. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_current.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_current.md new file mode 100644 index 0000000..9cb1eac --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_current.md @@ -0,0 +1,61 @@ +# ledger\_current + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ledgerCurrent() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ledger_current` method is used to fetch the unique identifier (the ledger index) of the current in-progress ledger. This command is mostly useful for testing, as the returned ledger is still in flux and its contents are constantly changing. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqOeoE" %} + +### Parameters + +This method does not require any parameters. + +### Return Object + +The `ledger_current` method returns an object with the following field: + +* `ledger_current_index` (Unsigned Integer - Ledger Index): The ledger index of this ledger version. + +Note: A `ledger_hash` field is not provided, because the hash of the current ledger is constantly changing along with its contents. + +### JSON-RPC Request Example + +Here's an example of the `ledger_current` method request: + +```json +{ + "method": "ledger_current", + "params": [ + {} + ] +} +``` + +### JSON-RPC Response Example + +Here's an example of a successful response: + +```json +{ + "result": { + "ledger_current_index": 8696233, + "status": "success" + } +} +``` + +In this response, `ledger_current_index` is the index number of the current in-progress ledger. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_data.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_data.md new file mode 100644 index 0000000..0a73283 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_data.md @@ -0,0 +1,105 @@ +# ledger\_data + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ledgerData({ + ledger_hash: "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8", + limit: 5, + binary: true +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ledger_data` method retrieves the contents of the specified ledger. You can iterate through several calls to retrieve the entire contents of a single ledger version. + +{% embed url="https://codepen.io/tatum-devrel/pen/eYQoPWW" %} + +### Parameters + +The `ledger_data` method takes the following parameters: + +* `ledger_hash` (Hash): A 20-byte hex string identifying the ledger version to use. (Optional) +* `ledger_index` (Ledger Index): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (Optional) +* `binary` (Boolean): If true, return ledger entries as hexadecimal strings instead of JSON. The default is false. (Optional) +* `limit` (Number): Limit the number of ledger entries to retrieve. The server may return fewer than this number of entries. Cannot be more than 2048 (when requesting binary) or 256 (when requesting JSON). The default is the maximum. (Optional) +* `marker` (Marker): Value from a previous paginated response. Resume retrieving data where that response left off. (Optional) +* `type` (String): Filter results to a specific type of ledger entry. Valid types include account, amendments, amm, check, deposit\_preauth, directory, escrow, fee, hashes, nft\_offer, offer, payment\_channel, signer\_list, state (trust line), and ticket. (Optional) + +### Return Object + +The `ledger_data` response provides information about the state tree of a specific ledger version. It follows the standard format and a successful result contains the following fields: + +* `ledger_index`: An unsigned integer representing the ledger index of this ledger version. +* `ledger_hash`: A string representing the unique identifying hash of this ledger version. +* `state`: An array of JSON objects containing data from the ledger's state tree. The format of these objects will depend on whether binary was set to true in the request. +* `marker`: A server-defined value indicating the response is paginated. This can be passed to the next call to resume where this call left off. + +If a type field is mentioned in the request, the state array will be empty if the first set of array objects does not match the type requested. In such cases, the marker from this response can be used to paginate and retrieve further data. + +Each object in the `state` array may include the following fields: + +* `data`: A string representing the hex representation of the requested data. This field is included only if "binary" was set to true in the request. +* `LedgerEntryType`: A string indicating what type of ledger object this object represents. This field is included only if "binary" was set to false in the request. +* Additional fields describing the object, depending on which ledger object type it is. These fields are included only if "binary" was set to false in the request. +* `index`: A string representing the unique identifier for this ledger entry, in hexadecimal format. + +### JSON-RPC Request Example + +Here's an example of the `ledger_data` method request: + +```json +{ + "id": 2, + "ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8", + "command": "ledger_data", + "limit": 5, + "binary": true +} +``` + +### JSON-RPC Response Example + +Here's an example of a successful response: + +```json +{ + "result": { + "ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8", + "ledger_index": "6885842", + "marker": "0002A590029B53BE7857EFF9985F770EC792CE483720EB5E963C4D6A607D43DF", + "state": [ + { + "data": "11006122000000002400000001250062FEA42D0000000055C204A65CF2542946289A3358C67D991B5E135FABFA89F271DBA7A150C08CA0466240000000354540208114C909F42250CFE8F12A7A1A0DFBD3CBD20F32CD79", + "index": "00001A2969BE1FC85F1D7A55282FA2E6D95C71D2E4B9C0FDD3D9994F3C00FF8F" + }, + { + "data": "11006F22000000002400000003250035788533000000000000000034000000000000000055555B93628BF3EC318892BB7C7CDCB6732FF53D12B6EEC4FAF60DD1AEE1C6101F501071633D7DE1B6AEB32F87F1A73258B13FC8CC32942D53A66D4F038D7EA4C6800064D4838D7EA4C68000000000000000000000000000425443000000000035DD7DF146893456296BF4061FBE68735D28F3286540000000000F42408114A4B8F5F7B644AEDC3447F9459C132EEB016A133B", + "index": "000037C6659BB98F8D09F2F4CFEB27DE8EFEAFE54DD9E1C13AECDF5794B0C0F5" + }, + { + "data": "11006F2200020000240000000A250067395C33000000000000000034000000000000000055A160BC41A45B6BB118DF23D77E4FF23C723431B917F50DCB41319ECC2821F34C5010DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C1AA535D3D0C00064D554C88B43EFA00000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000B59B9F780081148366FB9ACD2A0FD822E31112D2EB6F98C317C2C1", + "index": "0000A8791F78CC9B39200E12A9BDAACCF40A72A512FA815525CFC9BA772990F7" + }, + { + "data": "1100612200000000240000000125003E742F2D0000000055286498B513710CFEB2D723A554C7557983D1952DF4DEE342C40DCB43067C9A21624000000306DC42008114225BAB89C4A4B94624BB069D6DB3C819F934991C", + "index": "0000B717320558E2DE1A3B9FDB24E9A695BF05D1A44E4A4683212BB1DD0FBA23" + }, + { + "data": "110072220002000025000B65783700000000000000003800000000000000005587591A63051645F37B85D1FBA55EE69B1C96BFF16904F5C99F03FB93D42D03756280000000000000000000000000000000000000004254430000000000000000000000000000000000000000000000000166800000000000000000000000000000000000000042544300000000000A20B3C85F482532A9578DBB3950B85CA06594D167D4C38D7EA4C680000000000000000000000000004254430000000000C795FDF8A637BCAAEDAD1C434033506236C82A2D", + "index": "000103996A3BAD918657F86E12A67D693E8FC8A814DA4B958A244B5F14D93E58" + } + ], + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_entry.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_entry.md new file mode 100644 index 0000000..d1f903c --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-ledger-methods/ledger_entry.md @@ -0,0 +1,81 @@ +# ledger\_entry + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ledgerEntry({ + ledgerIndex: 'validated', + index: '7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4' +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +In this example, we're initializing the SDK for the XRP network and calling the `ledgerEntry` method with a specific ledger index and object ID. + +### Overview + +The `ledgerEntry` method of Tatum SDK facilitates interaction with the XRP Ledger. This method allows you to retrieve a single ledger object from the XRP Ledger in its raw format. It is a powerful and flexible tool with numerous use-cases such as obtaining account details, checking the state of an offer, retrieving trust lines, and much more. + +This method is comprehensive and can retrieve several different types of data. The specific type of item you wish to retrieve can be selected by passing the appropriate parameters. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJPZmE" %} + +### Parameters + +The `ledgerEntry` method accepts a parameter of `LedgerEntryOptions` type, which may contain the following fields: + +* `index`: the object ID of a single object to retrieve from the ledger, as a 64-character (256-bit) hexadecimal string. +* `accountRoot`: the classic address of the AccountRoot object to retrieve. +* `directory`: the object ID of the directory or an object requiring either `dir_root` or `owner` as a sub-field, plus optionally a `sub_index` sub-field. +* `offer`: the unique object ID to the Offer or an object requiring the sub-fields `account` and `seq` to uniquely identify the offer. +* `rippleState`: an object specifying the RippleState (trust line) object to retrieve, with the `accounts` and `currency` sub-fields required. +* `check`: the object ID of a Check object to retrieve. +* `escrow`: the object ID of the Escrow or an object requiring `owner` and `seq` sub-fields. +* `paymentChannel`: the object ID of a PayChannel object to retrieve. +* `depositPreauth`: the object ID of the DepositPreauth object or an object requiring `owner` and `authorized` sub-fields. +* `ticket`: the object ID of the Ticket or an object requiring `account` and `ticket_seq` sub-fields. +* `nftPage`: the object ID of an NFT Page to retrieve. + +### Return Object + +The `ledger_entry` response provides information about a specific ledger object and follows the standard format. A successful result contains the following fields: + +* `index`: A string representing the unique ID of the ledger object. +* `ledger_index`: An unsigned integer representing the ledger index of the ledger that was used when retrieving this data. +* `node`: An object containing the data of the ledger object, according to the ledger format. This field is omitted if the "binary": true parameter is specified. +* `node_binary`: A string representing the binary representation of the ledger object in hexadecimal format. This field is included only if the "binary": true parameter is specified. + +### JSON-RPC Request Example + +```json +{ + "method": "ledger_entry", + "params": [ + { + "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4", + "ledger_index": "validated" + } + ] +} +``` + +In this example, we're requesting a ledger entry for a particular object ID and using the 'validated' ledger index. + +### JSON-RPC Response Example + +```json +{ + "result": { + "ledger_index": 464, + "nft_page": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4", + "ledger_index": "validated" + }] +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/README.md new file mode 100644 index 0000000..75f7c9c --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/README.md @@ -0,0 +1,2 @@ +# API calls for path and order book methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/book_offers.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/book_offers.md new file mode 100644 index 0000000..3f09a3e --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/book_offers.md @@ -0,0 +1,79 @@ +# book\_offers + +### How to use it + +
// yarn add @tatumio/tatum
+
+import { TatumSDK, Xrp, Network } from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Xrp>({network: Network.XRP})
+
+const takerGets = { currency: 'XRP' }
+const takerPays = { currency: 'USD', issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' }
+
+const res = await tatum.rpc.bookOffers(takerGets, takerPays, { taker: 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', limit: 10 })
+
+tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
+
+ +### Overview + +The `book_offers` method is used to fetch a list of offers between two different currencies on the XRP Ledger. This method is crucial for trading and asset management applications as it provides an in-depth view of the market depth for a specific trading pair. + +{% embed url="https://codepen.io/tatum-devrel/pen/NWEmELX" %} + +### Parameters + +* `takerGets` (Object): The asset the account taking the offer would receive, as a currency without an amount. +* `takerPays` (Object): The asset the account taking the offer would pay, as a currency without an amount. +* `options` (BookOffersOptions): Optional parameters which includes ledger details, pagination, and the taker address. + +### Return Object + +The `book_offers` method returns an object that provides information about a list of offers in the order book. The object contains the following fields: + +* `ledger_current_index`: (Omitted if `ledger_index` is provided) A ledger index that represents the ledger index of the current in-progress ledger version, which was used to retrieve this information. +* `ledger_index`: (Omitted if `ledger_current_index` is provided) A ledger index that represents the ledger index of the ledger version that was used when retrieving this data, as requested. +* `ledger_hash`: (May be omitted) A hash that represents the identifying hash of the ledger version that was used when retrieving this data, as requested. +* `offers`: An array of offer objects, each of which has the fields of an Offer object. + +Each offer object in the `offers` array can include the following fields: + +* `owner_funds`: A string that represents the amount of the `TakerGets` currency the side placing the offer has available to be traded. (XRP is represented as drops; any other currency is represented as a decimal value.) If a trader has multiple offers in the same book, only the highest-ranked offer includes this field. +* `taker_gets_funded`: (Only included in partially-funded offers) A currency amount that represents the maximum amount of currency that the taker can get, given the funding status of the offer. +* `taker_pays_funded`: (Only included in partially-funded offers) A currency amount that represents the maximum amount of currency that the taker would pay, given the funding status of the offer. +* `quality`: A string that represents the exchange rate, as the ratio of `taker_pays` divided by `taker_gets`. For fairness, offers that have the same quality are automatically taken first-in, first-out. (In other words, if multiple people offer to exchange currency at the same rate, the oldest offer is taken first.) + +### JSON-RPC Request Example + +```json +{ + "method": "book_offers", + "params": [ + { + "taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "taker_gets": { + "currency": "XRP" + }, + "taker_pays": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" + }, + "limit": 10 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "ledger_current_index": 8696243, + "offers": [], + "status": "success", + "validated": false + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/deposit_authorized.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/deposit_authorized.md new file mode 100644 index 0000000..648aa9d --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/deposit_authorized.md @@ -0,0 +1,71 @@ +# deposit\_authorized + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const sourceAccount = 'rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de' +const destinationAccount = 'rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8' + +const res = await tatum.rpc.depositAuthorized(sourceAccount, destinationAccount, { ledgerIndex: 'validated' }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `deposit_authorized` method is used to verify if a specific account is authorized to send payments to another account. This feature becomes particularly useful in scenarios where accounts have deposit authorization enabled, which is a setting that requires accounts to be preauthorized before they can send payments. + +### Parameters + +* `sourceAccount` (String): The sender of a possible payment. +* `destinationAccount` (String): The recipient of a possible payment. +* `options` (Ledger): Optional parameter that includes details about the ledger to use. + +### Return Object + +The `deposit_authorized` method returns an object that provides information about whether the specified source account is authorized to send payments directly to the destination account. The object contains the following fields: + +* `deposit_authorized`: A boolean indicating whether the specified source account is authorized to send payments directly to the destination account. If true, either the destination account does not require Deposit Authorization or the source account is preauthorized. +* `destination_account`: A string that represents the destination account specified in the request. +* `ledger_hash`: (May be omitted) A string that represents the identifying hash of the ledger that was used to generate this response. +* `ledger_index`: (May be omitted) A number that represents the ledger index of the ledger version that was used to generate this response. +* `ledger_current_index`: (May be omitted) A number that represents the ledger index of the current in-progress ledger version, which was used to generate this response. +* `source_account`: A string that represents the source account specified in the request. +* `validated`: (May be omitted) A boolean indicating whether the information comes from a validated ledger version. If true, the information comes from a validated ledger version. + +### JSON-RPC Request Example + +```json +{ + "method": "deposit_authorized", + "params": [ + { + "source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de", + "destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8", + "ledger_index": "validated" + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "deposit_authorized": true, + "destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8", + "ledger_hash": "BD03A10653ED9D77DCA859B7A735BF0580088A8F287FA2C5403E0A19C58EF322", + "ledger_index": 8, + "source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de", + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_buy_offers.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_buy_offers.md new file mode 100644 index 0000000..948a17d --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_buy_offers.md @@ -0,0 +1,72 @@ +# nft\_buy\_offers + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const nftId = '00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007' + +const res = await tatum.rpc.nftBuyOffers(nftId, { ledgerIndex: 'validated', limit: 250 }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `nft_buy_offers` method is used to get a list of active buy offers for a specific NFToken. This allows users to track and analyze offers for a particular token and make informed decisions based on the market demand. + +{% embed url="https://codepen.io/tatum-devrel/pen/Poxgxyj" %} + +### Parameters + +* `nftId` (String): The unique identifier of a NFToken object. +* `options` (Ledger & Pagination): Optional parameter that includes details about the ledger to use and pagination options. + +### Return Object + +The `nft_buy_offers` method returns an object that provides information about the buy offers for a specific non-fungible token (NFT). The object contains the following fields: + +* `nft_id`: A string that represents the NFT these offers are for, as specified in the request. +* `offers`: An array that contains a list of buy offers for the token. Each member of this array represents one NFTokenOffer object to buy the NFT in question and has the following fields: + * `amount`: A string or an object that represents the amount offered to buy the NFT for. This could be a string representing an amount in drops of XRP, or an object representing an amount of a fungible token. + * `flags`: A number that represents a set of bit-flags for this offer. See NFTokenOffer flags for possible values. + * `nft_offer_index`: A string that represents the ledger object ID of this offer. + * `owner`: A string that represents the account that placed this offer. +* `limit`: (May be omitted) A number that represents the limit, as specified in the request. +* `marker`: (May be omitted) A server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. This field is omitted when there are no pages of information after this one. + +### JSON-RPC Request Example + +```json +{ + "method": "nft_buy_offers", + "params": [{ + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + "ledger_index": "validated" + }] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + "offers": [ + { + "amount": "1500", + "flags": 0, + "nft_offer_index": "3212D26DB00031889D4EF7D9129BB0FA673B5B40B1759564486C0F0946BA203F", + "owner": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx" + } + ], + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_sell_offers.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_sell_offers.md new file mode 100644 index 0000000..169dd24 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/nft_sell_offers.md @@ -0,0 +1,72 @@ +# nft\_sell\_offers + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const nftId = '00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007' + +const res = await tatum.rpc.nftSellOffers(nftId, { ledgerIndex: 'validated', limit: 250 }) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `nft_sell_offers` method is used to get a list of active sell offers for a specific NFToken. This allows users to track and analyze offers for a particular token and make informed decisions based on the market demand. + +{% embed url="https://codepen.io/tatum-devrel/pen/QWJPJZr" %} + +### Parameters + +* `nftId` (String): The unique identifier of a NFToken object. +* `options` (Ledger & Pagination): Optional parameter that includes details about the ledger to use and pagination options. + +### Return Object + +\ +The `nft_sell_offers` method returns an object that provides information about the sell offers for a specific non-fungible token (NFT). The object contains the following fields: + +* `nft_id`: A string that represents the NFT these offers are for, as specified in the request. +* `offers`: An array that contains a list of sell offers for the token. Each member of this array represents one NFTokenOffer object to sell the NFT in question and has the following fields: + * `amount`: A string or an object that represents the amount offered to sell the NFT for. This could be a string representing an amount in drops of XRP, or an object representing an amount of a fungible token. + * `flags`: A number that represents a set of bit-flags for this offer. See NFTokenOffer flags for possible values. + * `nft_offer_index`: A string that represents the ledger object ID of this offer. + * `owner`: A string that represents the account that placed this offer. +* `limit`: (May be omitted) A number that represents the limit, as specified in the request. +* `marker`: (May be omitted) A server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. This field is omitted when there are no pages of information after this one. + +### JSON-RPC Request Example + +```json +{ + "method": "nft_sell_offers", + "params": [{ + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007" + }] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + "offers": [ + { + "amount": "1000", + "flags": 1, + "nft_offer_index": "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1", + "owner": "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt" + } + ], + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/ripple_path_find.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/ripple_path_find.md new file mode 100644 index 0000000..138d193 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-path-and-order-book-methods/ripple_path_find.md @@ -0,0 +1,137 @@ +# ripple\_path\_find + +### How to use it + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network, CurrencyAmount, RipplePathFindOptions } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const destinationAmount: CurrencyAmount = { + currency: 'USD', + issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B', + value: '0.001', +} + +const res = await tatum.rpc.ripplePathFind( + 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', + 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59', + destinationAmount +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ripple_path_find` method is a simplified version of the `path_find` method that provides a single response with a payment path that can be used immediately. It tries to find the cheapest path or combination of paths for making a payment, but it is not guaranteed that the paths returned are, in fact, the best paths. + +The method is available in both the WebSocket and JSON-RPC APIs. However, the results tend to become outdated as time passes. Instead of making multiple calls to stay updated, it is recommended to use the `path_find` method to subscribe to continued updates where possible. + +One thing to note is that pathfinding results from untrusted servers need to be handled with care. A server could be modified to return less-than-optimal paths to earn money for its operators. A server may also return poor results when under heavy load. If you do not have your own server that you can trust with pathfinding, you should compare the results of pathfinding from multiple servers run by different parties, to minimize the risk of a single server returning poor results. + +### Parameters + +The `ripple_path_find` method includes the following parameters: + +* `source_account`: Unique address of the account that would send funds in a transaction +* `destination_account`: Unique address of the account that would receive funds in a transaction +* `destination_amount`: Currency Amount that the destination account would receive in a transaction. Special case: New in: rippled 0.30.0 You can specify "-1" (for XRP) or provide -1 as the contents of the value field (for non-XRP currencies). This requests a path to deliver as much as possible, while spending no more than the amount specified in send\_max (if provided). +* `send_max`: (Optional) Currency Amount that would be spent in the transaction. Cannot be used with source\_currencies. New in: rippled 0.30.0 +* `source_currencies`: (Optional) Array of currencies that the source account might want to spend. Each entry in the array should be a JSON object with a mandatory currency field and optional issuer field, like how currency amounts are specified. Cannot contain more than 18 source currencies. By default, uses all source currencies available up to a maximum of 88 different currency/issuer pairs. +* `ledger_hash`: (Optional) A 20-byte hex string for the ledger version to use. (See Specifying Ledgers) +* `ledger_index`: (Optional) The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers) + +### Return Object + +The `ripple_path_find` method returns a result object that includes: + +* `alternatives`: Array of objects with possible paths to take. If empty, then there are no paths connecting the source and destination accounts. +* `destination_account`: Unique address of the account that would receive a payment transaction +* `destination_currencies`: Array of strings representing the currencies that the destination accepts, as 3-letter codes like "USD" or as 40-character hex like "015841551A748AD2C1F76FF6ECB0CCCD00000000" + +Each element in the alternatives array is an object that represents a path from one possible source currency (held by the initiating account) to the destination account and currency. This object has the following fields: + +* `paths_computed`: Array of arrays of objects defining payment paths +* `source_amount`: Currency Amount that the source would have to send along this path for the destination to receive the desired amount + +### JSON-RPC Request Example + +```json +{ + "method": "ripple_path_find", + "params": [ + { + "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "destination_amount": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0.001" + }, + "source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "source_currencies": [ + { + "currency": "XRP" + }, + { + "currency": "USD" + } + ] + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "alternatives": [ + { + "paths_computed": [ + [ + { + "currency": "USD", + "issuer": "rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2", + "type": 48, + "type_hex": "0000000000000030" + }, + { + "account": "rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2", + "type": 1, + "type_hex": "0000000000000001" + }, + { + "account": "rfDeu7TPUmyvUrffexjMjq3mMcSQHZSYyA", + "type": 1, + "type_hex": "0000000000000001" + }, + { + "account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "type": 1, + "type_hex": "0000000000000001" + } + ] + ], + "source_amount": "207414" + } + ], + "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", + "destination_currencies": [ + "USD", + "JOE", + "BTC", + "DYM", + "CNY", + "EUR", + "015841551A748AD2C1F76FF6ECB0CCCD00000000", + "MXN", + "XRP" + ], + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/README.md new file mode 100644 index 0000000..fdc21c9 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/README.md @@ -0,0 +1,2 @@ +# API calls for payment channel methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_authorize.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_authorize.md new file mode 100644 index 0000000..e385dbf --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_authorize.md @@ -0,0 +1,73 @@ +# channel\_authorize + +### How to use it + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network, Secrets } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.channelAuthorize( + '1000000', + '5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3', + { keyType: 'secp256k1', seed: 'sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ' } +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `channel_authorize` method creates a signature that can be used to redeem a specific amount of XRP from a payment channel. This method was added by the PayChan amendment and is available starting from the `rippled` 0.33.0 version. + +This method can be used when an account wants to authorize a specific amount of XRP to be redeemed from a payment channel it has created. It generates a signature for a claim, which the receiving account can use to redeem a specific amount of XRP from the channel. + +### Parameters + +The `channel_authorize` method includes the following parameters: + +* `amount`: Cumulative amount of XRP, in drops, to authorize. If the destination has already received a lesser amount of XRP from this channel, the signature created by this method can be redeemed for the difference. +* `channelId`: The unique ID of the payment channel to use. +* `options`: (Optional) An object that includes secrets for signing the claim: + * `keyType`: (Optional) The signing algorithm of the cryptographic key pair provided. Valid types are `secp256k1` or `ed25519`. The default is `secp256k1`. + * `seed`: (Optional) The secret seed to use to sign the claim. This must be the same key pair as the public key specified in the channel. Must be in the XRP Ledger's base58 format. + +### Return Object + +The `channel_authorize` method returns a result object that includes: + +* `signature`: The signature for this claim, as a hexadecimal value. To process the claim, the destination account of the payment channel must send a PaymentChannelClaim transaction with this signature, the exact Channel ID, XRP amount, and public key of the channel. + +### JSON-RPC Request Example + +```json +{ + "method": "channel_authorize", + "params": [ + { + "channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3", + "seed": "sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ", + "key_type": "secp256k1", + "amount": "1000000", + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "id": "channel_authorize_example_id1", + "status": "success", + "result": { + "signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800 + +BBC43746F34AF50290064", + } +} +``` + +> **Warning:** Do not send secret keys to untrusted servers or through unsecured network connections. (This includes the secret, seed, seed\_hex, or passphrase fields of this request.) You should only use this method on a secure, encrypted network connection to a server you run or fully trust with your funds. Otherwise, eavesdroppers could use your secret key to sign claims and take all the money from this payment channel and anything else using the same key pair. See Set Up Secure Signing for instructions. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_verify.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_verify.md new file mode 100644 index 0000000..aa525af --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-payment-channel-methods/channel_verify.md @@ -0,0 +1,70 @@ +# channel\_verify + +### How to use it + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.channelVerify( + '1000000', + '5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3', + 'aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3', + '304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064' +) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `channel_verify` method is used to check the validity of a signature that can be used to redeem a specific amount of XRP from a payment channel. This method was added by the PayChan amendment and is available starting from the `rippled` 0.33.0 version. + +The main use case of this method is to confirm the validity of a claim before attempting to redeem it. This is especially useful for payment channel recipients who want to ensure they are receiving valid claims. + +### Parameters + +The `channel_verify` method includes the following parameters: + +* `amount`: The amount of XRP, in drops, the provided signature authorizes. +* `channelId`: The Channel ID of the channel that provides the XRP. This is a 64-character hexadecimal string. +* `publicKey`: The public key of the channel and the key pair that was used to create the signature, in hexadecimal or the XRP Ledger's base58 format. +* `signature`: The signature to verify, in hexadecimal. + +### Return Object + +The `channel_verify` method returns a result object that includes: + +* `signature_verified`: If true, the signature is valid for the stated amount, channel, and public key. + +> **Caution:** This does not indicate check that the channel has enough XRP allocated to it. Before considering a claim valid, you should look up the channel in the latest validated ledger and confirm that the channel is open and its amount value is equal or greater than the amount of the claim. To do so, use the `account_channels` method. + +### JSON-RPC Request Example + +```json +{ + "method": "channel_verify", + "params": [{ + "channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3", + "signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064", + "public_key": "aB44YfzW24VDEJQ2U + +uLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3", + "amount": "1000000" + }] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "signature_verified":true, + "status":"success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/README.md new file mode 100644 index 0000000..bee1849 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/README.md @@ -0,0 +1,2 @@ +# API calls for server info methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/fee.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/fee.md new file mode 100644 index 0000000..80d3f64 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/fee.md @@ -0,0 +1,85 @@ +# fee + +### How to use it + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.fee() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `fee` method reports the current state of the open-ledger requirements for the transaction cost. This method requires the FeeEscalation amendment to be enabled. It was introduced in `rippled` version 0.31.0 and updated for public use in version 0.32.0. + +The `fee` method is useful for gaining insight into the current transaction costs and the state of the ledger and transaction queue. It can be used by unprivileged users to understand the fees associated with transactions at a particular point in time. + +{% embed url="https://codepen.io/tatum-devrel/pen/RwqOqdK" %} + +### Parameters + +The `fee` method does not take any parameters. + +### Return Object + +The `fee` method returns an object with the following fields: + +* `current_ledger_size`: Number of transactions provisionally included in the in-progress ledger. +* `current_queue_size`: Number of transactions currently queued for the next ledger. +* `drops`: Object with various information about the transaction cost, in drops of XRP. + * `base_fee`: The transaction cost required for a reference transaction to be included in a ledger under minimum load, represented in drops of XRP. + * `median_fee`: An approximation of the median transaction cost among transactions included in the previous validated ledger, represented in drops of XRP. + * `minimum_fee`: The minimum transaction cost for a reference transaction to be queued for a later ledger, represented in drops of XRP. + * `open_ledger_fee`: The minimum transaction cost that a reference transaction must pay to be included in the current open ledger, represented in drops of XRP. +* `expected_ledger_size`: The approximate number of transactions expected to be included in the current ledger. +* `ledger_current_index`: The Ledger Index of the current open ledger these stats describe. +* `levels`: Object with various information about the transaction cost, in fee levels. + * `median_level`: The median transaction cost among transactions in the previous validated ledger, represented in fee levels. + * `minimum_level`: The minimum transaction cost required to be queued for a future ledger, represented in fee levels. + * `open_ledger_level`: The minimum transaction cost required to be included in the current open ledger, represented in fee levels. + * `reference_level`: The equivalent of the minimum transaction cost, represented in fee levels. +* `max_queue_size`: The maximum number of transactions that the transaction queue can currently hold. + +### JSON-RPC Request Example + +```json +{ + "method": "fee", + "params": [{}] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "current_ledger_size": "56", + "current_queue_size": "11", + "drops": { + "base_fee": "10", + "median_fee": "10000", + "minimum_fee": "10", + "open_ledger_fee": "2653937" + }, + "expected_ledger_size": "55", + "ledger_current_index": 26575101, + "levels": { + "median_level": "256000", + "minimum_level": "256", + "open_ledger_level": "67940792", + "reference_level": "256" + }, + "max_queue_size": "1100", + "status": "success" + } + + +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/manifest.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/manifest.md new file mode 100644 index 0000000..c8c1e45 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/manifest.md @@ -0,0 +1,71 @@ +# manifest + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.manifest('nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p') + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `manifest` method is a specialized RPC method provided by the Ripple (XRP) blockchain to report the current "manifest" information for a given validator's public key. The "manifest" is a block of data that authorizes an ephemeral signing key with a signature from the validator's master key pair. + +This method is particularly useful in scenarios where one needs to verify the authenticity of a validator. It could also be used to gather information about a validator's association with a domain, its ephemeral and master keys, and the sequence number of its manifest. + +{% embed url="https://codepen.io/tatum-devrel/pen/PoxgXRB" %} + +### Parameters + +The `manifest` method accepts a single parameter: + +* `publicKey`: The base58-encoded public key of the validator to look up. This can be the master public key or ephemeral public key. + +### Return Object + +The `manifest` method returns an object with the following fields: + +* `details`: An object containing detailed information about the manifest. This field is omitted if the server does not have a manifest for the `public_key` from the request. The details object has the following fields: + * `domain`: The domain name this validator claims to be associated with. If the manifest does not contain a domain, this is an empty string. + * `ephemeral_key`: The ephemeral public key for this validator, in base58. + * `master_key`: The master public key for this validator, in base58. + * `seq`: The sequence number of this manifest. This number increases whenever the validator operator updates the validator's token to rotate ephemeral keys or change settings. +* `manifest`: The full manifest data in base64 format. This data is serialized to binary before being base64-encoded. This field is omitted if the server does not have a manifest for the `public_key` from the request. +* `requested`: The `public_key` from the request. +* `status`: The status of the request, typically "success". + +### JSON-RPC Request Example + +```json +{ + "method": "manifest", + "params": [{ + "public_key":"nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p" + }] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "details": { + "domain": "", + "ephemeral_key": "n9J67zk4B7GpbQV5jRQntbgdKf7TW6894QuG7qq1rE5gvjCu6snA", + "master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p", + "seq": 1 + }, + "manifest": "JAAAAAFxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAhRmvCZmWZXlwShVE9qXs2AVCvhVuA/WGYkTX/vVGBGwdkYwRAIgGnYpIGufURojN2cTXakAM7Vwa0GR7o3osdVlZShroXQCIH9R/Lx1v9rdb4YY2n5nrxdnhSSof3U6V/wIHJmeao5ucBJA9D1iAMo7YFCpb245N3Czc0L1R2Xac0YwQ6XdGT+cZ7yw2n8JbdC3hH8Xu9OUqc867Ee6JmlXtyDHzBdY/hdJCQ==", + "requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p", + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_info.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_info.md new file mode 100644 index 0000000..d4b51f3 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_info.md @@ -0,0 +1,158 @@ +# server\_info + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +// Initialize Tatum SDK for XRP +const tatum = await TatumSDK.init({network: Network.XRP}) + +// Call the serverInfo method +const serverInfo = await tatum.rpc.serverInfo() + +console.log(serverInfo) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `serverInfo` method provides a human-readable version of various information about the rippled server being queried. This information can be crucial for understanding the current state of the server, including its uptime, validation quorum, current ledger sequence, transaction load, and much more. + +Use cases for `serverInfo` include: + +* Monitoring server performance and resource usage. +* Checking the server's connection status to the XRP Ledger network. +* Investigating the server's ledger history and validation status. + +{% embed url="https://codepen.io/Martin-Zemanek/pen/JjeXYxB" %} + +### Parameters + +The `serverInfo` method doesn't require any parameters. + +Here are the fields for the `server_info` method: + +* `amendment_blocked`: (May be omitted) A Boolean value that indicates whether this server is amendment blocked. If the server is not amendment blocked, the response omits this field. +* `build_version`: A string that represents the version number of the running `rippled` server. +* `closed_ledger`: (May be omitted) An object that provides information about the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. +* `complete_ledgers`: A string that indicates the range of ledger versions the local `rippled` has in its database. This may be a disjoint sequence. If the server does not have any complete ledgers, this is the string "empty". +* `hostid`: On an admin request, returns the hostname of the server running the `rippled` instance; otherwise, returns a single RFC-1751 word based on the node public key. +* `io_latency_ms`: A number that shows the amount of time spent waiting for I/O operations, in milliseconds. If this number is high, then the `rippled` server is probably having serious load issues. +* `jq_trans_overflow`: The number of times (since starting up) that this server has had over 250 transactions waiting to be processed at once. A large number here may mean that your server is unable to handle the transaction load of the XRP Ledger network. +* `last_close`: An object that provides information about the last time the server closed a ledger, including the amount of time it took to reach a consensus and the number of trusted validators participating. + * `last_close.converge_time_s`: A number that represents the amount of time it took to reach a consensus on the most recently validated ledger version, in seconds. + * `last_close.proposers`: A number that shows how many trusted validators the server considered (including itself, if configured as a validator) in the consensus process for the most recently validated ledger version. +* `load`: (Admin only) An object that provides detailed information about the current load state of the server. + * `load.job_types`: (Admin only) An array that provides information about the rate of different types of jobs the server is doing and how much time it spends on each. + * `load.threads`: (Admin only) A number that shows the number of threads in the server's main job pool. +* `load_factor`: A number that represents the load-scaled open ledger transaction cost the server is currently enforcing, as a multiplier on the base transaction cost. +* `load_factor_local`: (May be omitted) A number that represents the current multiplier to the transaction cost based on load to this server. +* `load_factor_net`: (May be omitted) A number that represents the current multiplier to the transaction cost being used by the rest of the network (estimated from other servers' reported load values). +* `load_factor_cluster`: (May be omitted) A number that represents the current multiplier to the transaction cost based on load to servers in this cluster. +* `load_factor_fee_escalation`: (May be omitted) A number that represents the current multiplier to the transaction cost that a transaction must pay to get into the open ledger. +* `load_factor_fee_queue`: (May be omitted) A number that represents the current multiplier to the transaction cost that a transaction must pay to get into the queue, if the queue is full. +* `load_factor_server`: (May be omitted) A number that represents the load factor the server is enforcing, not + +including the open ledger cost. + +* `peers`: (Omitted by reporting mode servers) A number that shows how many other `rippled` servers this one is currently connected to. +* `pubkey_node`: A string that represents the public key used to verify this server for peer-to-peer communications. +* `pubkey_validator`: (Admin only) A string that represents the public key used by this node to sign ledger validations. +* `reporting`: (Reporting mode servers only) An object that provides information about this server's reporting-mode specific configurations. +* `reporting.etl_sources`: (Reporting mode servers only) An array that lists the P2P-mode servers this reporting mode is retrieving data from. +* `reporting.is_writer`: (Reporting mode servers only) A Boolean value that indicates whether this server is writing to the external database with ledger data. +* `reporting.last_publish_time`: (Reporting mode servers only) A string that represents an ISO 8601 timestamp indicating when this server last published a validated ledger to its subscription streams. +* `server_state`: A string that indicates to what extent the server is participating in the network. +* `server_state_duration_us`: A number that represents the number of consecutive microseconds the server has been in the current state. +* `state_accounting`: An object that is a map of various server states with information about the time the server spends in each. +* `state_accounting.*.duration_us`: A string that shows the number of microseconds the server has spent in this state. +* `state_accounting.*.transitions`: A string that shows the number of times the server has changed into this state. +* `time`: A string that represents the current time in UTC, according to the server's clock. +* `uptime`: A number that represents the number of consecutive seconds that the server has been operational. +* `validated_ledger`: (May be omitted) An object that provides information about the most recent fully-validated ledger. + * `validated_ledger.age`: A number that shows the time since the ledger was closed, in seconds. + * `validated_ledger.base_fee_xrp`: A number that represents the base fee, in XRP. + * `validated_ledger.hash`: A string that represents the unique hash for the ledger, as hexadecimal. + * `validated_ledger.reserve_base_xrp`: A number that represents the minimum amount of XRP (not drops) necessary for every account to keep in reserve. + * `validated_ledger.reserve_inc_xrp`: A number that represents the amount of XRP (not drops) added to the account reserve for each object an account owns in the ledger. + * `validated_ledger.seq`: A number that represents the ledger index of the latest validated ledger. +* `validation_quorum`: A number that represents the minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations. +* `validator_list_expires`: (Admin only) A string that either represents the human readable time, in UTC, when the current validator list expires, the string "unknown" if the server has yet to load a published validator list or the string "never" if the server uses a static validator list. + +### JSON-RPC Request Example + +```json +{ + "method": "server_info", + "params": [ + {} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "info": { + "build_version": "1.9.4", + "complete_ledgers": "32570-75801747", + "hostid": "ABET", + "initial_sync_duration_us": "566800928", + "io_latency_ms": 1, + "jq_trans_overflow": "47035", + "last_close": { + "converge_time_s": 3, + "proposers": 35 + }, + "load_factor": 1, + "network_id": 0, + "peer_disconnects": "542", + "peer_disconnects_resources": "1", + "peers": 24, + "pubkey_node": "n9LvjJyaYHBWUvQUat632RrnpS7UHVLW2tLUGXSZ2yXouh4goDHX", + "server_state": "full", + "server_state_duration_us": "3612238603", + "state_accounting": { + "connected": { + "duration_us": "125498126", + "transitions": "67" + }, + "disconnected": { + "duration_us": "473415516", + "transitions": "2" + }, + "full": { + "duration_us": "4365855930299", + "transitions": "337" + }, + "syncing": { + "duration_us": "1383837914", + "transitions": "311" + }, + "tracking": { + "duration_us": "518995710", + "transitions": "374" + } + }, + "time": "2022-Nov-16 21:51:03.737667 UTC", + "uptime": 4368357, + "validated_ledger": { + "age": 1, + "base_fee_xrp": 0.00001, + "hash": "D54A94D5EF620DC212EAB5958D592EC641FC94ED92146477A04DCE5B006DFF05", + "reserve_base_xrp": 10, + "reserve_inc_xrp": 2, + "seq": 75801747 + }, + "validation_quorum": 28 + }, + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_state.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_state.md new file mode 100644 index 0000000..a1d3fe7 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-server-info-methods/server_state.md @@ -0,0 +1,158 @@ +# server\_state + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.serverState() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `server_state` RPC method is used to retrieve various machine-readable information about the rippled server's current state. The response provided by this method is almost the same as the `server_info` method, but uses units that are easier to process instead of easier to read. For example, XRP values are given in integer drops instead of scientific notation or decimal values, and time is given in milliseconds instead of seconds. + +This method can be useful when you need to gather specific information about the server's state, such as the build version, complete ledgers, load base, load factor, server state, and more. This information can be useful for monitoring the health and performance of a rippled server. + +{% embed url="https://codepen.io/tatum-devrel/pen/mdQgaXx" %} + +### Parameters + +The `server_state` method does not require any parameters. + +### Return Object + +The `server_state` method returns an object with the following fields: + +* `amendment_blocked`: (Optional) A Boolean value that indicates if the server is amendment blocked. This field may be omitted if the server is not amendment blocked. +* `build_version`: A string that provides the version number of the running `rippled` version. +* `complete_ledgers`: A string that indicates the sequence numbers of the ledger versions the local `rippled` has in its database. This could be a disjoint sequence like "2500-5000,32570-7695432". If the server does not have any complete ledgers (for example, if it recently started syncing with the network), this is an empty string. +* `closed_ledger`: (Optional) An object that provides information on the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. +* `io_latency_ms`: A number that indicates the amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the `rippled` server is probably having serious load issues. +* `jq_trans_overflow`: A string-number that represents the number of times this server has had over 250 transactions waiting to be processed at once. A large number here may mean that your server is unable to handle the transaction load of the XRP Ledger network. +* `last_close`: An object that provides information about the last time the server closed a ledger, including the amount of time it took to reach a consensus and the number of trusted validators participating. This object includes: + * `last_close.converge_time`: A number that shows the amount of time it took to reach a consensus on the most recently validated ledger version, in milliseconds. + * `last_close.proposers`: A number that indicates how many trusted validators the server considered (including itself, if configured as a validator) in the consensus process for the most recently validated ledger version. +* `load`: (Admin only) An object that provides detailed information about the current load state of the server. This object includes: + * `load.job_types`: (Admin only) An array that provides information about the rate of different types of jobs the server is doing and how much time it spends on each. + * `load.threads`: (Admin only) A number that indicates the number of threads in the server's main job pool. +* `load_base`: An integer that represents the baseline amount of server load used in transaction cost calculations. If the `load_factor` is equal to the `load_base` then only the base transaction cost is enforced. If the `load_factor` is higher than the `load_base`, then transaction costs are multiplied by the ratio between them. +* `load_factor`: A number that represents the load factor the server is currently enforcing. The ratio between this value and the `load_base` determines the multiplier for transaction costs. The load factor is determined by the highest of the individual server's load factor, cluster's load factor, the open ledger cost, and the overall network's load factor. +* `load_factor_fee_escalation`: (Optional) A number that indicates the current multiplier to the transaction cost to get into the open ledger, in fee levels. +* `load_factor_fee_queue`: (Optional) A number that indicates the current multiplier to the transaction cost to get into the queue, if the queue is full, in fee levels. +* `load_factor_fee_reference`: (Optional) A number that indicates the transaction cost with no load scaling, in fee levels. +* `load_factor_server`: (Optional) A number that represents the load factor the server is enforcing, not including the open ledger cost. +* `peers`: A number that shows how many other `rippled` servers this one is currently connected to. This field is omitted by reporting mode servers. +* `pubkey_node`: A string that represents the public key used to verify this server for peer-to-peer communications. This node key pair is automatically generated by the server the first time it starts up. +* `pubkey_validator`: (Admin only) A string that represents the public key used by this node to sign ledger validations. This validation key pair is derived from the `[validator_token]` or `[validation_seed]` config field. +* `reporting`: (Reporting mode servers only) An object that provides information about this server's reporting-mode specific configurations. This object includes: + * `reporting.etl_sources`: (Reporting mode servers only) An array that lists P2P-mode servers this reporting mode is retrieving data from. Each entry in this array is an ETL Source object. + * `reporting.is_writer`: (Reporting mode servers only) A Boolean value that indicates if this server is writing to the external database with ledger data. If false, it is not currently writing, possibly because another reporting mode server is currently populating a shared database, or because it's configured as read-only. + * `reporting.last_publish_time`: (Reporting mode servers only) A string that represents an ISO 8601 timestamp indicating when this server last saw a new validated ledger from any of its P2P mode sources. +* `server_state`: A string that indicates to what extent the server is participating in the network. +* `server_state_duration_us`: A number that shows the number of consecutive microseconds the server has been in the current state. +* `state_accounting`: An object that represents a map of various server states with information about the time the server spends in each. This object includes: + * `state_accounting.*.duration_us`: A string that indicates the number of microseconds the server has spent in this state. This is updated whenever the server transitions into another state. + * `state_accounting.*.transitions`: A string that shows the number of times the server has changed into this state. +* `time`: A string that indicates the current time in UTC, according to the server's clock. +* `uptime`: A number that indicates the number of consecutive seconds that the server has been operational. +* `validated_ledger`: (Optional) An object that provides information about the most recent fully-validated ledger. This object includes: + * `validated_ledger.base_fee`: A number that indicates the base fee, in drops of XRP, for propagating a transaction to the network. + * `validated_ledger.close_time`: A number that shows the time this ledger was closed, in seconds since the Ripple Epoch. + * `validated_ledger.hash`: A string that represents the unique hash of this ledger version, as hexadecimal. + * `validated_ledger.reserve_base`: A number that shows the minimum account reserve, as of the most recent validated ledger version. + * `validated_ledger.reserve_inc`: A number that shows the owner reserve for each item an account owns, as of the most recent validated ledger version. + * `validated_ledger.seq`: A number that represents the ledger index of the most recently validated ledger version. +* `validation_quorum`: A number that indicates the minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations. +* `validator_list_expires`: (Admin only) A number that shows when the current validator list expires, in seconds since the Ripple Epoch, or 0 if the server has yet to load a published validator list. + +For the `ETL Source Object`, each member of the `etl_sources` field is an object with the following fields: + +* `connected`: A Boolean value that indicates if the reporting mode server is connected to this P2P mode server. If false, the server is not connected. +* `grpc_port`: A string that shows the port number on the P2P mode server where this reporting mode server is configured to connect and retrieve ledger data via gRPC. +* `ip`: A string that represents the IP address (IPv4 or IPv6) of the P2P mode server. +* `last_message_arrival_time`: A string that represents an ISO 8601 timestamp indicating the most recent time the reporting mode server received a message from this P2P server. +* `validated_ledgers_range`: A string that shows the range of validated ledger versions this P2P mode server reports that it has available, in the same format as complete\_ledgers. +* `websocket_port`: A string that shows the port number on the P2P server where this reporting mode server is configured to forward WebSocket requests that cannot be served directly from reporting mode. + +### JSON-RPC Request Example + +```json +{ + "method": "server_state", + "params": [ + {} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "state": { + "build_version": "1.7.2", + "complete_ledgers": "65844785-65887184", + "io_latency_ms": 3, + "jq_trans_overflow": "580", + "last_close": { + "converge_time": 3012, + "proposers": 41 + }, + "load_base": 256, + "load_factor": 134022, + "load_factor_fee_escalation": 134022, + "load_factor_fee_queue": 256, + "load_factor_fee_reference": 256, + "load_factor_server": 256, + "peer_disconnects": "792367", + "peer_disconnects_resources": "7273", + "peers": 72, + "pubkey_node": "n9LNvsFiYfFf8va6pma2PHGJKVLSyZweN1iBAkJQSeHw4GjM8gvN", + "server_state": "full", + "server_state_duration_us": "422128665555", + "state_accounting": { + "connected": { + "duration_us": "172799714", + "transitions": "1" + }, + "disconnected": { + "duration_us": "309059", + "transitions": "1" + }, + "full": { + "duration_us": "6020429212246", + "transitions": "143" + }, + "syncing": { + "duration_us": "413813232", + "transitions": "152" + }, + "tracking": { + "duration_us": "266553605", + "transitions": "152" + } + }, + "time": "2021-Aug-24 20:43:43.043406 UTC", + "uptime": 6021282, + "validated_ledger": { + "base_fee": 10, + "close_time": 683153020, + "hash": "ABEF3D24015E8B6B7184B4ABCEDC0E0E3AA4F0677FAB91C40B1E500707C1F3E5", + "reserve_base": 20000000, + "reserve_inc": 5000000, + "seq": 65887184 + }, + "validation_quorum": 33 + }, + "status": "success" + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/README.md new file mode 100644 index 0000000..c56abc3 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/README.md @@ -0,0 +1,2 @@ +# API calls for transaction methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign.md new file mode 100644 index 0000000..8198b22 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign.md @@ -0,0 +1,107 @@ +# sign + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const txJson = { /*...*/ } // Your TxJson object here + +const options = { + secret: 'sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ', // Your secret key here + // Additional options... +} + +const res = await tatum.rpc.sign(txJson, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `sign` method takes a transaction in JSON format and a seed value, and returns a signed binary representation of the transaction. This is particularly useful for performing transactions on the XRP Ledger. It is strongly recommended to perform local signing using a client library instead of using this command unless you run the `rippled` server yourself. + +**Caution:** Do not send your secret to untrusted servers or through unsecured network connections. + +### Parameters + +The `sign` method accepts two parameters: `txJson` and `options`. + +`txJson` (object): The transaction definition in JSON format. See [Ripple's official documentation](https://developers.ripple.com/transaction-formats.html) for a detailed structure of `TxJson`. + +`options` (object): This optional parameter contains the following properties: + +* `secret` (string): The secret seed of the account supplying the transaction, used to sign it. Cannot be used with `keyType`, `seed`, `seedHex`, or `passphrase`. +* `seed` (string): The secret seed of the account in the XRP Ledger's base58 format. Cannot be used with `secret`, `seedHex`, or `passphrase`. +* `seedHex` (string): The secret seed of the account in the hexadecimal format. Cannot be used with `secret`, `seed`, or `passphrase`. +* `passphrase` (string): The secret seed of the account as the string passphrase. Cannot be used with `secret`, `seed`, or `seedHex`. +* `keyType` (string): The signing algorithm of the cryptographic key pair provided (secp256k1 or ed25519). Cannot be used with `secret`. +* `offline` (boolean): If true, when constructing the transaction, do not try to automatically fill in or validate values. +* `buildPath` (boolean): If true, the server auto-fills the Paths field of a Payment transaction before signing. +* `feeMultMax` (number): The maximum value of fee multiplier. +* `feeDivMax` (number): The divisor value of fee. + +### Return Object + +Upon successful invocation, the `sign` method returns a Promise that resolves to `XrpResult` object which contains the following properties: + +* `tx_blob` (string): Binary representation of the fully-qualified, signed transaction, as hexadecimal string. +* `tx_json` (object): JSON specification of the complete transaction as signed, including any fields that were automatically filled in. + +### JSON-RPC Request Example + +```json +{ + "method": "sign", + "params": [ + { + "offline": false, + "secret": "sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ", + "tx_json": { + "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "Amount": { + "currency": "USD", + "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSw + +uJYfV2Jpn", + "value": "1" + }, + "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "TransactionType": "Payment" + }, + "fee_mult_max": 1000 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "status": "success", + "tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754", + "tx_json": { + "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "Amount": { + "currency": "USD", + "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "value": "1" + }, + "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "Fee": "10000", + "Flags": 2147483648, + "Sequence": 360, + "SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB", + "TransactionType": "Payment", + "TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580", + "hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0" + } + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign_for.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign_for.md new file mode 100644 index 0000000..4e0fa82 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/sign_for.md @@ -0,0 +1,111 @@ +# sign\_for + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const txJson = { + TransactionType: "TrustSet", + Account: "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC", + Flags: 262144, + LimitAmount: { + currency: "USD", + issuer: "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + value: "100" + }, + Sequence: 2, + SigningPubKey: "", + Fee: "30000" +}; + +const res = await tatum.rpc.signFor('rLFd1FzHMScFhLsXeaxStzv3UC97QHGAbM', txJson) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `sign_for` command in XRP RPC allows one to provide a signature for a multi-signed transaction. This method is particularly useful when you want to ensure the transaction is only valid if it is signed by multiple parties, for example, in a shared wallet scenario or when a transaction must be approved by multiple individuals or entities. + +This method is available only if the server admin has enabled public signing and requires the MultiSign amendment to be enabled. It was introduced in `rippled` version 0.31.0. + +### Parameters + +The `sign_for` method takes the following parameters: + +* `account`: (string) - The address which is providing the signature. +* `tx_json`: (object) - The Transaction to sign. All fields of the transaction must be provided, including Fee and Sequence. The transaction must include the field SigningPubKey with an empty string as the value. The object may optionally contain a Signers array with previously-collected signatures. +* `options`: (object) - This includes `secret`, `seed`, `seed_hex`, `passphrase`, `key_type` as optional parameters which are used to sign the transaction. + +### Return Object + +The `sign_for` method returns a Promise that resolves to an object of type `XrpResult`. This object contains: + +* `tx_blob`: A hexadecimal representation of the signed transaction, including the newly-added signature. +* `tx_json`: The transaction specification in JSON format, with the newly-added signature in the Signers array. + +### JSON-RPC Request Example + +```json +{ + "id": "sign_for_example", + "command": "sign_for", + "account": "rLFd1FzHMScFhLsXeaxStzv3UC97QHGAbM", + "seed": "sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ", + "key_type": "ed25519", + "tx_json": { + "TransactionType": "TrustSet", + "Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC", + "Flags": 262144, + "LimitAmount": { + "currency": "USD", + "issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "value": "100" + }, + "Sequence": 2, + "SigningPubKey": "", + "Fee": "30000" + } +} +``` + +### JSON-RPC Response Example + +```json +{ + "result" : { + "status" : "success", + "tx_blob" : "1200142200040000240000000263D5038D7EA4C680000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF744730450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E58114204288D2E47F8EF6C99BCC457966320D12409711E1F1", + "tx_json" : { + "Account" : "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC", + "Fee" : "30000", + "Flags" : 262144, + "LimitAmount" : { + "currency" : "USD", + "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "value" : "100" + }, + "Sequence" : 2, + "Signers" : [ + { + "Signer" : { + "Account" : "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW", + "SigningPubKey" : "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF", + "TxnSignature" : "30450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E5" + } + } + ], + "SigningPubKey" : "", + "TransactionType" : "TrustSet", + "hash" : "A94A6417D1A7AAB059822B894E13D322ED3712F7212CE9257801F96DE6C3F6AE" + } + } +} +``` + +### diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit.md new file mode 100644 index 0000000..1dcbc51 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit.md @@ -0,0 +1,145 @@ +# submit + +### How to use it + +```javascript +// yarn add @tatumio/tatum +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const tx = { + TransactionType: "Payment", + Account: "rBPAQmwMrt7FDDPNyjwFgwSqbWZPf6GieV", + Destination: "rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY", + Amount: "2000000", + Flags: 2147483648 +} + +const res = await tatum.rpc.submit(tx, { + secret: 'sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ' +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `submit` method is an RPC method in the XRP Ledger which is used to apply a transaction and send it to the network for confirmation and inclusion in future ledgers. It has two modes: Submit-only mode, where a signed and serialized transaction is submitted as-is, and Sign-and-submit mode, where a JSON-formatted transaction object is completed, signed, and then submitted. It is generally recommended to use the Submit-only mode for robustness. + +Use cases for this method include submitting transactions to the XRP ledger, such as sending payments, managing trust lines, or deploying smart contracts. + +{% embed url="https://codepen.io/tatum-devrel/pen/LYXvXLw" %} + +### Parameters + +The `submit` method takes the following parameters: + +* `tx` (required): A string or JSON object representing the transaction to be submitted. This can be a hex representation of the signed transaction or a transaction definition in JSON format. +* `options` (optional): An object containing additional parameters. These can include: + * `secret` (optional): The secret seed of the account. + * `seed` (optional): The secret seed of the account in the XRP Ledger's base58 format. + * `seedHex` (optional): The secret seed of the account in the hexadecimal format. + * `passphrase` (optional): The secret seed of the account as the string passphrase. + * `keyType` (optional): The signing algorithm of the cryptographic key pair provided (secp256k1 or ed25519). + * `failHard` (optional): If true, and the transaction fails locally, do not retry or relay the transaction to other servers. + * `offline` (optional): If true, when constructing the transaction, do not try to automatically fill in or validate values. + * `buildPath` (optional): If true, the server auto-fills the Paths field of a Payment transaction before signing. + * `feeMultMax` (optional): Sign-and-submit fails with the error rpcHIGH\_FEE if the auto-filled Fee value would be greater than the reference transaction cost ร— feeMultMax รท feeDivMax. + * `feeDivMax` (optional): Sign-and-submit fails with the error rpcHIGH\_FEE if the auto-filled Fee value would be greater than the reference transaction cost ร— feeMultMax รท feeDivMax. + +### Return Object + +The `submit` method returns an object that provides information about the result of the submitted transaction. The object contains the following fields: + +* `engine_result`: A string that represents a code indicating the preliminary result of the transaction, for example, "tesSUCCESS". +* `engine_result_code`: An integer that represents a numeric version of the result code. This is directly correlated to the `engine_result`. +* `engine_result_message`: A string that represents a human-readable explanation of the transaction's preliminary result. +* `tx_blob`: A string that represents the complete transaction in hexadecimal string format. +* `tx_json`: An object that represents the complete transaction in JSON format. +* `accepted`: A boolean value that indicates whether the transaction was accepted. This field is omitted in sign-and-submit mode. +* `account_sequence_available`: A number indicating the next Sequence Number available for the sending account after all pending and queued transactions. This field is omitted in sign-and-submit mode. +* `account_sequence_next`: A number indicating the next Sequence Number for the sending account after all transactions that have been provisionally applied, but not transactions in the queue. This field is omitted in sign-and-submit mode. +* `applied`: A boolean value indicating whether the transaction was applied to the open ledger. This field is omitted in sign-and-submit mode. +* `broadcast`: A boolean value indicating whether the transaction was broadcast to peer servers in the peer-to-peer XRP Ledger network. This field is omitted in sign-and-submit mode. +* `kept`: A boolean value indicating whether the transaction was kept to be retried later. This field is omitted in sign-and-submit mode. +* `queued`: A boolean value indicating whether the transaction was put in the Transaction Queue. This field is omitted in sign-and-submit mode. +* `open_ledger_cost`: A string indicating the current open ledger cost before processing this transaction. Transactions with a lower cost are likely to be queued. This field is omitted in sign-and-submit mode. +* `validated_ledger_index`: An integer indicating the ledger index of the newest validated ledger at the time of submission. This field is omitted in sign-and-submit mode. + +### JSON-RPC Request Example - Submit Only + +```json +{ + "method": "submit", + "params": [ + { + "tx_blob": "1200002280000000240000000361D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA968400000000000000A732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100D184EB4AE5956FF600E7536EE459345C7BBCF097A84CC61A93B9AF7197EDB98702201CEA8009B7BEEBAA2AACC0359B41C427C1C5B550A4CA4B80CF2174AF2D6D5DCE81144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754" + } + ] +} +``` + +### JSON-RPC Request Example - Submit Only + +```json +{ + "method": "submit", + "params": [ + { + "offline": false, + "secret": "sโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ", + "tx_json": { + "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "Amount": { + "currency": "USD", + "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "value": "1" + }, + "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "TransactionType": "Payment" + }, + "fee_mult_max": 1000 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "accepted" : true, + "account_sequence_available" : 362, + "account_sequence_next" : 362, + "applied" : true, + "broadcast" : true, + "engine_result": "tesSUCCESS", + "engine_result_code": 0, + "engine_result_message": "The transaction was applied. Only final in a validated ledger.", + "status": "success", + "kept" : true, + "open_ledger_cost": "10", + "queued" : false, + "tx_blob": "1200002280000000240000016961D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F181144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754", + "tx_json": { + "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "Amount": { + "currency": "USD", + "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "value": "1" + }, + "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "Fee": "10000", + "Flags": 2147483648, + "Sequence": 361, + "SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB", + "TransactionType": "Payment", + "TxnSignature": "3045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F1", + "hash": "5B31A7518DC304D5327B4887CD1F7DC2C38D5F684170097020C7C9758B973847" + } + }, + "validated_ledger_index" : 21184416 +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit_multisigned.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit_multisigned.md new file mode 100644 index 0000000..1bba909 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/submit_multisigned.md @@ -0,0 +1,103 @@ +# submit\_multisigned + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const txJson = { /* your transaction JSON here */ } +const options = { failHard: true } // optional + +const res = await tatum.rpc.submitMultisigned(txJson, options) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `submitMultisigned` method in the XRP RPC API allows you to apply a multi-signed transaction and send it to the network to be included in future ledgers. This method requires the MultiSign amendment to be enabled and was introduced in rippled 0.31.0. + +This method is used when multiple parties are required to authorise a transaction, which can be a useful feature for securing high-value accounts, implementing distributed decision-making processes, or creating more complex authorisation structures for transactions. + +{% embed url="https://codepen.io/tatum-devrel/pen/XWyQyao" %} + +### Parameters + +* `txJson` (TxJson): The transaction in JSON format with an array of Signers. To be successful, the weights of the signatures must be equal to or higher than the quorum of the SignerList. +* `options` (FailOption, optional): This parameter is optional. If `failHard` is true, and the transaction fails locally, it will not retry or relay the transaction to other servers. The default is false. + +### Return Object + +The `submit_multisigned` method returns an object that provides information about the result of the submitted multisigned transaction. The object contains the following fields: + +* `engine_result`: A string that represents a code indicating the preliminary result of the transaction, for example, "tesSUCCESS". +* `engine_result_code`: An integer that represents a numeric code indicating the preliminary result of the transaction. This is directly correlated to the `engine_result`. +* `engine_result_message`: A string that represents a human-readable explanation of the preliminary transaction result. +* `tx_blob`: A string that represents the complete transaction in hexadecimal string format. +* `tx_json`: An object that represents the complete transaction in JSON format. + +### JSON-RPC Request Example + +```json +{ + "method": "submit_multisigned", + "params": [ + { + "tx_json": { + "Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC", + "Fee": "30000", + /* ... rest of the transaction ... */ + }, + "fail_hard": true + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "engine_result": "tesSUCCESS", + "engine_result_code": 0, + "engine_result_message": "The transaction was applied. Only final in a validated ledger.", + "status": "success", + "tx_blob": "120014220004000024000000046380000000000000000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF74473045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B78114204288D2E47F8EF6C99BCC457966320D12409711E1E010732103398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C174473045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D0881143A4C02EA95AD6AC3BED92FA036E0BBFB712C030CE1F1", + "tx_json": { + "Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC", + "Fee": "30000", + "Flags": 262144, + "LimitAmount": { + "currency": "USD", + "issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "value": "0" + }, + "Sequence": 4, + "Signers": [ + { + "Signer": { + "Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW", + "SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF", + "TxnSignature": "3045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B7" + } + }, + { + "Signer": { + "Account": "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n", + "SigningPubKey": "03398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C1", + "TxnSignature": "3045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D08" + } + } + ], + "SigningPubKey": "", + "TransactionType": "TrustSet", + "hash": "81A477E2A362D171BB16BE17B4120D9F809A327FA00242ABCA867283BEA2F4F8" + } + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/transaction_entry.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/transaction_entry.md new file mode 100644 index 0000000..2db582a --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/transaction_entry.md @@ -0,0 +1,78 @@ +# transaction\_entry + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.transactionEntry('C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9', { + ledgerIndex: '56865245', +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `transaction_entry` method retrieves information on a single transaction from a specific ledger version. It does not search all ledgers for the specified transaction, unlike the `tx` method, which does. The `transaction_entry` method is useful for fetching transaction data from a specified ledger, making it an essential method for auditing or tracking transaction histories. + +It's important to note that this method does not support retrieving information from the current in-progress ledger. A ledger version must be specified in either `ledger_index` or `ledger_hash`. + +This method can fail to find the transaction due to the following reasons: + +* The transaction does not exist. +* The transaction exists, but not in the specified ledger version. +* The server does not have the specified ledger version available. Another server that has the correct version on hand may have a different response. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQeQXN" %} + +### Parameters + +The parameters required for this method are: + +* `txHash`: (String) The unique hash of the transaction you are looking up. +* `options`: (Ledger) Options for specifying the ledger to use. It includes the following properties: + * `ledger_hash`: (Optional) A 20-byte hex string for the ledger version to use. + * `ledger_index`: (Optional) The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. + +### Return Object + +The `transaction_entry` method returns an object that provides detailed information about a transaction from a specified ledger. The object contains the following fields: + +* `ledger_index`: A number that represents the ledger index of the ledger version the transaction was found in; this is the same as the one from the request. +* `ledger_hash`: A string that represents the identifying hash of the ledger version the transaction was found in; this is the same as the one from the request. This field may be omitted. +* `metadata`: An object that represents the transaction metadata. This shows the exact results of the transaction in detail. +* `tx_json`: An object that represents the JSON representation of the Transaction object. + +### JSON-RPC Request Example + +```json +{ + "method": "transaction_entry", + "params": [ + { + "tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9", + "ledger_index": 56865245 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "ledger_hash": "793E56131D8D4ABFB27FA383BFC44F2978B046E023FF46C588D7E0C874C2472A", + "ledger_index": 56865245, + "metadata": { /* Detailed result of the transaction */ }, + "status": "success", + "tx_json": { /* JSON representation of the Transaction object */ }, + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx.md new file mode 100644 index 0000000..eaef9e9 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx.md @@ -0,0 +1,185 @@ +# tx + +### How to use it + +```javascript +// yarn add @tatumio/tatum +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const transactionDetails = await tatum.rpc.tx('C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9', { + binary: false, + minLedger: 10000, + maxLedger: 20000, +}) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `tx` method in XRP ledger's RPC API retrieves information on a single transaction by its identifying hash. It is primarily used for querying details about specific transactions that have occurred on the XRP Ledger. The transaction could be any type of operation such as a payment, offer creation, offer cancellation, trust set operation, etc. + +This method can be very useful when tracking payment statuses, auditing transactions, or developing blockchain analysis tools. However, it should be noted that the command may successfully find the transaction even if it is included in a ledger outside the range of min\_ledger to max\_ledger. + +{% embed url="https://codepen.io/tatum-devrel/pen/ExOJOQJ" %} + +### Parameters + +The `tx` method accepts the following parameters: + +* `transaction`: (Type: String) The 256-bit hash of the transaction, as hex. +* `binary`: (Type: Boolean, Optional) If true, return transaction data and metadata as binary serialized to hexadecimal strings. If false, return transaction data and metadata as JSON. The default is false. +* `minLedger`: (Type: Number, Optional) Use this with `maxLedger` to specify a range of up to 1000 ledger indexes, starting with this ledger (inclusive). +* `maxLedger`: (Type: Number, Optional) Use this with `minLedger` to specify a range of up to 1000 ledger indexes, ending with this ledger (inclusive). + +### Return Object + +The `tx` method returns an object that provides information about a prepared transaction. The object contains the following fields: + +* `date`: A number that represents the number of seconds since January 1, 2000 (00:00 UTC) indicating the close time of the ledger in which the transaction was applied. This value does not have a precise relationship with physical time, and is dependent on the close time resolution. +* `hash`: A string that represents the SHA-512 hash of the transaction. +* `inLedger`: (Deprecated) An alias for `ledger_index`. +* `ledger_index`: A number that represents the ledger index of the ledger that includes this transaction. +* `meta`: An object (JSON) or a string (binary) that represents the transaction metadata, which describes the results of the transaction. +* `validated`: A boolean that indicates if this data comes from a validated ledger version; if omitted or set to false, this data is not final. +* `(Various)`: (Various) Other fields from the Transaction object. + +### JSON-RPC Request Example + +```json +{ + "method": "tx", + "params": [ + { + "transaction": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9", + "binary": false, + "minLedger": 10000, + "maxLedger": 20000 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM", + "Fee": "12", + "Flags": 0, + "LastLedgerSequence": 56865248, + "OfferSequence": 5037708, + "Sequence": 5037710, + "SigningPubKey": "03B51A3EDF70E4098DA7FB053A01C5A6A0A163A30ED1445F14F87C7C3295FCB3BE", + "TakerGets": "15000000000", + "TakerPays": { + "currency": "CNY", + "issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y", + "value": "20160.75" + }, + "TransactionType": "OfferCreate", + "TxnSignature": "3045022100A5023A0E64923616FCDB6D664F569644C7C9D1895772F986CD6B981B515B02A00220530C973E9A8395BC6FE2484948D2751F6B030FC7FB8575D1BFB406368AD554D9", + "date": 648248020, + "hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9", + "inLedger": 56865245, + "ledger_index": 56865245, + "meta": { + "AffectedNodes": [ + { + "ModifiedNode": { + "FinalFields": { + "ExchangeRate": "4F04C66806CF7400", + "Flags": 0, + "RootIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400", + "TakerGetsCurrency": "0000000000000000000000000000000000000000", + "TakerGetsIssuer": "0000000000000000000000000000000000000000", + "TakerPaysCurrency": "000000000000000000000000434E590000000000", + "TakerPaysIssuer": "CED6E99370D5C00EF4EBF72567DA99F5661BFB3A" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400" + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM", + "Balance": "10404767991", + "Flags": 0, + "OwnerCount": 3, + "Sequence": 5037711 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "1DECD9844E95FFBA273F1B94BA0BF2564DDF69F2804497A6D7837B52050174A2", + "PreviousFields": { + "Balance": "10404768003", + "Sequence": 5037710 + }, + "PreviousTxnID": "4DC47B246B5EB9CCE92ABA8C482479E3BF1F946CABBEF74CA4DE36521D5F9008", + "PreviousTxnLgrSeq": 56865244 + } + }, + { + "DeletedNode": { + "FinalFields": { + "Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM", + "BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400", + "BookNode": "0000000000000000", + "Flags": 0, + "OwnerNode": "0000000000000000", + "PreviousTxnID": "8F5FF57B404827F12BDA7561876A13C3E3B3095CBF75334DBFB5F227391A660C", + "PreviousTxnLgrSeq": 56865244, + "Sequence": 5037708, + "TakerGets": "15000000000", + "TakerPays": { + "currency": "CNY", + "issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y", + "value": "20160.75" + } + }, + "LedgerEntryType": "Offer", + "LedgerIndex": "26AAE6CA8D29E28A47C92ADF22D5D96A0216F0551E16936856DDC8CB1AAEE93B" + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Flags": 0, + "IndexNext": "0000000000000000", + "IndexPrevious": "0000000000000000", + "Owner": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM", + "RootIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548" + } + }, + { + "CreatedNode": { + "LedgerEntryType": "Offer", + "LedgerIndex": "8BAEE3C7DE04A568E96007420FA11ABD0BC9AE44D35932BB5640E9C3FB46BC9B", + "NewFields": { + "Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM", + "BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400", + "Sequence": 5037710, + "TakerGets": "15000000000", + "TakerPays": { + "currency": "CNY", + "issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y", + "value": "20160.75" + } + } + } + } + ], + "TransactionIndex": 0, + "TransactionResult": "tesSUCCESS" + }, + "status": "success", + "validated": true + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx_history.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx_history.md new file mode 100644 index 0000000..73def7f --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-transaction-methods/tx_history.md @@ -0,0 +1,75 @@ +# tx\_history + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.txHistory(0) + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `txHistory` method retrieves some of the most recent transactions made on the XRP Ledger. This is particularly useful for tracking and verifying transaction history, auditing purposes, and other applications where historical transaction data is required. + +**Note:** This method is deprecated and may be removed without further notice. + +In this example, the `txHistory` method is called with the parameter `start` set to `0`. This will return the most recent transactions. + +{% embed url="https://codepen.io/tatum-devrel/pen/dyQLQeo" %} + +### Parameters + +The `txHistory` method accepts the following parameter: + +* `start`: Unsigned Integer. This parameter specifies the number of transactions to skip over, starting from the most recent one. + +### Return Object + +The method returns a Promise that resolves to an `XrpResult` object. This object contains the following fields: + +* `index`: Unsigned Integer. The value of `start` used in the request. +* `status`: String. The status of the request. A value of "success" indicates that the request was successful. +* `txs`: Array. An array of transaction objects. + +### JSON-RPC Request Example + +```json +{ + "method": "txHistory", + "params": [ + { + "start": 0 + } + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "index": 0, + "status": "success", + "txs": [ + { + "Account": "rPJnufUfjS22swpE7mWRkn2VRNGnHxUSYc", + "TransactionType": "OfferCreate", + // other transaction fields... + }, + { + "Account": "rwpxNWdpKu2QVgrh5LQXEygYLshhgnRL1Y", + "TransactionType": "OfferCreate", + // other transaction fields... + } + ] + } +} +``` diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/README.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/README.md new file mode 100644 index 0000000..eacf71d --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/README.md @@ -0,0 +1,2 @@ +# API calls for utility methods + diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/ping.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/ping.md new file mode 100644 index 0000000..b0a198f --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/ping.md @@ -0,0 +1,56 @@ +# ping + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.ping() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `ping` method is a simple RPC method provided by the Ripple (XRP) blockchain, used primarily to check the connection status and latency to the XRP blockchain node. It's a useful tool in debugging and network troubleshooting scenarios, as it provides an easy way to verify the connection and round-trip time between the client and the server. + +{% embed url="https://codepen.io/tatum-devrel/pen/oNQOJdw" %} + +### Parameters + +The `ping` method accepts no parameters. + +### Return Object + +The `ping` method returns a simple object with the following field: + +* `status`: The status of the request, typically "success". The presence of this field in the response indicates a successful round trip. + +The client can measure the round-trip time from the request to the response as latency. + +### JSON-RPC Request Example + +```json +{ + "method": "ping", + "params": [ + {} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "status": "success" + } +} +``` + +This response signifies a successful connection to the XRP node. The time it takes to receive this response can be used to measure network latency. diff --git a/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/random.md b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/random.md new file mode 100644 index 0000000..11a8703 --- /dev/null +++ b/docs/rpc/xrp-rpc-documentation/api-calls-for-utility-methods/random.md @@ -0,0 +1,56 @@ +# random + +### How to use it + +```javascript +// yarn add @tatumio/tatum + +import { TatumSDK, Xrp, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.XRP}) + +const res = await tatum.rpc.random() + +tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +``` + +### Overview + +The `random` method is an RPC method provided by the Ripple (XRP) blockchain. This command returns a random number that can be used as a source of entropy for random number generation by clients. It's particularly useful in scenarios where a high-entropy random number is required, such as cryptographic operations or unique identifier generation. + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzRZXW" %} + +### Parameters + +The `random` method accepts no parameters. + +### Return Object + +The `random` method returns an object with the following fields: + +* `random`: A Random 256-bit hex value. +* `status`: The status of the request, typically "success". + +### JSON-RPC Request Example + +```json +{ + "method": "random", + "params": [ + {} + ] +} +``` + +### JSON-RPC Response Example + +```json +{ + "result": { + "random": "4E57146AA47BC6E88FDFE8BAA235B900126C916B6CC521550996F590487B837A", + "status": "success" + } +} +``` + +This response includes a random 256-bit hex value generated by the XRP node. diff --git a/docs/wallet-address-operations/README.md b/docs/wallet-address-operations/README.md new file mode 100644 index 0000000..7d4a651 --- /dev/null +++ b/docs/wallet-address-operations/README.md @@ -0,0 +1,23 @@ +# ๐Ÿ’ฐ Wallet address operations + +A wallet, in the context of blockchain and cryptocurrencies, is a digital tool that allows users to securely store, manage, and transact with their digital assets such as cryptocurrencies and tokens. Wallets come in various forms, including hardware, software, and even paper wallets. The primary function of a wallet is to securely store a user's private keys, which are needed to access and manage their assets on the blockchain. + +Now that we understand what a wallet is, let's explore why users should leverage features like retrieving wallet balances and transaction histories. + +**1. Get the Balance of a Wallet** + +Retrieving the balance of a wallet is a crucial feature for users who want to keep track of their digital assets. By checking their wallet balance, users can: + +* Monitor their asset holdings: Regularly checking the wallet balance helps users stay informed about the value of their assets, allowing them to make informed decisions about buying, selling, or holding their digital assets. +* Verify received transactions: When users expect to receive digital assets, checking the wallet balance helps confirm if the transaction was successful and if the correct amount has been received. +* Plan transactions: By knowing the balance of their wallet, users can plan transactions accordingly and ensure they have sufficient funds to cover fees or other expenses. + +**2. Get Transactions on a Specific Address** + +Viewing transaction history is another essential feature for users who want to track their digital asset activities. By accessing the transaction history of a specific address, users can: + +* Audit past transactions: Users can review their transaction history to verify the accuracy of previous transactions, confirm the right amounts were sent or received, and ensure that no unauthorized transactions have occurred. +* Track spending and receiving patterns: Reviewing transaction history helps users analyze their spending and receiving habits, which can be useful for budgeting or evaluating the performance of their investments. +* Manage tax obligations: In many jurisdictions, digital assets are subject to taxation. Having access to transaction history enables users to maintain accurate records for tax purposes and meet their tax reporting obligations. + +In summary, wallets play a vital role in the management of digital assets, and the ability to retrieve wallet balances and transaction histories is crucial for users who want to stay informed and in control of their assets. By leveraging these features, users can effectively monitor their holdings, verify transactions, and make better-informed decisions about their digital assets. diff --git a/docs/wallet-address-operations/get-all-assets-the-wallet-holds.md b/docs/wallet-address-operations/get-all-assets-the-wallet-holds.md new file mode 100644 index 0000000..0d2f74d --- /dev/null +++ b/docs/wallet-address-operations/get-all-assets-the-wallet-holds.md @@ -0,0 +1,222 @@ +--- +description: >- + This endpoint can help you fetch all the Assets a wallet holds including + native tokens, fungible tokens, non fungible tokens & multitokens. +--- + +# Get all assets the wallet holds + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQmQxG" %} + +Managing digital assets across various blockchain networks can be a challenging task. However, with TatumSDK, a powerful TypeScript library, developers can effortlessly retrieve wallet balances from multiple blockchains using a unified interface. This guide will demonstrate how to leverage TatumSDK's cross-chain capabilities to obtain wallet balances on Ethereum and Bitcoin, two popular, yet different blockchain networks. By following the steps outlined, you'll be able to streamline the development process and build applications that easily interact with multiple blockchains, saving time and reducing complexity. + +### How to get a balance on Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a balance of the wallet. + +{% hint style="info" %} +TatumSDK wraps multiple different calls to the Tatum API together in 1 function, so we don't show here the curl example for using direct HTTP API calls. You can check the [API documentation](https://apidoc.tatum.io/tag/Data-API#operation/GetBalances) for specific operations, which are internally used [inside the library](https://github.com/tatumio/tatum-js/blob/master/src/service/address/address.ts). +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, AddressBalance} from '@@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const balance: ResponseDto = await tatum.address.getBalance({ + addresses: ['0xF64E82131BE01618487Da5142fc9d289cbb60E9d'], // replace with your address +}) + +console.log(balance.data) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +import { TatumSDK, Network } from "@tatumio/tatum"; + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const balance = await tatum.address.getBalance({ + addresses: ['0xF64E82131BE01618487Da5142fc9d289cbb60E9d'], // replace with your address + }); + console.log(balance.data); + } catch (error) { + console.error("Error fetching wallet balance:", error); + } +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```javascript +[ + { + asset: 'ETH', + address: '0xF64E82131BE01618487Da5142fc9d289cbb60E9d', + decimals: 18, + balance: '0.001', + type: 'native', + } +] +``` + +
+ +### How to get a balance on the Bitcoin network + +In order to get a balance of a Bitcoin address, you can use the same approach and reuse the same code. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js +import {TatumSDK, Network, Bitcoin, ResponseDto, AddressBalance} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN}) + +const balance: ResponseDto = await tatum.address.getBalance({ + addresses: ['bc1q7zw9ax8tm4jk2k2674u6lcd9fwjut8kqtvfeg8'], // replace with your address +}) + +console.log(balance.data) + +// Expected outcome +// [{ +// asset: 'BTC', +// address: 'bc1q7zw9ax8tm4jk2k2674u6lcd9fwjut8kqtvfeg8', +// decimals: 8, +// balance: '0.001', +// type: 'native', +// }] +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumcom/js +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.BITCOIN }); + const balance = await tatum.address.getBalance({ + addresses: ["bc1q7zw9ax8tm4jk2k2674u6lcd9fwjut8kqtvfeg8"], // replace with your address + }); + console.log(balance.data); + } catch (error) { + console.error("Error fetching wallet balance:", error); + } +})(); + +// Expected outcome +// [{ +// asset: 'BTC', +// address: 'bc1q7zw9ax8tm4jk2k2674u6lcd9fwjut8kqtvfeg8', +// decimals: 8, +// balance: '0.001', +// type: 'native', +// }] +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +You can see, that the same request and response is used for different blockchain networks. + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface AddressBalanceDetails { + /** + * List of addresses to check. Some blockchain network supports only 1 address at a time + */ + addresses: string[] + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface AddressBalance { + /** + * Blockchain address of the balance. + */ + address: string + /** + * Asset of the balance. For native currencies, it's always present. For tokens, only when readable from the contract `symbol()` method. + */ + asset?: string + /** + * Decimals of the asset. Valid for native and fungible tokens. For tokens, only when readable from the contract `decimals()` method. + */ + decimals?: number + /** + * Balance of the address. + */ + balance: string + /** + * Type of the balance. + */ + type: 'native' | 'fungible' | 'nft' | 'mutlitoken' + /** + * Optional token contract address. Valid only for tokens (USDT, NFTs of any kind), not for native network balances (ETH, BTC). + */ + tokenAddress?: string + /** + * Optional token ID. Valid only for non-fungible and semi-fungible tokens. + */ + tokenId?: string + /** + * Block number of the last balance update. + */ + lastUpdatedBlock?: number +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
Multiple addresses per 1 invocation
Native Assets
ERC-20 Tokens (USDT, USDC,...)
NFTs (BAYC,...)
ERC-1155 Tokens
Solana / Solana DevnetMultiple addresses per 1 invocation
Native Assets (SOL)
XRP / XRP Testnet
Bitcoin / Bitcoin Testnet
Litecoin / Litecoin Testnet
Dogecoin / Dogecoin Testnet
Cardano / Cardano Preprod
Native Assets
Only 1 address per 1 invocation
diff --git a/docs/wallet-address-operations/get-all-transactions-on-the-wallet.md b/docs/wallet-address-operations/get-all-transactions-on-the-wallet.md new file mode 100644 index 0000000..1439f5d --- /dev/null +++ b/docs/wallet-address-operations/get-all-transactions-on-the-wallet.md @@ -0,0 +1,278 @@ +--- +description: This endpoint can help you get all the transactions of a wallet. +--- + +# Get all transactions on the wallet + +{% embed url="https://codepen.io/tatum-devrel/pen/VwVqVwm" %} +Try this feature +{% endembed %} + +As the world of digital assets expands, it becomes increasingly important for users to keep track of their transactions across various blockchain networks. The ability to retrieve all transactions associated with a particular address is an essential feature for managing and auditing your digital assets. This guide will introduce you to obtaining all transactions for a specific address, providing you with a comprehensive overview of your transaction history. By leveraging this functionality, you can effectively monitor your digital asset activities, verify past transactions, and maintain accurate records for tax or accounting purposes, ultimately gaining greater control over your financial assets in the digital landscape. + +### How to get wallet transactions on the Ethereum network + +Use the TatumSDK (`@tatumio/tatum`) to get a transaction history of the wallet. + +{% hint style="info" %} +TatumSDK wraps multiple different calls to the Tatum API together in 1 function, so curl example is not shown here. You can check the [API documentation](https://apidoc.tatum.io/tag/Data-API#operation/GetBalances) for specific operations, which are internally used [inside the library](https://github.com/tatumio/tatum-js/blob/master/src/service/address/address.ts). +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum, ResponseDto, AddressTransaction} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const txs: ResponseDto = await tatum.address.getTransactions({ + address: '0x514d547c8ac8ccbec29b5144810454bd7d3625ca', // replace with your address +}) + +console.log(txs.data) + +// Expected outcome + +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txs = await tatum.address.getTransactions({ + address: '0x514d547c8ac8ccbec29b5144810454bd7d3625ca', // replace with your address + }); + console.log(txs.data); + } catch (error) { + console.error("Error fetching wallet balance:", error); + } +})(); + +// Expected outcome +// [{ +// address: '0x514d547c8ac8ccbec29b5144810454bd7d3625ca', +// amount: '1', +// blockNumber: 3325299, +// chain: 'ethereum-sepolia', +// counterAddress: '0x39d2ba91296029afbe725436b4824ca803e27391', +// hash: '0xf4ef4715f9ba61f1fb606a32775a7bf281ddf7858092aeb3e0e0484d01957058', +// timestamp: 1681982316000, +// transactionIndex: 1, +// transactionSubtype: 'incoming', +// transactionType: 'native', +// }] +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```javascript +[ + { + address: '0x514d547c8ac8ccbec29b5144810454bd7d3625ca', + amount: '1', + blockNumber: 3325299, + chain: 'ethereum-sepolia', + counterAddress: '0x39d2ba91296029afbe725436b4824ca803e27391', + hash: '0xf4ef4715f9ba61f1fb606a32775a7bf281ddf7858092aeb3e0e0484d01957058', + timestamp: 1681982316000, + transactionIndex: 1, + transactionSubtype: 'incoming', + transactionType: 'native', + } +] +``` + +
+ +### How to get wallet transactions on the Bitcoin network + +In order to get a transaction history of a Bitcoin address, you can use the same approach and reuse the same code. + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js +import {TatumSDK, Network, Bitcoin, ResponseDto, AddressTransaction} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.BITCOIN_TESTNET}) + +const balance: ResponseDto = await tatum.address.getTransactions({ + address: 'tb1qrd9jz8ksy3qqm400vt296udlvk89z96p443mv0', // replace with your address +}) + +console.log(balance.data) + +/// Expected outcome +// [{ +// address: 'tb1qrd9jz8ksy3qqm400vt296udlvk89z96p443mv0', +// amount: '0.001', +// blockNumber: 2427655, +// chain: 'bitcoin-testnet', +// hash: '954b246cdebf7338f561e2fdfb869fedd75302e2b233f339639b36d880e9c983', +// timestamp: 1680779879, +// transactionType: 'incoming', +// }] +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumcom/js +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.BITCOIN_TESTNET }); + const txs = await tatum.address.getTransactions({ + address: "tb1qrd9jz8ksy3qqm400vt296udlvk89z96p443mv0", // replace with your address + }); + console.log(txs.data); + } catch (error) { + console.error("Error fetching wallet transactions:", error); + } +})(); + +// Expected outcome +// [{ +// address: 'tb1qrd9jz8ksy3qqm400vt296udlvk89z96p443mv0', +// amount: '0.001', +// blockNumber: 2427655, +// chain: 'bitcoin-testnet', +// hash: '954b246cdebf7338f561e2fdfb869fedd75302e2b233f339639b36d880e9c983', +// timestamp: 1680779879, +// transactionType: 'incoming', +// }] +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +You can see, that the same request and response is used for different blockchain networks. + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface GetAddressTransactionsQuery { + /** + * Blockchain address to get transactions for. + */ + address: string + /** + * Optional transaction type. If not specified, all transactions are returned. For networks that support only native transactions, this parameter is ignored. + */ + transactionTypes?: ['fungible' | 'nft' | 'multitoken' | 'native'] + /** + * Optional transaction type. If not specified, both incoming and outgoing transactions are returned. + */ + transactionDirection?: 'incoming' | 'outgoing' + /** + * Optional from block. If not specified, all transactions are returned from the beginning of the blockchain. + */ + fromBlock?: number + /** + * Optional to block. If not specified, all transactions are returned up till now. + */ + toBlock?: number + /** + * Optional page size. If not specified, the default page size is used, which is 10. + */ + pageSize?: number + /** + * Optional page number. If not specified, the first page is returned. + */ + page?: number +} +``` +{% endcode %} + +### Response interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface ResponseDto { + /** + * Actual payload of the response + */ + data: T + /** + * Status of the response + */ + status: Status + /** + * In case of ERROR status, this field contains the error message and detailed description + */ + error?: ErrorWithMessage +} + +interface AddressTransaction { + /** + * Blockchain network + */ + chain: string + /** + * Block number + */ + blockNumber: number + /** + * Transaction hash + */ + hash: string + /** + * Transaction type + */ + transactionType: 'incoming' | 'outgoing' | 'zero-transfer' + /** + * Index of the transaction in the block + */ + transactionIndex?: number + /** + * Address of the token collection, if the transaction is related to a token (ERC-20, ERC-721, ERC-1155) + */ + tokenAddress?: string + /** + * Token ID, if the transaction is related to a NFT (ERC-721) or MutiToken (ERC-1155) + */ + tokenId?: string + /** + * Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number. + */ + amount: string + /** + * Transaction timestamp - UTC millis + */ + timestamp: number + /** + * Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions. + */ + address: string + /** + * Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`. + * Not all blockchain networks can identify the counter address (UTXO chains like Bitcoin e.g., where there is multiple senders or recipients). In this case, the counter address is not returned. + */ + counterAddress?: string +} +``` +{% endcode %} + +### Supported blockchain networks + +
NetworkSupport
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai
Native Assets
ERC-20 Tokens (USDT, USDC,...)
NFTs (BAYC,...)
ERC-1155 Tokens
Bitcoin / Bitcoin Testnet
Litecoin / Litecoin Testnet
Dogecoin / Dogecoin Testnet
Native Assets only
+ diff --git a/docs/wallet-provider/README.md b/docs/wallet-provider/README.md new file mode 100644 index 0000000..ca92d3b --- /dev/null +++ b/docs/wallet-provider/README.md @@ -0,0 +1,20 @@ +# ๐Ÿ’ป Wallet Provider + +A browser wallet like MetaMask or Phantom is a service that allows users to interact with blockchain networks through their web browsers. These wallets enable users to manage their cryptocurrencies, tokens, and digital assets in a non-custodial manner, meaning users have complete control over their private keys and funds. + +Tatum SDK simplifies the process of connecting to browser-based non-custodial wallets like MetaMask without requiring developers to have in-depth knowledge of the specific wallet interfaces. By providing a streamlined and easy-to-use integration, Tatum SDK makes it more accessible for developers to build decentralised applications (dApps) that interact with various browser wallets. + +## Video guide on Wallet Provider Integration with Metamask + +Here's a short video on how you can use Wallet Provider Submodule to integrate wallets like metamask in your web3 app, In this video we will use it create a simple web3 app that connects with Metamask and shows the connected address. + +{% embed url="https://youtu.be/hRoLik_kr0Y" %} + +Using browser non-custodial wallets offers several benefits: + +1. **Ease of Use**: Browser wallets provide a user-friendly interface for managing digital assets, making it easier for users to send, receive, and store cryptocurrencies and tokens. Additionally, browser wallets can seamlessly integrate with dApps, enabling users to interact with various blockchain services without leaving their browsers. +2. **Non-custodial Approach**: Browser wallets like MetaMask or Phantom allow users to maintain full control over their private keys and funds. This non-custodial approach offers increased security, as users are not required to trust a third party to safeguard their assets. +3. **Cross-platform Compatibility**: Browser wallets are compatible with various devices and platforms, making them accessible to many users. This cross-platform compatibility ensures users can manage their digital assets on their preferred devices, such as desktop computers, laptops, or mobile devices. +4. **Support for Multiple Networks**: Browser wallets often support multiple blockchain networks, allowing users to manage assets across different chains within a single wallet. This simplifies asset management and provides users with the flexibility to participate in various blockchain ecosystems. + +In summary, browser non-custodial wallets like MetaMask or Phantom provide a user-friendly, secure, and versatile solution for managing digital assets and interacting with dApps. Tatum SDK further simplifies the process for developers, making it easier to build applications that can connect to these wallets and offer users a seamless and efficient experience. diff --git a/docs/wallet-provider/metamask/README.md b/docs/wallet-provider/metamask/README.md new file mode 100644 index 0000000..5d736c8 --- /dev/null +++ b/docs/wallet-provider/metamask/README.md @@ -0,0 +1,2 @@ +# MetaMask + diff --git a/docs/wallet-provider/metamask/approve-the-transfer-of-a-fungible-token-like-usdt.md b/docs/wallet-provider/metamask/approve-the-transfer-of-a-fungible-token-like-usdt.md new file mode 100644 index 0000000..8fe9322 --- /dev/null +++ b/docs/wallet-provider/metamask/approve-the-transfer-of-a-fungible-token-like-usdt.md @@ -0,0 +1,77 @@ +# Approve the transfer of a fungible token like USDT + +In the context of ERC20 tokens, "approve" refers to a function in the ERC20 standard that allows a token holder to grant permission to another address (called the "spender") to transfer a specified amount of tokens on their behalf. This mechanism is useful for enabling smart contracts or other addresses to perform token transactions on behalf of the token owner without the need to transfer the tokens directly. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +In summary, approving the transfer of an ERC20 token is a way to delegate the ability to spend tokens to another address while maintaining control over the tokens and their allowance. + +### How to approve a USDT transaction for someone else with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +//This is the USDT token address +const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7' + +const txId: string = await tatum.walletProvider.metaMask.approveErc20('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5', USDT) + +console.log(txId) + +// We have prepared an approval operation of 1.5 USDT from your default connected MetaMask account to the spender - 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + //This is the USDT token address + const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7' + + const txId = await tatum.walletProvider.metaMask.approveErc20('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5', USDT); + console.log(txId); + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); + +// We have prepared an approval operation of 1.5 USDT from your default connected MetaMask account to the spender - 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request parameters + +* **`spender`** - string, address, which will be able to transfer the tokens on behalf of the owner + * Example: `"0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263"` +* **`amount`** - string, amount to be approved, always in a token currency like USDT + * Example: `"1.5"` +* **`tokenAddress`** - string, token address of a token you want to approve + * Example: `"0xdAC17F958D2ee523a2206206994597C13D831ec7"` + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/build-your-own-custom-transaction.md b/docs/wallet-provider/metamask/build-your-own-custom-transaction.md new file mode 100644 index 0000000..ee3723d --- /dev/null +++ b/docs/wallet-provider/metamask/build-your-own-custom-transaction.md @@ -0,0 +1,103 @@ +# Build your own custom transaction + +Preparing a transaction for signing via MetaMask means creating a transaction object containing essential details, such as the sender's address, recipient's address, amount to be sent, and gas fees. This transaction object is then presented to MetaMask, which securely signs the transaction using the user's private key, ensuring the transaction's authenticity and integrity before it's broadcasted to the Ethereum network. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +In summary, you can prepare any transaction, like deploying a new smart contract or interacting with any existing one. + +### How to prepare a custom transaction with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +// Prepare your payload for a signing +const payload = { + to: '0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', + amount: '0x012F', + data: '0x000......' // your custom data +} + +const txId: string = await tatum.walletProvider.metaMask.customPayload(payload) + +console.log(txId) + +// We have prepared a custom transaction from your default connected MetaMask account +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + // Prepare your payload for a signing + const payload = { + to: '0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', + amount: '0x012F', + data: '0x000......' // your custom data + }; + + const txId = await tatum.walletProvider.metaMask.customPayload(payload); + console.log(txId); + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); + + +// We have prepared a custom transaction from your default connected MetaMask account +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request interface + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +interface TxPayload { + // - The string of the address to the transaction is directed to + to?: string + + // - (optional) The string of the address the transaction is sent from + from?: string + + // - (optional) The integer of the gas provided for the transaction execution + gas?: string + + // - (optional) The integer of the gasPrice used for each paid gas encoded as hexadecimal + gasPrice?: string + + // - (optional) The integer of the value sent with this transaction encoded as hexadecimal + value?: string + + // The string of the hash of the method signature and encoded parameters, see the Ethereum Contract ABI + data?: string +} +``` +{% endcode %} + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/connect-a-wallet.md b/docs/wallet-provider/metamask/connect-a-wallet.md new file mode 100644 index 0000000..17316c7 --- /dev/null +++ b/docs/wallet-provider/metamask/connect-a-wallet.md @@ -0,0 +1,65 @@ +# Connect a wallet + +Connecting to a MetaMask wallet means establishing a link between a decentralized application (dApp) or a web-based service and your MetaMask wallet. MetaMask is a browser extension that acts as a cryptocurrency wallet and a gateway to blockchain-based applications on the Ethereum network. + +When you connect to a MetaMask wallet, you're granting the dApp or web service permission to access your wallet's Ethereum address and interact with the Ethereum blockchain on your behalf. This may include actions such as signing transactions, sending tokens, or participating in decentralised finance (DeFi) protocols. This connection enables seamless interaction between users and blockchain applications while keeping private keys secure within the wallet. + +{% embed url="https://codepen.io/tatum-devrel/pen/xxQmQOZ" %} + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to get connect to MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to check if there is a MetaMask extension available and get the default address from it. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const metamaskAccount: string = await tatum.walletProvider.metaMask.connect() + +console.log(metamaskAccount) +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const metamaskAccount = await tatum.walletProvider.metaMask.connect(); + console.log(metamaskAccount); + } catch (error) { + console.error("Error fetching default account from MetaMask:", error); + } +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +
+ +Expected Response + +```json5 +0xF64E82131BE01618487Da5142fc9d289cbb60E9d +``` + +
diff --git a/docs/wallet-provider/metamask/create-your-fungible-token.md b/docs/wallet-provider/metamask/create-your-fungible-token.md new file mode 100644 index 0000000..9884bcb --- /dev/null +++ b/docs/wallet-provider/metamask/create-your-fungible-token.md @@ -0,0 +1,127 @@ +# Create your Fungible Token + +MetaMask, a widely adopted Ethereum wallet, enables users to manage their Ether and ERC-20 tokens while providing a convenient interface for interacting with decentralized applications (dApps) and smart contracts. With the increasing significance of fungible tokens in the digital asset landscape, MetaMask offers a simple and accessible way to create your own ERC-20 token contract, opening the door to numerous possibilities and benefits. + +#### Why create an ERC-20 token contract? + +Fungible tokens like ERC-20 tokens are digital assets that can be exchanged on a one-to-one basis, making them an ideal choice for various applications, such as: + +* Creating a digital currency for your project or platform +* Launching an initial coin offering (ICO) or token sale event +* Developing a reward or loyalty program for your business +* Establishing a decentralized governance system for your community + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to create your Fungible token with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% embed url="https://codepen.io/tatum-devrel/pen/rNQoQWN" %} + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +
// yarn add @tatumio/tatum
+import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+// We have prepared a deploy transaction of ERC-20 contract from your default connected MetaMask account to the recipient
+// Result is a transaction IF of a broadcasted transaction
+const txId: string = await tatum.walletProvider.metaMask.createFungibleToken({
+    name: 'Your Token Name',
+    symbol: 'Your Token Symbol',
+    decimals: 18,
+    initialSupply: 1_000_000})
+
+console.log(txId)
+
+// Once the transaction is included in a block, you can get the contract address of the newly created collection
+const contractAddress: string | null = await tatum.rpc.getContractAddress(txId)
+console.log(contractAddress)
+
+{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + // We have prepared a deploy transaction of ERC-20 contract from your default connected MetaMask account to the recipient + // Result is a transaction IF of a broadcasted transaction + const txId = await tatum.walletProvider.metaMask.createFungibleToken({ + name: 'Your Token Name', + symbol: 'Your Token Symbol', + decimals: 18, + initialSupply: 1_000_000}) + + console.log(txId); + + // Once the transaction is included in a block, you can get the contract address of the newly created collection + const contractAddress: string | null = await tatum.rpc.getContractAddress(txId) + console.log(contractAddress) + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request object parameters + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export interface CreateFungibleToken { + /** + * Name of the token. + */ + name: string + /** + * Symbol of the token. + */ + symbol: string + /** + * Number of decimals of the token. Defaults to 18. + */ + decimals?: number + /** + * Total supply of the token. + */ + initialSupply: string + /** + * (Optional) Address of the initial holder of the token. Defaults to the connected MetaMask account. + */ + initialHolder?: string + /** + * (Optional) Address of the admin of the token. Defaults to the connected MetaMask account. Admin can add new minters and pausers. + */ + admin?: string + /** + * (Optional) Address of the minter of the token. Defaults to the connected MetaMask account. Minters can mint new tokens. + */ + minter?: string + /** + * (Optional) Address of the pauser of the token. Defaults to the connected MetaMask account. Pausers can pause and unpause the token transactions. + */ + pauser?: string +} + +``` +{% endcode %} + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/create-your-nft-collection.md b/docs/wallet-provider/metamask/create-your-nft-collection.md new file mode 100644 index 0000000..73af4bf --- /dev/null +++ b/docs/wallet-provider/metamask/create-your-nft-collection.md @@ -0,0 +1,106 @@ +# Create your NFT Collection + +MetaMask is a widely used Ethereum wallet that allows users to manage their Ether and ERC-20 tokens. It also provides an interface for interacting with decentralized applications (dApps) and smart contracts. With the growing popularity of non-fungible tokens (NFTs), you can now leverage MetaMask to create your very own NFT collection contract, opening up a world of opportunities and benefits. + +### Why create an NFT collection contract? + +NFTs represent unique digital assets that can't be exchanged on a one-to-one basis, differentiating them from other cryptocurrencies. Creating an NFT collection contract allows you to mint, trade, and showcase a series of unique digital items, such as art, collectibles, virtual real estate, or game items. These contracts facilitate the management of your NFT collection, defining rules for minting, transferring, and managing the ownership of your tokens. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to create your NFT collection with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% embed url="https://codepen.io/tatum-devrel/pen/VwVqVKp" %} + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +
// yarn add @tatumio/tatum
+import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+// We have prepared a deploy transaction of ERC-721 contract from your default connected MetaMask account to the recipient
+// Result is a transaction IF of a broadcasted transaction
+const txId: string = await tatum.walletProvider.metaMask.createNftCollection({
+    name: 'Your Collection Name',
+    symbol: 'Your Collection Symbol'})
+
+console.log(txId)
+
+// Once the transaction is included in a block, you can get the contract address of the newly created collection
+const contractAddress: string | null = await tatum.rpc.getContractAddress(txId)
+console.log(contractAddress)
+
+{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + // We have prepared a deploy transaction of ERC-721 contract from your default connected MetaMask account to the recipient + // Result is a transaction IF of a broadcasted transaction + const txId = await tatum.walletProvider.metaMask.createNftCollection({ + name: 'Your Collection Name', + symbol: 'Your Collection Symbol'}); + + console.log(txId); + + // Once the transaction is included in a block, you can get the contract address of the newly created collection + const contractAddress: string | null = await tatum.rpc.getContractAddress(txId) + console.log(contractAddress) + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request object parameters + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export interface CreateNftCollection { + /** + * Name of the token. + */ + name: string + /** + * Symbol of the token. + */ + symbol: string + /** + * base URI of the collection, defaults to empty string. Base URI is prepended to the token ID in the token URI. + */ + baseURI?: string + /** + * (Optional) Address of the admin of the token. Defaults to the connected MetaMask account. Admin can add new minters and pausers. + */ + author?: string + /** + * (Optional) Address of the minter of the token. Defaults to the connected MetaMask account. Minters can mint new tokens. + */ + minter?: string +} + +``` +{% endcode %} + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/create-your-nft-erc-1155-multitoken-collection.md b/docs/wallet-provider/metamask/create-your-nft-erc-1155-multitoken-collection.md new file mode 100644 index 0000000..ab2d7ca --- /dev/null +++ b/docs/wallet-provider/metamask/create-your-nft-erc-1155-multitoken-collection.md @@ -0,0 +1,94 @@ +# Create your NFT (ERC-1155 MultiToken) Collection + +MetaMask is a widely used Ethereum wallet that allows users to manage their Ether and ERC-20 tokens. It also provides an interface for interacting with decentralized applications (dApps) and smart contracts. With the growing popularity of non-fungible tokens (NFTs), you can now leverage MetaMask to create your very own NFT collection contract, opening up a world of opportunities and benefits. + +### Why create an NFT collection contract? + +NFTs represent unique digital assets that can't be exchanged on a one-to-one basis, differentiating them from other cryptocurrencies. Creating an NFT collection contract allows you to mint, trade, and showcase a series of unique digital items, such as art, collectibles, virtual real estate, or game items. These contracts facilitate the management of your NFT collection, defining rules for minting, transferring, and managing the ownership of your tokens. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to create your NFT (ERC-1155 MultiToken) collection with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% embed url="https://codepen.io/tatum-devrel/pen/dyQwQOv" %} + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +
// yarn add @tatumio/tatum
+import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
+
+const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
+
+// We have prepared a deploy transaction of ERC-1155 contract from your default connected MetaMask account to the recipient
+// Result is a transaction IF of a broadcasted transaction
+const txId: string = await tatum.walletProvider.metaMask.createErc1155NftCollection()
+
+console.log(txId)
+
+// Once the transaction is included in a block, you can get the contract address of the newly created collection
+const contractAddress: string | null = await tatum.rpc.getContractAddress(txId)
+console.log(contractAddress)
+
+{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + // We have prepared a deploy transaction of ERC-1155 contract from your default connected MetaMask account to the recipient + // Result is a transaction IF of a broadcasted transaction + const txId = await tatum.walletProvider.metaMask.createErc1155NftCollection(); + + console.log(txId); + + // Once the transaction is included in a block, you can get the contract address of the newly created collection + const contractAddress: string | null = await tatum.rpc.getContractAddress(txId) + console.log(contractAddress) + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request parameters + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +export interface CreateErc1155NftCollection { + /** + * base URI of the collection, defaults to empty string. Base URI is prepended to the token ID in the token URI. + */ + baseURI?: string + /** + * (Optional) Address of the admin of the token. Defaults to the connected MetaMask account. Admin can add new minters and pausers. + */ + author?: string + /** + * (Optional) Address of the minter of the token. Defaults to the connected MetaMask account. Minters can mint new tokens. + */ + minter?: string +} + +``` +{% endcode %} + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/transfer-fungible-tokens-like-usdt.md b/docs/wallet-provider/metamask/transfer-fungible-tokens-like-usdt.md new file mode 100644 index 0000000..e0e47b8 --- /dev/null +++ b/docs/wallet-provider/metamask/transfer-fungible-tokens-like-usdt.md @@ -0,0 +1,79 @@ +# Transfer fungible tokens like USDT + +Preparing a transaction for signing via MetaMask means creating a transaction object containing essential details, such as the sender's address, recipient's address, amount to be sent, and gas fees. This transaction object is then presented to MetaMask, which securely signs the transaction using the user's private key, ensuring the transaction's authenticity and integrity before it's broadcasted to the Ethereum network. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to perform a USDT transaction with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumcom/js`) to prepare, sign and broadcast the transaction using MetaMask. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumcom/js +import {TatumSDK, Network, Ethereum} from '@tatumcom/js' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +//This is the USDT token address +const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7' + +const txId: string = await tatum.walletProvider.metaMask.transferErc20('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5', USDT) + +console.log(txId) + +// We have prepared a transfer of 1.5 USDT from your default connected MetaMask account to the recipient of 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumcom/js +const { TatumSDK, Network } = require("@tatumcom/js"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + //This is the USDT token address + const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7' + + const txId = await tatum.walletProvider.metaMask.transferErc20('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5', USDT); + console.log(txId); + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); + +// We have prepared a transfer of 1.5 USDT from your default connected MetaMask account to the recipient of 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + + +{% embed url="https://codepen.io/Martin-Zemanek/pen/bGQeQaZ" %} + +### Request parameters + +* **`recipient`** - string, recipient of your transaction + * Example: `"0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263"` +* **`amount`** - string, amount to be sent, always in a token currency like USDT + * Example: `"1.5"` +* **`tokenAddress`** - string, token address of a token you want to transfer + * Example: `"0xdAC17F958D2ee523a2206206994597C13D831ec7"` + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/transfer-native-assets.md b/docs/wallet-provider/metamask/transfer-native-assets.md new file mode 100644 index 0000000..7485af6 --- /dev/null +++ b/docs/wallet-provider/metamask/transfer-native-assets.md @@ -0,0 +1,70 @@ +# Transfer native assets + +Preparing a transaction for signing via MetaMask means creating a transaction object containing essential details, such as the sender's address, recipient's address, amount to be sent, and gas fees. This transaction object is then presented to MetaMask, which securely signs the transaction using the user's private key, ensuring the transaction's authenticity and integrity before it's broadcasted to the Ethereum network. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +{% embed url="https://codepen.io/tatum-devrel/pen/bGQOQej" %} + +### How to perform a transaction with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumio/tatum`) to prepare, sign and broadcast the transaction using MetaMask. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const txId: string = await tatum.walletProvider.metaMask.transferNative('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5') + +console.log(txId) + +// We have prepared a native transfer of 1.5 ETH from your default connected MetaMask account to the recipient of 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const txId = await tatum.walletProvider.metaMask.transferNative('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '1.5'); + console.log(txId); + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); + +// We have prepared a native transfer of 1.5 ETH from your default connected MetaMask account to the recipient of 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +// Result is a transaction IF of a broadcasted transaction +``` +{% endcode %} +{% endtab %} +{% endtabs %} + +### Request parameters + +* **`recipient`** - string, recipient of your transaction + * Example: `"0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263"` +* **`amount`** - string, amount to be sent, always in native currency like ETH for Ethereum or MATIC for Polygon + * Example: `"1.5"` + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/docs/wallet-provider/metamask/transfer-your-nft.md b/docs/wallet-provider/metamask/transfer-your-nft.md new file mode 100644 index 0000000..a04f8d1 --- /dev/null +++ b/docs/wallet-provider/metamask/transfer-your-nft.md @@ -0,0 +1,84 @@ +# Transfer your NFT + +An NFT, or Non-Fungible Token, is a unique digital asset that represents ownership or proof of authenticity for a specific item, like a piece of digital artwork, a collectible, or even a virtual property. Transferring an NFT means changing the ownership of that digital item from one person to another. + +Imagine you have a one-of-a-kind digital trading card that you'd like to give to a friend. To do this, you would initiate a transfer, which is similar to handing over a physical item to someone else. In the digital world, this transfer process is recorded on a blockchain, a secure and transparent digital ledger that keeps track of every transaction made. + +When you transfer an NFT, you're essentially updating the blockchain record to show that your friend is now the new owner of the digital trading card. Once the transfer is complete, your friend has full control over the NFT and can choose to keep it, sell it, or trade it with others. This process ensures that ownership is securely and transparently tracked, preventing counterfeiting or unauthorized duplication of the digital item. + +{% hint style="info" %} +MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development. +{% endhint %} + +### How to perform an NFT transfer with MetaMask from your browser-based application + +Use the TatumSDK (`@tatumcom/js`) to prepare, sign and broadcast the transaction using MetaMask. + +{% hint style="info" %} +You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them. +{% endhint %} + +{% tabs %} +{% tab title="TypeScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +//This is the BoredApeYachtClub NFT token address +const BAYC = '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D' + +const txId: string = await tatum.walletProvider.metaMask.transferNft('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '123', BAYC) + +console.log(txId) + +// We have prepared a transfer of NFT BAYC#123 from your default connected MetaMask account to the recipient - 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +``` +{% endcode %} +{% endtab %} + +{% tab title="JavaScript" %} +{% code overflow="wrap" lineNumbers="true" %} +```javascript +// Install with: npm install @tatumio/tatum +const { TatumSDK, Network } = require("@tatumio/tatum"); + +(async () => { + try { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + //This is the BoredApeYachtClub NFT token address + const BAYC = '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D' + + const txId = await tatum.walletProvider.metaMask.transferNft('0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263', '123', BAYC); + console.log(txId); + } catch (error) { + console.error("Error signing a transaction using MetaMask:", error); + } +})(); + +// We have prepared a transfer of NFT BAYC#123 from your default connected MetaMask account to the recipient - 0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263 +// Result is a transaction IF of a broadcasted transaction +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + + +{% embed url="https://codepen.io/Martin-Zemanek/pen/QWJEBJW" %} + +### Request parameters + +* **`recipient`** - string, recipient of your transaction + * Example: `"0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263"` +* **`tokenId`** - string, token ID to be sent, always in a token currency like USDT + * Example: `"1.5"` +* **`tokenAddress`** - string, token address of a NFT collection you want to transfer + * Example: `"0xdAC17F958D2ee523a2206206994597C13D831ec7"` + +### Response + +* **txId** - string, transaction hash of signed and broadcasted transaction + * Example: `"0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"` diff --git a/learn-blockchain/basics/README.md b/learn-blockchain/basics/README.md new file mode 100644 index 0000000..2f3dac3 --- /dev/null +++ b/learn-blockchain/basics/README.md @@ -0,0 +1,2 @@ +# Basics + diff --git a/learn-blockchain/basics/what-are-transactions/README.md b/learn-blockchain/basics/what-are-transactions/README.md new file mode 100644 index 0000000..5a8dba3 --- /dev/null +++ b/learn-blockchain/basics/what-are-transactions/README.md @@ -0,0 +1,15 @@ +# What are Transactions? + +At its most basic level, a transaction is the exchange of value between two parties. In the context of blockchain technology, a transaction is a digital record of this exchange of value, which is recorded and verified on a blockchain network. Let's explore some of the key components of a transaction and how it works. ๐Ÿ’ฐ + +๐Ÿ’ณ Inputs and Outputs: A transaction on a blockchain network typically consists of inputs and outputs. The inputs represent the funds being spent, while the outputs represent where those funds are going. Each input and output is represented by a specific address on the network. + +๐Ÿ”’ Signatures: To ensure the security and validity of a transaction, each input must be signed by the sender using a private key. This signature is used to verify that the transaction is legitimate and that the sender has authorised the transfer of funds. + +๐Ÿ“ˆ Transaction Fees: When a transaction is initiated on a blockchain network, a small fee is charged to the sender to incentivise network participants to validate the transaction. The size of the fee is determined by network congestion and the complexity of the transaction. + +๐Ÿ•ฐ๏ธ Confirmation: After a transaction is initiated, it must be validated and confirmed by multiple computers on the network. This validation process ensures that the transaction is legitimate and that the funds are being transferred from the sender to the intended recipient. + +๐Ÿ” Transparency: One of the key benefits of blockchain technology is its transparency. Because each transaction is recorded on a public ledger, anyone can view the details of a transaction and verify its legitimacy. + +In conclusion, transactions are a fundamental part of blockchain technology, allowing for the secure and transparent exchange of value between two parties. While the process may seem complex, understanding the key components of a transaction can help you better navigate the world of blockchain and cryptocurrency. ๐Ÿ’ป diff --git a/learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md b/learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md new file mode 100644 index 0000000..229281c --- /dev/null +++ b/learn-blockchain/basics/what-are-transactions/what-are-internal-transactions.md @@ -0,0 +1,13 @@ +# What are Internal Transactions + +Internal transactions are ๐Ÿ’Ž another crucial aspect of blockchain technology that play a vital role in facilitating transactions and maintaining the integrity of the network. Internal transactions occur when tokens are transferred between two addresses on the same blockchain network. ๐Ÿ” + +These transactions are different from external transactions, which involve the transfer of tokens between different blockchain networks or to external addresses outside of the network. ๐ŸŒ + +Internal transactions can be initiated by a variety of actors on the network, including individual users, smart contracts, and decentralised applications (dApps). ๐Ÿ’ป Smart contracts are particularly important in facilitating internal transactions, as they can execute complex transactions automatically based on pre-determined conditions. + +One of the primary benefits of internal transactions is that they are typically faster and cheaper than external transactions, as they do not require the same level of validation and verification as external transactions. This makes them ideal for small transactions and for sending tokens between different wallets or accounts on the same network. ๐Ÿ’ฐ + +In addition to their speed and efficiency, internal transactions are also transparent and secure. Since all transactions on a blockchain network are publicly visible and recorded on a distributed ledger, internal transactions can be easily traced and audited. This helps to prevent fraud and other forms of malicious activity on the network. ๐Ÿ”’ + +Overall, internal transactions are a fundamental component of blockchain technology and are critical to the functioning of many blockchain networks. Whether you are a developer, investor, or enthusiast, understanding the role of internal transactions is essential for navigating the complex and rapidly evolving world of blockchain technology. ๐Ÿš€ diff --git a/learn-blockchain/basics/what-are-transactions/what-are-the-reasons-a-transaction-fails.md b/learn-blockchain/basics/what-are-transactions/what-are-the-reasons-a-transaction-fails.md new file mode 100644 index 0000000..705cd3c --- /dev/null +++ b/learn-blockchain/basics/what-are-transactions/what-are-the-reasons-a-transaction-fails.md @@ -0,0 +1,15 @@ +# What are the reasons a transaction fails? + +One of the benefits of blockchain technology is its ability to facilitate secure and transparent transactions. However, like any technology, blockchain is not perfect, and transactions can sometimes fail for a variety of reasons. Let's explore some of the most common reasons why a transaction might fail on a blockchain network. ๐Ÿง + +๐Ÿ”ด Insufficient Funds: One of the most common reasons for a failed transaction is that the sender does not have enough funds in their account to cover the transaction fees. When a transaction is initiated on a blockchain network, a small fee is charged to the sender to incentivize network participants to validate the transaction. If the sender does not have enough funds to cover the fees, the transaction will fail. + +๐Ÿ”ด Network Congestion: Another reason for failed transactions is network congestion. When a blockchain network is congested with a high volume of transactions, it can take longer for transactions to be validated and added to the blockchain. In some cases, transactions may time out or fail altogether if the network is too congested. + +๐Ÿ”ด Invalid Address: If a sender enters an incorrect or invalid address when initiating a transaction, the transaction will fail. It's important to double-check the address before sending any funds to ensure that the transaction goes through. + +๐Ÿ”ด Gas Limit Too Low: Each transaction on a blockchain network requires a certain amount of "gas," which is a measure of computational power needed to execute the transaction. If the gas limit set by the sender is too low, the transaction will fail. + +๐Ÿ”ด Smart Contract Issues: Some transactions involve the use of smart contracts, which are self-executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code. If there is an error in the smart contract code, the transaction may fail. + +In conclusion, transactions can fail on a blockchain network for a variety of reasons, including insufficient funds, network congestion, invalid addresses, low gas limits, and smart contract issues. While these failures can be frustrating, it's important to remember that blockchain technology is still in its early stages, and as the technology continues to develop, many of these issues will be resolved. If you're experiencing a failed transaction, be patient, and double-check the details before trying again. ๐Ÿ’ป diff --git a/learn-blockchain/basics/what-is-a-token-on-blockchain/README.md b/learn-blockchain/basics/what-is-a-token-on-blockchain/README.md new file mode 100644 index 0000000..cc058b1 --- /dev/null +++ b/learn-blockchain/basics/what-is-a-token-on-blockchain/README.md @@ -0,0 +1,29 @@ +# What is a Token on Blockchain? + +Tokens are digital assets that are created and managed on a blockchain network. They can be broadly classified into two types: native tokens and non-native tokens. + +[Native tokens](what-are-native-tokens.md) are created when a blockchain network is launched and are integral to the underlying protocol of the blockchain. They are also known as protocol tokens and are used to facilitate transactions on that network. Examples of native tokens include Bitcoin (BTC), Ether (ETH), and Binance Coin (BNB). + +Non-native tokens, on the other hand, are created through smart contracts and can be used to represent specific assets or utility on a blockchain network. They can be further classified into fungible, non-fungible tokens (NFTs) & multi tokens. + +๐Ÿ”ธ [Fungible tokens](what-are-fungible-tokens.md): Fungible tokens are identical to each other and are interchangeable. Each token holds the same value and can be exchanged with any other token of the same type. Examples of fungible tokens include stable coins like Tether (USDT) and MakerDAO (DAI), which are pegged to the value of a specific asset or currency. + +๐Ÿ”ธ [Non-fungible tokens (NFTs)](what-are-non-fungible-tokens.md): NFTs are unique and indivisible tokens that represent a specific asset or item. Each NFT is one-of-a-kind and holds a specific value. Examples of NFTs include digital art, collectibles, and in-game items. + +๐Ÿ”ธ [Multitokens](what-are-multitokens.md): Multitokens are a type of digital asset that contain multiple other tokens within them. They provide a way to bundle multiple tokens together into a single asset, making it easier to manage and trade multiple tokens at once. Multitokens can contain both fungible and non-fungible tokens, as well as other multitokens, and can have a variety of use cases, including investment, trading, and DeFi. + +Tokens can have a variety of use cases on their respective blockchain networks, including: + +๐Ÿ”ธ Representing assets: Tokens can be used to represent a variety of assets, such as real estate, precious metals, or even other cryptocurrencies. + +๐Ÿ”ธ Utility tokens: Some tokens are designed specifically for use within a particular decentralised application or dApp. These tokens are often used to pay for services or to incentivise network participants to contribute to the network. + +๐Ÿ”ธ Governance tokens: Some tokens are used for governance purposes, allowing token holders to vote on important network decisions, such as protocol upgrades and changes. + +๐Ÿ”ธ Security tokens: Security tokens are tokens that are backed by real-world assets, such as stocks or bonds. These tokens are regulated by securities laws and are subject to the same regulations as traditional securities. + +One of the primary benefits of tokens is that they allow for the creation of decentralised economies and ecosystems. By creating tokens that represent specific assets or utility on a blockchain network, developers and entrepreneurs can incentivise network participants to contribute to the network and to help grow the ecosystem. + +Tokens also provide a way for investors to participate in the growth of blockchain networks and dApps. By investing in tokens, investors can gain exposure to the potential upside of a particular network or project. + +Overall, tokens are a powerful tool for building decentralised economies and ecosystems on blockchain networks. Whether you are a developer, investor, or enthusiast, understanding the role of tokens is essential for navigating the complex and rapidly evolving world of blockchain technology. ๐Ÿ’ป๐ŸŒฑ diff --git a/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md new file mode 100644 index 0000000..98c9cf7 --- /dev/null +++ b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-fungible-tokens.md @@ -0,0 +1,11 @@ +# What are Fungible Tokens + +Fungible tokens are a type of ๐Ÿ’ฐ digital asset that are identical to each other and can be exchanged for one another. Each token holds the same value and can be exchanged with any other token of the same type. Examples of fungible tokens include stable coins like Tether (USDT) and MakerDAO (DAI), which are pegged to the value of a specific asset or currency. + +Fungible tokens are designed to be interchangeable, which means that one token can be exchanged for another token of the same type without any loss of value. This makes them ideal for use as a currency or for representing assets that are uniform and interchangeable, such as ๐Ÿ’ฐ gold or ๐Ÿ›ข๏ธ oil. + +One of the primary benefits of fungible tokens is their divisibility. Fungible tokens can be divided into smaller units, which allows for more granular transactions and enables micro-transactions on a blockchain network. For example, a single Bitcoin can be divided into 100 million satoshi's, which allows for very small transactions to take place on the Bitcoin network. ๐Ÿ’ธ + +Fungible tokens also provide a high degree of liquidity, which means that they can be easily bought and sold on ๐Ÿ’น cryptocurrency exchanges. This allows for the creation of markets and trading pairs, which can help to determine the value of a particular fungible token. + +Overall, fungible tokens are an important component of the blockchain ecosystem, providing a way to represent and exchange assets in a uniform and standardised way. Whether you are a developer, investor, or enthusiast, understanding the role of fungible tokens is essential for navigating the complex and rapidly evolving world of blockchain technology. ๐Ÿ’ป๐ŸŒฑ diff --git a/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md new file mode 100644 index 0000000..f7b32db --- /dev/null +++ b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-multitokens.md @@ -0,0 +1,19 @@ +# What are MultiTokens? + +Multitokens are a type of ๐ŸŽ digital asset that contain multiple other tokens within them. They are designed to provide a way to bundle multiple tokens together into a single asset, making it easier to manage and trade multiple tokens at once. + +Multitokens can contain both fungible and non-fungible tokens, as well as other multitokens. This allows for the creation of complex digital assets that represent multiple tokens and assets on a blockchain network. ๐ŸŒ + +One of the primary benefits of multitokens is their ability to provide diversification within a single asset. By bundling multiple tokens together, multitokens can help to reduce risk and increase exposure to different types of assets and tokens. + +Multitokens are created through smart contracts and are stored on a blockchain network, which ensures that they are tamper-proof and transparent. This allows for the creation of trustless and decentralised marketplaces for multitokens, where buyers and sellers can transact with each other without the need for intermediaries. ๐Ÿค + +Multitokens can have a variety of use cases, including: + +๐Ÿ”ธ Investment: Multitokens can be used to create diversified investment portfolios that span multiple blockchain networks and asset classes. + +๐Ÿ”ธ Trading: Multitokens can be traded on cryptocurrency exchanges, providing a way to trade multiple tokens at once and to diversify trading strategies. + +๐Ÿ”ธ Decentralised finance (DeFi): Multitokens can be used as collateral or liquidity in DeFi protocols, allowing for more efficient and diverse use of assets in the DeFi ecosystem. + +Overall, multitokens are a powerful tool for creating diversified digital assets and for navigating the complex and rapidly evolving world of blockchain technology. Whether you are a developer, investor, or enthusiast, understanding the role of multitokens is essential for staying ahead of the curve in the blockchain industry. ๐Ÿ’ป๐ŸŒฑ diff --git a/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md new file mode 100644 index 0000000..3d3fc26 --- /dev/null +++ b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-native-tokens.md @@ -0,0 +1,19 @@ +# What are Native Tokens? + +Native tokens are a type of digital token that are created and used on a specific blockchain network. These tokens are usually created during the initial launch of a blockchain network and are used to facilitate transactions on that network. They are also known as protocol tokens, since they are integral to the underlying protocol of the blockchain. + +One of the most well-known examples of a native token is Ether (ETH), which is the native token of the Ethereum blockchain. ETH is used to pay for transaction fees and to incentivise network participants to secure and validate transactions. It can also be used as a currency to purchase goods and services, much like Bitcoin. + +Native tokens can have a variety of uses on their respective blockchain networks, including: + +๐Ÿ”ธ Payment for transaction fees: Native tokens are used to pay for transaction fees on the network. This ensures that the network remains secure and that transactions are processed in a timely manner. + +๐Ÿ”ธ Incentivising network participants: Native tokens are often used to incentivize network participants to contribute to the network. For example, miners who validate transactions on the network are rewarded with native tokens. + +๐Ÿ”ธ Governance: Native tokens can also be used for governance purposes, allowing token holders to vote on important network decisions, such as protocol upgrades and changes. + +๐Ÿ”ธ Staking: Some native tokens can be staked, or locked up, in order to secure the network and earn rewards. + +It's important to note that not all tokens on a blockchain network are native tokens. In fact, many blockchain networks have multiple types of tokens, each with their own specific use cases. For example, the Ethereum network has ERC-20 tokens, which are used for creating and managing smart contracts. + +In conclusion, native tokens are an important part of many blockchain networks, providing the backbone for transactions and incentivising network participants to contribute to the network. If you're interested in blockchain technology, learning more about native tokens is a great place to start! ๐Ÿ’ป diff --git a/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md new file mode 100644 index 0000000..e3ae434 --- /dev/null +++ b/learn-blockchain/basics/what-is-a-token-on-blockchain/what-are-non-fungible-tokens.md @@ -0,0 +1,13 @@ +# What are Non Fungible Tokens? + +Non-fungible tokens (NFTs) are a type of ๐Ÿ’Ž digital asset that are unique and indivisible. Each NFT is one-of-a-kind and holds a specific value. Examples of NFTs include ๐ŸŽจ digital art, ๐ŸŽฎ collectibles, and in-game items. + +Unlike fungible tokens, which are interchangeable with one another, each NFT holds a unique set of attributes and characteristics that set it apart from all other tokens. This uniqueness is what makes NFTs valuable and desirable to collectors and enthusiasts. + +NFTs are created through smart contracts and are stored on a blockchain network, which ensures that they are tamper-proof and transparent. This allows for the creation of trustless and decentralised marketplaces for NFTs, where buyers and sellers can transact with each other without the need for intermediaries. ๐Ÿค + +One of the primary benefits of NFTs is their ability to represent ownership and provenance of digital assets. Since each NFT is unique and indivisible, it can be used to represent ownership of a specific piece of digital art or a rare collectible. This allows creators and collectors to monetise their work and to create new revenue streams. ๐Ÿ’ฐ + +NFTs can also be used to create new types of decentralised applications (dApps) and games. For example, NFTs can be used to represent in-game items that have real-world value, which allows for the creation of new types of gaming economies and ecosystems. ๐ŸŽฎ + +Overall, NFTs are a powerful tool for representing ownership and provenance of digital assets, creating new types of decentralised economies and ecosystems, and unlocking new revenue streams for creators and collectors. Whether you are a developer, investor, or enthusiast, understanding the role of NFTs is essential for navigating the complex and rapidly evolving world of blockchain technology. ๐Ÿ’ป๐ŸŒฑ diff --git a/learn-blockchain/basics/what-is-blockchain.md b/learn-blockchain/basics/what-is-blockchain.md new file mode 100644 index 0000000..b30cf04 --- /dev/null +++ b/learn-blockchain/basics/what-is-blockchain.md @@ -0,0 +1,13 @@ +# What is Blockchain? + +Blockchain technology is a hot topic these days, but what exactly is it and how does it work? ๐Ÿค” + +At its core, a blockchain is a digital ledger that records and verifies transactions. Each block in the chain contains information about a transaction, such as the time it occurred, the parties involved, and the details of the exchange. Once a block is added to the chain, it cannot be altered or deleted, creating a permanent and unalterable record of the transaction. ๐Ÿ”’ + +The beauty of blockchain technology is that it allows for secure and transparent transactions between two parties without the need for a central authority, such as a bank or government. This is because the ledger is stored across a network of computers, making it difficult for any one person or entity to manipulate the information. ๐Ÿ‘ฅ + +To ensure the security of the blockchain, each block is verified by multiple computers on the network before it is added to the chain. This makes it virtually impossible for any one person or entity to alter the ledger or commit fraud. ๐Ÿ” + +One of the most well-known applications of blockchain technology is cryptocurrency, such as Bitcoin. However, blockchain has the potential to be used in many other areas, such as supply chain management, voting systems, and digital identity verification. ๐Ÿ’ฐ + +In conclusion, blockchain technology is a powerful tool that has the potential to revolutionize the way we conduct transactions and manage data. Whether you're a business owner, developer, or simply interested in the future of technology, blockchain is definitely something worth learning more about! ๐Ÿ’ป diff --git a/pricing.md b/pricing.md new file mode 100644 index 0000000..d0d3cf8 --- /dev/null +++ b/pricing.md @@ -0,0 +1,66 @@ +--- +description: Detailed pricing information about the Tatum Products +--- + +# ๐Ÿ’ต Pricing + +**As a developer you can start using Tatum for free,** [**register here**](https://dashboard.tatum.io) **to start using for free, and when you upgrade here's detailed information on the pricing of different products.** + +## Products + +Here's the list of things that your account gets charged for : + +1. Sent Notifications: This is cost that you occur for every notification that is sent to you. Read more about the offering [here](docs/notifications/). +2. API Calls: This is the cost/per API call, and includes the following submodules: + 1. [NFTs Submodule](docs/nfts/) + 2. [Fungible Token](docs/fungible-tokens/) + 3. [Fee Estimation](docs/fee-estimation/) + 4. [Wallet Address Operations](docs/wallet-address-operations/) + 5. [Wallet Provider](docs/wallet-provider/) + 6. v3 [Blockchain Data API](https://apidoc.tatum.io/tag/Data-API) + 7. v3 [Blockchain Utility Calls](https://apidoc.tatum.io/tag/Algorand) + 8. v3 [Virtual Accounts](https://apidoc.tatum.io/tag/Account) +3. RPC Calls: This product includes the calls to full node functions in [RPC Submodule](docs/rpc/) and the [RPC Access via v3 product](https://apidoc.tatum.io/tag/Node-RPC), and is priced as cost/per RPC call. +4. Archive Calls: This product includes calls to the archive node in [RPC Submodule](docs/rpc/) and the [RPC Access via v3 product](https://apidoc.tatum.io/tag/Node-RPC), and is priced as cost/per RPC call. + +
+ +Other v3 Products with gas costs** + +1. v3 NFT Express: This feature allows you to mint NFTs on different chains, +2. v3 Gas Pump: This feature allows you to pay gas fees for your or your user's operations in credits for v3, learn more about the feature [here](https://apidoc.tatum.io/tag/Gas-pump). +3. v3 Deployments: This feature allows you to deploy a smart contract. Read more about the feature [here](https://apidoc.tatum.com/#tag/Smart-Contract-interactions). +4. v3 Custodial Wallet: This feature allows you to create a custodial wallet and do transactions with it (requires gas cost). You can read more about the feature [here](https://apidoc.tatum.io/tag/Custodial-managed-wallets). + +
+ +## Costs breakdown for the features + +> Note: If you haven't migrated your old API keys to new v4 API keys, you can do that in your dashboard to available lower prices and our new flexible **Pay As You Go pricing**, extended feature set, usage and more. Visit your [dashboard](https://dashboard.tatum.io) to migrate now. + +> Note: **Cost + gas\*\*** means that you pay gas cost in dollars only when a specific function in the product requires a gas operation. To know more about those specific functions you can visit the product documentation page. + +> Trivia: Full node RPC access via v4 keys is half the cost than the industry standard and Archive RPC access is 2.5 lower the cost. + +
FeatureFlat CostScaling CostCost
Notifications$0.00097 / sent notification$0.00087 / sent notification$0.00087 / sent notification
API Calls$0.00000975 / sent call$0.0000087 / sent call$0.0000087 / call
RPC Calls$0.00000975 / sent call$0.0000087 / sent call$0.0000087 / call
Archive Calls$0.000195 / sent call$0.000174 / sent call$0.0000087 / call
v3 RPC Calls$0.0000195 / sent call$0.0000174 / sent call
v3 Archive Calls$0.0004875 / sent call$0.000435 / sent call
NFT Express,
Gas Pump, Deployments, Custodial Wallet,
$0.00000975 / sent call + gas**$0.0000087 / sent call + gas**
+ +**Note:** after $39 worth of usage we charge you the scaling cost for the specific product. + +## What can $39 get you? + +
+ +Case 1 : When you just use API calls & RPC Calls. + +In this case you get 4 Million API calls. + +
+ +
+ +Case 2 : When you use API calls, RPC Calls & a v3 product with gas costs** + +In this case you get 4 Million calls + you will be charged the gas cost in dollars, which you can track in the usage section in the [dashboard here](https://dashboard.tatum.io/usage). + +
+ diff --git a/sdk/get-started-with-tatum-sdk.md b/sdk/get-started-with-tatum-sdk.md new file mode 100644 index 0000000..23fefce --- /dev/null +++ b/sdk/get-started-with-tatum-sdk.md @@ -0,0 +1,135 @@ +# Get started with Tatum SDK + +## Build your first dapp with Tatum SDK ๐Ÿš€ + +๐ŸŽฏ Welcome to the Tatum SDK Demo: Simplifying Blockchain Development! ๐Ÿš€ + +In this step-by-step guide, we'll showcase just how remarkably easy it is to work with the Tatum SDK and retrieve the balance of an Ethereum address using vanilla JavaScript. ๐Ÿ’ฐ Get ready to witness the power of simplicity! + +With the Tatum SDK, fetching the balance is a breeze, thanks to its intuitive API. ๐ŸŒŸ No complex setup or convoluted coding required! Just a few lines of vanilla JavaScript code, and we'll connect to the Tatum SDK, retrieve the balance, and display it on a user-friendly interface. ๐ŸŒ๐Ÿ’ก + +Join us as we embark on our journey to build a Tatum DApp with vanilla JavaScript. Let's break it down into simple steps: + +1. Create a new Node.js project and install the Tatum SDK package. ๐Ÿ“ฆ +2. Build an HTML page with an input field and a button. This will allow users to enter the Ethereum address and initiate the balance retrieval process. ๐Ÿ’ป +3. Write vanilla JavaScript code that leverages the Tatum SDK's address.getBalance() method. This function will fetch the balance of the provided Ethereum address. ๐Ÿค‘ +4. Launch our application using the Parcel server. Sit back and watch as our vanilla JavaScript-powered DApp comes to life, fetching and displaying the balance in a decentralized, secure, and efficient manner. ๐Ÿš€ + +So, grab your coding hat, and let's get started on our Tatum SDK adventure with the simplicity of vanilla JavaScript! ๐Ÿ’ช + +### 1. Create a new project ๐Ÿ†• + +The first step is to create a new project by running `npm init` in the terminal. This will prompt you to enter some basic information about the project, such as the project name and version. + +```bash +npm init +``` + +### 2. Install Tatum SDK ๐Ÿ“ฆ + +Next, you will need to install the Tatum SDK by running `npm install @tatumio/tatum` it in the terminal. This will install the Tatum SDK package and its dependencies. + +```bash +npm install @tatumio/tatum +``` + +### 3. Create an index.html file ๐Ÿ“ + +After installing the Tatum SDK, you need to create an `index.html` file in your project directory. This file will contain the HTML code that displays the input field, button and a div element for displaying the balance. The button is set up with an event listener that triggers the function to retrieve the balance when clicked. As you can see in the script tag we are import `app.js` which doesn't exist right now, but we will create this file in the next step! + +```html + + + + My First Tatum DApp + + + +

Get Eth balance with Tatum!

+ + +
+ + +``` + +### 4. Create an app.js file ๐Ÿ“ + +Next, you will create a `app.js` file in your project directory. This file will contain the code that interacts with the Tatum SDK to retrieve the balance of a given Ethereum wallet address. + +```javascript +import { TatumSDK, Network } from '@tatumio/tatum' + +const button = document.getElementById('get-balance'); +const addressInput = document.getElementById('address'); +const balanceDiv = document.getElementById('balance'); + +button.addEventListener('click', async () => { + const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); + const balance = await tatum.address.getBalance({ + addresses: [addressInput.value], + }); + const balanceData = balance.data[0]; + balanceDiv.textContent = `${balanceData.balance} ${balanceData.asset}`; +}); + +``` + +You initialise the Tatum SDK by calling and passing in the `Network` object for the Ethereum network. Then you call `tatum.address.getBalance` and pass in an object with an array of addresses to retrieve the balance for. Finally, you display the retrieved balance in the balance div element. + +{% hint style="info" %} +There are various blockchain networks available - each instance of the TatumSDK is tied to 1 specific network. All supported networks are available [here](https://github.com/tatumio/tatum-js/blob/master/src/dto/Network.ts). +{% endhint %} + +### 5. Update package.json ๐Ÿ“ + +To start the app from the `index.html` file, you need to update the `source` property in your `package.json` file. + +```json +{ + "name": "my-first-tatum-dapp", + "version": "1.0.0", + "source": "./index.html", + "license": "MIT", + "dependencies": { + "@tatumio/tatum": "^3.0.0" + } +} +``` + +### 6. Start server ๐Ÿš€ + +The last step is to start the server using Parcel. You can run `npx parcel` in the terminal to start the server, and your app will be available at `http://localhost:1234`. + +```bash +npx parcel +``` + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzZXqz" %} +Get native ETH balance dapp +{% endembed %} + +You can enter a wallet address and click the "Get Balance" button to retrieve the balance for that Ethereum address. The balance will be displayed below the button. + +{% hint style="info" %} +๐Ÿ‘‰ Hint: Parcel will automatically bundle and serve your app. +{% endhint %} + +All the files we created together are available on our [TatumSDK repository on github](https://github.com/tatumio/example-apps) ๐Ÿ“. + +#### ๐ŸŽ‰ Congratulations! You have successfully built your first DApp using TatumSDK! + +\ +๐ŸŽ‰ With just a few lines of vanilla JavaScript code, you were able to connect to the Ethereum blockchain network and retrieve the balance for a given Ethereum wallet address. Now, it's time to explore the full power of Tatum! + +๐Ÿš€ TatumSDK opens up a world of possibilities for your vanilla JavaScript-powered blockchain development journey. Whether you're building decentralised finance (DeFi) applications, NFT platforms, or integrating blockchain into your existing projects, TatumSDK has got you covered. + +๐Ÿ‘จโ€๐Ÿ’ป To unlock the full potential of TatumSDK and discover its extensive features, head over to our Tatum Dashboard at [dashboard.tatum.io](https://dashboard.tatum.io). Sign up for an account and gain access to a range of powerful tools and services that will accelerate your blockchain development. + +๐ŸŒŸ The Tatum Dashboard provides a user-friendly interface to manage your API keys, create notifications, and much more. It's your gateway to streamline your blockchain development process. + +๐Ÿ”” In addition, if you're interested in learning more about specific topics like NFTs, wallet operations, and RPCs, be sure to check out the comprehensive [Tatum Notifications Documentation](https://docs.tatum.io/docs/notifications) for detailed insights and step-by-step guides. This resource will help you dive deeper into advanced functionalities and unleash the full potential of TatumSDK. + +๐Ÿ‘‹ Thank you for following along with this guide and taking your first steps into the exciting world of blockchain development with TatumSDK. Get ready to unleash the true potential of decentralised applications! + +๐Ÿ‘‰ Don't forget to check out other example apps on our [TatumSDK repository on GitHub](https://github.com/tatumio/example-apps). Happy coding! ๐ŸŒŸ diff --git a/sdk/javascript-typescript-sdk/README.md b/sdk/javascript-typescript-sdk/README.md new file mode 100644 index 0000000..2a0e78b --- /dev/null +++ b/sdk/javascript-typescript-sdk/README.md @@ -0,0 +1,69 @@ +--- +description: >- + Tatum offers a very powerful JS/TS SDK which can help developers to make dapps + easier and quicker. +--- + +# JavaScript / TypeScript SDK + +This page provides a step-by-step guide on getting started creating a dapp that fetches the native balance of a user under a minute. + +## Prerequisites + +Before diving into TatumSDK, ensure that you have the following prerequisites installed: + +* **Node.js**: Ensure you have the latest LTS version installed. +* **npm**: npm is bundled with Node.js, so installing Node.js should automatically install npm. + +## Installation + +To install TatumSDK, simply run the following command in your terminal or command prompt: + +#### Install using [npm](https://www.npmjs.com/) + +{% code lineNumbers="true" %} +```bash +npm install @tatumio/tatum +``` +{% endcode %} + +#### Install using [yarn](https://yarnpkg.com/) + +{% code overflow="wrap" lineNumbers="true" %} +```bash +yarn add @tatumio/tatum +``` +{% endcode %} + +#### Install using [pnpm](https://pnpm.io/) + +{% code lineNumbers="true" %} +```bash +pnpm install @tatumio/tatum +``` +{% endcode %} + +## Making your first Call + +Now that you have installed Tatum SDk, lets make your first call in which we will fetch the native balance of wallet in just 3 steps. + +Here's the code snippet for same, + +```javascript +import { TatumSDK, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ network: Network.ETHEREUM }); +const balance = await tatum.address.getBalance({ + addresses: [addressInput.value], +}); +console.log(balance.data[0]); +}); +``` + +Try the first call in the codepen below. + +{% embed url="https://codepen.io/tatum-devrel/pen/MWzZXqz" %} +Make your first call. +{% endembed %} + +Interesting? You can follow this full [Get Started guide ](../get-started-with-tatum-sdk.md)to start building your own dapps. diff --git a/sdk/javascript-typescript-sdk/configuration-options.md b/sdk/javascript-typescript-sdk/configuration-options.md new file mode 100644 index 0000000..5941081 --- /dev/null +++ b/sdk/javascript-typescript-sdk/configuration-options.md @@ -0,0 +1,116 @@ +# Configuration options + +### Network + +Every Tatum SDK instance must be initiated with the proper blockchain network. All operations performed later using this SDK will automatically use the network from the configuration. + +{% hint style="info" %} +To see the list of all available blockchain protocols, check on [GitHub](https://github.com/tatumio/tatum-js/blob/master/src/dto/Network.ts). +{% endhint %} + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) +``` +{% endcode %} + +{% hint style="success" %} +TatumSDK is returning the correct types for the RPC submodule using generic types in the init() method. To see all the supported RPC types, check [here](https://github.com/tatumio/tatum-js/blob/master/src/dto/rpc/index.ts). +{% endhint %} + +### API Version + +Tatum SDK works with two versions of the Tatum API - version 3 and version 4. Each of the versions supports different operations, it's recommended to use version 4. + +{% hint style="info" %} +Version 4 of the API supports the most up-to-date features and is set as a default value. The SDK by default tries to perform the calls against version 4 and fallbacks to version 3 +{% endhint %} + +{% code lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum, ApiVersion} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM, version: ApiVersion.V4}) +``` +{% endcode %} + +### API Key + +Most of the operations available in the SDK don't require API Key authentication to Tatum. But, if you want to have a higher throughput or save your data for future use, you should obtain one at [Tatum Dashboard](https://dashboard.tatum.com). Here, you will get the API Key Version 4 for your SDK, and you can use it in your application. + +{% hint style="info" %} +Alternatively, for access to features of Api Key Version 3, you can get the API Key [here](https://dashboard.tatum.io). + +You can use both API Keys at the same time or just one of them. +{% endhint %} + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ + network: Network.ETHEREUM, + apiKey: { + v3: 'YOUR_API_KEY_V3', + v4: 'YOUR_API_KEY_V4' +}) +``` +{% endcode %} + +### Verbose mode + +If you want to start the verbose logging mode to see requests and responses returned from the Tatum API, just set the config `verbose: true`. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM, verbose: true}) +``` +{% endcode %} + +### Custom RPC provider URL + +You can use any RPC provider for interacting with a blockchain. Just add your custom node provider inside `rpc.nodes` array. All other features from the SDK will work as expected, only the RPC calls will point to your custom node. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM, rpcUrl: 'https://YOUR_CUSTOM_RPC_PROVIDER'}) + +const tatum = await TatumSDK.init({ + network: Network.ETHEREUM, + verbose: true, + rpc: { + nodes: [ + { + url: 'YOUR_CUSTOM_PROVIDER_URL', + type: RpcNodeType.NORMAL, + }, + ], + }, +}) +``` +{% endcode %} + +### Retry + +There are some cases when requests fail to complete successfully. For instance, when you exceed request rate limitations or a network error occurs. To configure behavior when requests fail use + +* `retryCount` - specifies the maximum number of how many times the failed request is resent again until a successful response is returned, the default value is 1 +* `retryDelay` - specifies the number in milliseconds of how long it waits before the failed request is resent again, the default value is 1000 + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +import {TatumSDK, Network, Ethereum} from '@tatumio/tatum' + +const tatum = await TatumSDK.init({ + network: Network.ETHEREUM, + retryCount: 5, + retryDelay: 1500, +}) +``` +{% endcode %} diff --git a/sdk/javascript-typescript-sdk/submodules.md b/sdk/javascript-typescript-sdk/submodules.md new file mode 100644 index 0000000..f31aa0e --- /dev/null +++ b/sdk/javascript-typescript-sdk/submodules.md @@ -0,0 +1,79 @@ +--- +description: >- + A quick overview of th different submodules in Tatum SDK and how they simplify + blockchain development. These submodules include RPC, Notification, NFT, + Address, and Wallet Provider. +--- + +# Submodules + +TatumSDK is thoughtfully designed and organized into two primary submodules to provide a clean and efficient way of interacting with the various blockchains: + +* [**RPC submodule**](../../docs/rpc/) **- `tatum.rpc.*`**: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const latestBlock = await tatum.rpc.blockNumber() +``` +{% endcode %} + +* [**Notification submodule**](../../docs/notifications/) **- `tatum.notification.*`**: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +const subscription = await tatum.notification.subscribe.nativeIncomingTx({ + "address": "0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227", + "url": "https://dashboard.tatum.io/webhook-handler" // REPLACE WITH YOUR URL HANDLER +}) +``` +{% endcode %} + +* [**NFT submodule**](../../docs/nfts/) **- `tatum.nft.*`**: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection, or identify the owners of a particular NFT. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +// Get balance of all NFTs this wallet holds +const balance = await tatum.nft.getBalance({ + "addresses": ["0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227"] +}) +``` +{% endcode %} + +* [**Wallet address submodule**](../../docs/wallet-address-operations/) - **`tatum.address.*`**: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly. + +{% code overflow="wrap" lineNumbers="true" %} +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' + +const tatum = await TatumSDK.init({network: Network.ETHEREUM}) + +// Get balance of all assets this wallet holds +const balance = await tatum.address.getBalance({ + "addresses": ["0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227"] +}) +``` +{% endcode %} + +* [**Wallet Provider submodule**](../../docs/wallet-provider/) **- `tatum.walletProvider.*`**: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets. + +By dividing the library into these submodules, TatumSDK offers an organized, easy-to-use interface that makes interacting with Ethereum and other blockchains a breeze. Both beginners and advanced developers can benefit from the streamlined architecture, enabling them to focus on building powerful blockchain applications. diff --git a/sdk/selecting-the-best-sdk/README.md b/sdk/selecting-the-best-sdk/README.md new file mode 100644 index 0000000..67ebfa7 --- /dev/null +++ b/sdk/selecting-the-best-sdk/README.md @@ -0,0 +1,45 @@ +--- +description: >- + In this page we will be comparing the most popular SDK's and the factors which + you as a developer should consider for building your next big web3 project. +--- + +# Selecting the best SDK + +## TLDR; + +We have done a full comparison of most of the popular SDK's out there, on the parameters in the categories **Feature Set,** **Chain Support,** **Ease of Use, Performance & Composability** , & **Robustness.** You can find all the [full comparison here.](full-comparison.md) + +In Short here's we are the coolest **๐Ÿ˜Ž**, But here's why you shouldn't use us. + +1. We don't support all new random EVM chains, Though the major ones and you can [find all we support here](../../docs/notifications/supported-types-and-blockchain-networks.md) & if this is a deal breaker then third-web, Ethers or Web3.js might be best for your needs. + +But wait here's **what you would lose**. + +1. **Performance benefits** due to less dependencies +2. Most reliable RPC access straight from SDK with **Provider Agnosticism**. +3. Most **Simple Integration & Use**, with Better **SDK Composability** & the best product Documentation. +4. **UTXO Support & Chain Agnostic Response/Response Abstraction.** + +## Why use a web3 SDK? + +If you are here, you probably have made your mind to use something like Tatum SDK, but if you are still thinking on why its better to use Tatum SDK over any other RPC service or the generic api provider's, here are some of the reasons why you might choose a Web3 SDK over RPCs and generic APIs: + +1. **Ease of Use:** Web3 SDKs provide high-level abstractions for interacting with the blockchain. They simplify many complex tasks involved in interacting with the blockchain, such as transaction signing, data encoding/decoding, and contract interaction, thereby reducing the learning curve and development time. +2. **Feature Set:** SDK's can provide a much more generous feature sets tailored to use cases like one single function call to get all the different types of token balances for your portfolio dapp. +3. **One Stop Shop:** Some cool SDK's like ours can help you get NFT functionalities, Tokens, Notifications, Wallet Connect & even RPC access for your contract management all packed in one. (Yet being the smallest and least dependent one). +4. **Response Abstraction:** Working with default RPC functions can be tricky due to their raw responses and specially in a cross chain environment. Thus having Response Abstraction or more human specific response can be of a great help.\ + Eg: Fetching token balances gives you value in decimals numbers with information like symbol, & total decimal places etc. instead of just big Numbers. + +## Other crucial factors in decision + +We already know some must have's you should look for in an SDK, but here's equally more important aspects if not more. + +1. **Performance benefits:** This is one of the most crucial for a lot of developers, the impact of the sdk on the environment, which basically is due to the size of SDK & the number of dependencies it has. The lower the number for both of this factors the better it is. +2. **Provider Agnosticism:** Another crucial check which ensures you will have a friction less development journey is "_Provider Agnosticism_" which basically means you get more options to choose your base feature provider which will be RPC in this case. Whereas otherwise you will be locked to a single provider even when they are down. +3. **Simple Integration & Use:** Product documentation is an always overlooked but yet plays a crucial role while you are developing applications with sdk's, imagine having guests at house and you have to cook something for them and all your recipe book is jumbled and tough to go through. +4. **SDK Composability:** How an sdk in composed in terms of hierarchy matters, for example if i tell you that `tatum.nft.getBalance()` gets you all the nft balances can you guess what would be the call for fetching all token balances? And not just a better SDK architecture but the ability to contribute it to shape it the way you like matters as well. + +## **Conclusion:** + +Tired at this point I could have just told you to use Tatum SDK and that's the best way, but I will still share this unbiased comparison blog to let you decide on your own & if you disagree to any of it or have any more factors we should consider, create a proposal here and we shall get it moving. diff --git a/sdk/selecting-the-best-sdk/chain-agnostic-response.md b/sdk/selecting-the-best-sdk/chain-agnostic-response.md new file mode 100644 index 0000000..8253077 --- /dev/null +++ b/sdk/selecting-the-best-sdk/chain-agnostic-response.md @@ -0,0 +1,31 @@ +# Chain Agnostic Response + +Most of us don't need to understand the intricate details of blockchain's hexadecimal gibberish. That's where response abstraction in Web3 SDKs comes into play. + +**๐ŸŽฏWhat is Chain Agnostic SDKโ€™s ?** + +In the simplest terms, chain agnostics refers to the value-add that service providers offer when they convert the raw blockchain data into a format that's more digestible for developers. + +**๐Ÿ’ผAn Example:** + +When you fetch balance from a raw function + +`BigNumber {`\ +`_hex: '0xd47cca060a3e...',`\ +`_isBigN๏ปฟumber: true`\ +`}` + +When you fetch balance from an abstracted function + +`Balance{`\ +`result : "6.5560815771722537667235e+22โ€,`\ +`}` + +๐Ÿ’กWhy Does It Matter? + +1. ๐Ÿ’ป**Ease of use**: Raw data from blockchain nodes can be complicated and tedious to understand. Response abstraction simplifies this data. +2. โŒ›**Time-saving**: Response abstraction saves developersโ€™ time, eliminating the need to parse and interpret raw blockchain data manually. +3. ๐Ÿงฉ**Better Integration**: Abstracted responses often better fit into existing software architectures, making the integration of blockchain functionalities smoother. +4. ๐Ÿš€**Increased productivity**: By handling the low-level details, response abstraction allows developers to concentrate on higher-level functionality, ultimately boosting productivity. + +If you've enjoyed this post and found it informative, share it with your developer friends who could benefit from the magic of response abstraction! diff --git a/sdk/selecting-the-best-sdk/full-comparison.md b/sdk/selecting-the-best-sdk/full-comparison.md new file mode 100644 index 0000000..b8a145b --- /dev/null +++ b/sdk/selecting-the-best-sdk/full-comparison.md @@ -0,0 +1,14 @@ +--- +description: >- + In this page we will be comparing the most popular SDK's and the factors which + you as a developer should consider for building your next big web3 project. +--- + +# Full Comparison + +We have done a full comparison of most of the popular SDK's out there, on the parameters in the categories **Feature Set,** **Chain Support,** **Ease of Use, Performance & Composability** , & **Robustness.** + +Fully - ๐ŸŸข , Partially - ๐ŸŸก, No - ๐Ÿ”ด๏ธ + +
FeaturesTatumAlchemyQuicknodeMoralisThirdwebweb3.jsEthers.jsBitcore
NFT's & Token๐ŸŸข ๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข`NA
RealTime Notifications๐ŸŸข ๐ŸŸข๐ŸŸข๐ŸŸข๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐ŸŸข
RPC Access๐ŸŸข๐ŸŸก ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐ŸŸข
Wallet Integrations๐ŸŸข ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข
Is Provider Agnostic?๐ŸŸข๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข
Has Routing?๐ŸŸข ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸก ๐ŸŸก ๐ŸŸก ๐ŸŸก
Gas Operations๐ŸŸข ๐ŸŸข๐ŸŸข๐ŸŸข ๐ŸŸข ๐ŸŸข๐ŸŸข ๐Ÿ”ด๏ธ
Supported Chains12 539All EVM's + SolAll EVM'sAll EVM's4
Supports UTXO based Chains๐ŸŸข ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข
Supports all EVM's๐Ÿ”ด๏ธ ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐ŸŸข๐Ÿ”ด๏ธ
Is Typescript Supported?๐ŸŸข ๐ŸŸข๐ŸŸข ๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข ๐ŸŸข
Do the docs have live examples๐ŸŸข ๐ŸŸข ๐ŸŸข๐Ÿ”ด๏ธ๐Ÿ”ด๏ธ๐ŸŸข๐ŸŸข๐Ÿ”ด๏ธ
Response Abstraction๐ŸŸข ๐ŸŸก ๐ŸŸข๐ŸŸข๐ŸŸก๐ŸŸก๐ŸŸก๐ŸŸก
SDK Size155.6 kb385.1 kb487.1 kb743.3 kb340.3 kb622.7 kb359.9 kb453 kb
Dependencies314613171678
Is OpenSource๐ŸŸข ๐ŸŸข ๐ŸŸข๐ŸŸข๐ŸŸข๐ŸŸข ๐ŸŸข๐ŸŸข
+ diff --git a/sdk/selecting-the-best-sdk/provider-agnostic.md b/sdk/selecting-the-best-sdk/provider-agnostic.md new file mode 100644 index 0000000..21b6611 --- /dev/null +++ b/sdk/selecting-the-best-sdk/provider-agnostic.md @@ -0,0 +1,16 @@ +# Provider Agnostic + +**What is Provider Agnosticism?** + +Provider Agnosticism in our Tatum Web3 SDK offers developers a powerful and flexible approach to interact with the blockchain. It allows you to seamlessly connect your decentralised applications to any Remote Procedure Call (RPC) provider of your choice. Just like a versatile JavaScript framework that works across different browsers. + +**The Benefits of Provider Agnosticism** + +1. **Freedom of Choice:** Even wIth the lowest cost & 99.99% uptime you might have some reasons to use some other provider and we totally get it. +2. **Reduced Dependency:** No longer are you confined to a single provider's ecosystem. Provider Agnosticism ensures your application is less dependent on a particular service, increasing its resilience and adaptability. + +**Unlock the Full Potential of Web3 Development** + +By embracing Provider Agnosticism in our Web3 SDK, we aim to empower developers like you to take control of your blockchain applications. Break free from the limitations of a single RPC provider and explore the vast landscape of possibilities that await you in the decentralised world. + +Join us on this journey of flexibility, freedom, and boundless potential in Web3 development. Together, let's shape a more open and interconnected blockchain ecosystem. Happy coding! ๐Ÿš€ diff --git a/v3-features/README.md b/v3-features/README.md new file mode 100644 index 0000000..c9cd316 --- /dev/null +++ b/v3-features/README.md @@ -0,0 +1,42 @@ +--- +description: This page links to all the v3 product documentations. +layout: + title: + visible: true + description: + visible: true + tableOfContents: + visible: true + outline: + visible: true + pagination: + visible: true +--- + +# ๐Ÿ“– v3 Features + +All of the v3 features work as they were with the new v4 keys as well, and if you migrate you getter cost breakdown analysis for each products you use & even lower costs on these same features. + +[Migrate to new v4 Keys](https://dashboard.tatum.io) + +[Check Pricing for new keys](../pricing.md) + +{% content-ref url="broken-reference" %} +[Broken link](broken-reference) +{% endcontent-ref %} + +{% content-ref url="broken-reference" %} +[Broken link](broken-reference) +{% endcontent-ref %} + +{% content-ref url="broken-reference" %} +[Broken link](broken-reference) +{% endcontent-ref %} + +{% content-ref url="broken-reference" %} +[Broken link](broken-reference) +{% endcontent-ref %} + +{% content-ref url="broken-reference" %} +[Broken link](broken-reference) +{% endcontent-ref %}