### Quickstart and Usage Guide Source: https://developer.nodit.io/docs/web3-data-api Guides users on how to get started with Nodit's Web3 Data API, including obtaining an API Key and using example code. ```APIDOC ## Web3 Data API Quickstart ### Description This section guides users on how to connect Nodit's Elastic Node and call the Web3 Data API. It covers obtaining an API Key from the Starter Plan and utilizing the API Reference page for testing and example code. ### Getting Started Steps 1. **Obtain API Key**: Start with the Free Plan (Starter Plan) and receive an API Key. 2. **Check API Calls**: Use the test call function on the API Reference screen to call the API with desired parameters. 3. **Integrate with Code**: Use example code from the API Reference page for easy integration into your projects. ### Aptos Indexer API - **Guide**: A specific guide is available for Aptos projects on how to use the Indexer API. ### Request Log - **Monitoring**: Users can check and monitor Web3 Data API call history using the Request Log function, with options to filter by method, status, and time period. ``` -------------------------------- ### Set up a new React project Source: https://developer.nodit.io/docs/web3-development-setup Creates a new React project using create-react-app, navigates into the project directory, and starts the development server. Requires Node.js and npm to be installed. ```bash npx create-react-app my-app cd my-app npm start ``` -------------------------------- ### Verify Node.js and npm Installation Source: https://developer.nodit.io/docs/web3-development-setup Checks the installed versions of Node.js and npm to confirm successful installation. ```bash node -v npm -v ``` -------------------------------- ### Get Latest Block Number (Node.js) Source: https://developer.nodit.io/reference/kaia-kaia_blocknumber This Node.js example shows how to make a POST request to the kaia_blockNumber API using the 'axios' library to get the latest block number. Ensure you have axios installed (`npm install axios`). ```javascript const axios = require('axios'); const options = { method: 'POST', url: 'https://kaia-mainnet.nodit.io/', headers: { 'X-API-KEY': 'nodit-demo', 'accept': 'application/json', 'content-type': 'application/json' }, data: { id: 1, jsonrpc: '2.0', method: 'kaia_blockNumber' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error('Error:', error); }); ``` -------------------------------- ### Clone Nodit EVM Tutorials Repository Source: https://developer.nodit.io/docs/building-a-simple-token-explorer-using-web3-data-apis Clones the Nodit EVM Tutorials repository from GitHub to your local machine. This is the first step to accessing the example projects. ```shell $ git clone https://github.com/Lambda256/Nodit-EVM-Tutorials $ cd Nodit-EVM-Tutorials $ cd token_tutorial ``` -------------------------------- ### Get Ethereum Native Balance by Account using Node.js (Web3 Data API) Source: https://developer.nodit.io/reference/ethereum-quickstart This Node.js example shows how to fetch an Ethereum account's native balance using Nodit's Web3 Data API. It sends a POST request to the 'getNativeBalanceByAccount' endpoint using the 'axios' library. Make sure 'axios' is installed (`npm install axios`) and replace '{{API-KEY}}' with your Nodit API key. ```javascript const axios = require('axios'); let data = JSON.stringify({ "accountAddress": "0x9872F9cFD51dD9f5CF45a54F96a16eeE238A056a" }); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://web3.nodit.io/v1/ethereum/mainnet/native/getNativeBalanceByAccount', headers: { 'Content-Type': 'application/json', 'X-API-KEY': '{{API-KEY}}' }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` -------------------------------- ### Clone and Access Example Project (Bash) Source: https://developer.nodit.io/docs/building-evm-wallet Clones the Nodit EVM Tutorials repository from GitHub and navigates into the wallet tutorial directory. This sets up the project environment for verification. ```bash $ git clone https://github.com/Lambda256/Nodit-EVM-Tutorials $ cd Nodit-EVM-Tutorials $ cd wallet_tutorial ``` -------------------------------- ### Get Account Stats - Ruby Source: https://developer.nodit.io/reference/optimism-getaccountstats Illustrates how to retrieve account statistics from the Nodit API using Ruby. This example details the request setup, including the URL, headers, and the JSON body. ```Ruby require 'uri' require 'net/http' url = URI("https://web3.nodit.io/v1/optimism/mainnet/stats/getAccountStats") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-KEY"] = "nodit-demo" request["accept"] = "application/json" request["content-type"] = "application/json" request.body = JSON.parse('{ "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }') response = http.request(request) puts response.read_body ``` -------------------------------- ### Clone Nodit EVM Tutorials Repository Source: https://developer.nodit.io/docs/advanced Clones the Nodit EVM Tutorials repository from GitHub and navigates into the nft_tutorial directory. ```bash $ git clone https://github.com/Lambda256/Nodit-EVM-Tutorials $ cd Nodit-EVM-Tutorials $ cd nft_tutorial ``` -------------------------------- ### Get NFT Contract Metadata by Contracts (Node.js) Source: https://developer.nodit.io/reference/optimism-web3-data-api This Node.js example shows how to retrieve NFT contract metadata using the Nodit API. It utilizes the 'axios' library to send a POST request with the necessary headers and the contract addresses in the request body. Ensure you have 'axios' installed (`npm install axios`). ```javascript const axios = require('axios'); const options = { method: 'POST', url: 'https://web3.nodit.io/v1/optimism/mainnet/nft/getNftContractMetadataByContracts', headers: { 'X-API-KEY': 'YOUR_API_KEY', 'accept': 'application/json', 'content-type': 'application/json' }, data: { contractAddresses: [ '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', '0x60E4d786628Fea6478F785A6d7e704777c86a7c6' ] } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` -------------------------------- ### Get Hourly Transactions Stats (Ruby) Source: https://developer.nodit.io/reference/gethourlytransactionsstats A Ruby example demonstrating how to request hourly transaction statistics from the Nodit API. It includes the necessary HTTP request setup with headers and a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse('https://web3.nodit.io/v1/ethereum/mainnet/stats/getHourlyTransactionsStats') request = Net::HTTP::Post.new(uri) request['X-API-KEY'] = 'nodit-demo' request['accept'] = 'application/json' request['content-type'] = 'application/json' request.body = { startDateTime: '2024-01-01-00', endDateTime: '2024-02-01-00' }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) } # Handle the response ``` -------------------------------- ### Installing socket.io-client Source: https://developer.nodit.io/reference/how-to-use-stream Instructions for installing the necessary client-side library to establish a WebSocket connection with Nodit Stream. ```APIDOC ## Shell Command for Installation ### Description This command installs the `socket.io-client` library, which is required for building WebSocket client applications to interact with the Nodit Stream service. ### Method Shell Command ### Endpoint N/A ### Parameters N/A ### Request Example ```bash npm install socket.io-client ``` ### Response *Installation successful message from npm.* ``` -------------------------------- ### Install Aptos Faucet Client Source: https://developer.nodit.io/docs/aptos-beginner Installs the Aptos faucet client using npm. This client allows users to receive tokens on Aptos Testnet and Devnet. ```shell $ npm install @aptos-labs/aptos-faucet-client ``` -------------------------------- ### Get Total Transaction Blocks (Node.js) Source: https://developer.nodit.io/reference/sui_gettotaltransactionblocks This Node.js example shows how to use the 'axios' library to make a POST request to the Nodit API to retrieve the total transaction blocks count. Ensure 'axios' is installed (`npm install axios`). ```JavaScript const axios = require('axios'); const getTransactionBlocks = async () => { try { const response = await axios.post('https://{sui-network}.nodit.io/', { id: 1, jsonrpc: '2.0', method: 'sui_getTotalTransactionBlocks' }, { headers: { 'X-API-KEY': 'YOUR_API_KEY', 'accept': 'application/json', 'content-type': 'application/json' } }); console.log('Total Transaction Blocks:', response.data.result); return response.data.result; } catch (error) { console.error('Error fetching transaction blocks:', error.response ? error.response.data : error.message); throw error; } }; getTransactionBlocks(); ``` -------------------------------- ### Environment Setup for Nodit Stream Client Source: https://developer.nodit.io/reference/stream-api-copy Instructions on setting up your development environment to connect to the Nodit Stream WebSocket service using JavaScript. ```APIDOC ## Environment Setup for Nodit Stream Client ### Description This section details the necessary steps to set up your local development environment for interacting with the Nodit Stream service using JavaScript and Node.js. ### Prerequisites 1. **Node.js Installation**: Ensure you have Node.js installed. It is recommended to use the latest LTS version for stability. * [Install Node.js](https://nodejs.org/) 2. **socket.io-client Installation**: This library is required for WebSocket communication. Install it in your project's root directory using npm. ```shell npm install socket.io-client ``` 3. **Nodit Console Signup**: Create an account on the Nodit Console to access blockchain network services. * [Go to Nodit Console](https://console.nodit.io/) 4. **API Key**: Obtain your API key from the project overview page in the Nodit Console. Keep this key secure. ``` -------------------------------- ### Get Daily Transactions Stats (cURL) Source: https://developer.nodit.io/reference/ethereum-getdailytransactionsstats Example cURL request to fetch daily transaction statistics. It includes the API endpoint, necessary headers (API key, accept, content-type), and the JSON payload with start and end dates. ```shell curl --request POST \ --url https://web3.nodit.io/v1/ethereum/mainnet/stats/getDailyTransactionsStats \ --header 'X-API-KEY: nodit-demo' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "startDate": "2024-01-01", "endDate": "2024-02-01" }' ``` -------------------------------- ### cURL Request: Hourly Transactions Stats By Contract Source: https://developer.nodit.io/reference/gethourlytransactionsstatsbycontract This example demonstrates how to call the Nodit API to get hourly transaction statistics for a contract using cURL. It specifies the contract address, start date, and end date. ```shell curl --request POST \ --url https://web3.nodit.io/v1/ethereum/mainnet/stats/getHourlyTransactionsStatsByContract \ --header 'X-API-KEY: nodit-demo' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "startDateTime": "2024-01-01-00", "endDateTime": "2024-02-01-00" }' ``` -------------------------------- ### Check Aptos CLI Installation Source: https://developer.nodit.io/docs/aptos Confirms the successful installation of the Aptos CLI by displaying its help information. The Aptos CLI is a crucial tool for developing and interacting with the Aptos blockchain. ```shell $ aptos --help Command Line Interface (CLI) for developing and interacting with the Aptos blockchain Usage: aptos Commands: account Tool for interacting with accounts config Tool for interacting with configuration of the Aptos CLI tool genesis Tool for setting up an Aptos chain Genesis transaction governance Tool for on-chain governance info Show build information about the CLI init Tool to initialize current directory for the aptos tool key Tool for generating, inspecting, and interacting with keys move Tool for Move related operations multisig Tool for interacting with multisig accounts node Tool for operations related to nodes stake Tool for manipulating stake and stake pools update Update the CLI or other tools it depends on help Print this message or the help of the given subcommand(s) ``` -------------------------------- ### Check Aptos CLI Installation Source: https://developer.nodit.io/docs/aptos-beginner Displays help information for the Aptos CLI, confirming a successful installation. The CLI is used for developing and interacting with the Aptos blockchain. ```shell $ aptos --help ``` ```shell Command Line Interface (CLI) for developing and interacting with the Aptos blockchain Usage: aptos Commands: account Tool for interacting with accounts config Tool for interacting with configuration of the Aptos CLI tool genesis Tool for setting up an Aptos chain Genesis transaction governance Tool for on-chain governance info Show build information about the CLI init Tool to initialize current directory for the aptos tool key Tool for generating, inspecting, and interacting with keys move Tool for Move related operations multisig Tool for interacting with multisig accounts node Tool for operations related to nodes stake Tool for manipulating stake and stake pools update Update the CLI or other tools it depends on help Print this message or the help of the given subcommand(s) ``` -------------------------------- ### Get Tokens Owned By Account Request Example Source: https://developer.nodit.io/reference/kaia-gettokensownedbyaccount This example demonstrates how to make a GET request to the Nodit API to retrieve tokens owned by a specific account. It includes example path and query parameters. ```http GET https://web3.nodit.io/v1/{protocol}/{network}/token/getTokensOwnedByAccount?accountAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&page=1&rpp=100 ``` -------------------------------- ### Install Aptos TypeScript SDK Source: https://developer.nodit.io/docs/aptos-beginner Installs the Aptos TypeScript SDK using npm. This SDK facilitates creating Aptos accounts and executing transactions. ```shell $ npm install @aptos-labs/ts-sdk ``` -------------------------------- ### Get Network Version using Ruby Source: https://developer.nodit.io/reference/arbitrum-net_version An example of how to use Ruby to query the Nodit API for the network version. It outlines the necessary HTTP request setup, including headers and the JSON payload. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse('https://arbitrum-mainnet.nodit.io/') api_key = 'nodit-demo' request_body = { "id": 1, "jsonrpc": "2.0", "method": "net_version" }.to_json http = Net::HTTP.new(uri.hostname, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Content-Type'] = 'application/json' request['Accept'] = 'application/json' request['X-API-KEY'] = api_key request.body = request_body begin response = http.request(request) puts response.body rescue StandardError => e puts "Error fetching network version: #{e.message}" end ``` -------------------------------- ### Install Foundry Development Environment Source: https://developer.nodit.io/docs/web3-development-setup Installs the Foundry toolkit, a fast and efficient Solidity development environment, using a curl script. ```bash curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Initialize Aptos Network Profile and Account Source: https://developer.nodit.io/docs/aptos-intermediate This command initializes your Aptos CLI with network settings (e.g., testnet) and creates an account. It generates a `config.yaml` file containing private key, public key, and account address, essential for interacting with the Aptos network. ```shell $ aptos init --network testnet ``` -------------------------------- ### Get Transaction By Hash (cURL Example) Source: https://developer.nodit.io/reference/xrpl-gettransactionbyhash Example of how to use the 'Get Transaction By Hash' endpoint with cURL. This demonstrates making a POST request to the Nodit API to fetch transaction details. ```shell curl -X POST \ https://web3.nodit.io/v1/{protocol}/{network}/blockchain/getTransactionByHash \ -H 'Content-Type: application/json' \ -d '{ \ "transactionHash": "CEE2B3341141745B41DD40C775D34A6E24CBD79F5A4E5D025712416D5CE85784", \ "withBalanceChanges": true, \ "withTokenTransfers": true \ }' ``` -------------------------------- ### Initialize Move Project and Navigate Source: https://developer.nodit.io/docs/fungible-asset Creates a new project directory for the Fungible Asset tutorial and navigates the terminal into it. This is the first step in setting up the development environment. ```shell mkdir FungibleAsset cd FungibleAsset ``` -------------------------------- ### Get Block by Hash or Number Request - Node.js Source: https://developer.nodit.io/reference/blockchain-api-8 Example of how to make a POST request to the Nodit API to get block details using a block hash or number. This example uses Node.js with the 'axios' library. ```javascript const axios = require('axios'); async function getBlock(protocol, network, blockIdentifier) { const url = `https://web3.nodit.io/v1/${protocol}/${network}/blockchain/getBlockByHashOrNumber`; try { const response = await axios.post(url, { block: blockIdentifier }); return response.data; } catch (error) { console.error('Error fetching block:', error); throw error; } } // Example usage: // getBlock('polygon', 'mainnet', '0x...') // using block hash // getBlock('polygon', 'mainnet', '12345') // using block number // getBlock('polygon', 'mainnet', 'latest') // using block tag ``` -------------------------------- ### Create Project Directory and Navigate Source: https://developer.nodit.io/docs/deploying-a-module Initializes a new project directory for managing Move modules and navigates into it. This is the first step in setting up the Move development environment. ```shell $ mkdir Message $ cd Message ``` -------------------------------- ### Fetch Token Contract Metadata by Contracts (Node.js) Source: https://developer.nodit.io/reference/optimism-gettokencontractmetadatabycontracts This Node.js example uses the 'axios' library to make a POST request to the Nodit API for fetching token contract metadata. It includes setting up the request URL, headers, and the JSON body with contract addresses. Remember to install axios: `npm install axios`. ```JavaScript const axios = require('axios'); const options = { method: 'POST', url: 'https://web3.nodit.io/v1/optimism/mainnet/token/getTokenContractMetadataByContracts', headers: { 'X-API-KEY': 'YOUR_API_KEY', 'accept': 'application/json', 'content-type': 'application/json' }, data: { contractAddresses: [ '0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` -------------------------------- ### Initialize Move Environment and Profile (Shell) Source: https://developer.nodit.io/docs/aptos-advanced Commands to create a new project directory, navigate into it, and initialize the Move environment. It also covers setting up initial account information for the Aptos testnet. ```shell $ mkdir FungibleAsset $ cd FungibleAsset ``` ```shell $ aptos move init --name ``` ```shell $ aptos init --network testnet ``` ```shell $ cd sources $ touch fungible_asset.move ``` -------------------------------- ### Node.js: Get Base ETH Balance Source: https://developer.nodit.io/reference/base-quickstart This Node.js example demonstrates how to use the Nodit.io Node API to fetch the ETH balance of a given Ethereum address on the Base mainnet. It utilizes the 'axios' library for making POST requests. ```javascript const axios = require('axios'); let data = JSON.stringify({ "id": 1, "jsonrpc": "2.0", "method": "eth_getBalance", "params": [ "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "latest" ] }); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://base-mainnet.nodit.io/', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-API-KEY': '{{API-KEY}}' }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` -------------------------------- ### Get Next Nonce by Account - Node.js Example Source: https://developer.nodit.io/reference/kaia-getnextnoncebyaccount Example of how to call the Nodit API to get the next nonce for an account using Node.js. This snippet demonstrates making a POST request with the necessary headers and JSON payload. ```javascript const url = 'https://web3.nodit.io/v1/kaia/mainnet/blockchain/getNextNonceByAccount'; const apiKey = 'nodit-demo'; // Replace with your actual API key const accountAddress = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; fetch(url, { method: 'POST', headers: { 'X-API-KEY': apiKey, 'accept': 'application/json', 'content-type': 'application/json' }, body: JSON.stringify({ accountAddress: accountAddress }) }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log('Next Nonce:', data.nonce); }) .catch(error => { console.error('Error fetching nonce:', error); }); ``` -------------------------------- ### Kaia Node API - Mainnet Source: https://developer.nodit.io/reference/kaia-quickstart Connect to the Kaia Mainnet using the Nodit Node API. Supports various Ethereum RPC methods. ```APIDOC ## POST /kaia-mainnet.nodit.io/{{API-KEY}} ### Description This endpoint allows you to interact with the Kaia Mainnet using standard Ethereum RPC methods. You can retrieve chain information, transaction details, and more. ### Method POST ### Endpoint `https://kaia-mainnet.nodit.io/{{API-KEY}}` ### Parameters #### Request Body - **id** (integer) - Required - The request ID. - **jsonrpc** (string) - Required - The JSON-RPC version. - **method** (string) - Required - The RPC method to call (e.g., `kaia_chainID`, `eth_getBlockByNumber`). - **params** (array) - Optional - Parameters for the RPC method. ### Request Example ```json { "id": 1, "jsonrpc": "2.0", "method": "kaia_chainID" } ``` ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC version. - **id** (integer) - The response ID. - **result** (any) - The result of the RPC method call. #### Response Example ```json { "jsonrpc": "2.0", "id": 1, "result": "0x2019" } ``` ``` -------------------------------- ### Get Token Holders By Contract Request Example Source: https://developer.nodit.io/reference/base-gettokenholdersbycontract Example HTTP request to the Get Token Holders By Contract endpoint. This demonstrates how to specify protocol, network, and contract address to retrieve token holder data. ```http post https://web3.nodit.io/v1/{protocol}/{network}/token/getTokenHoldersByContract --- Body Params: contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7" page: 1 rpp: 100 withCount: true ``` -------------------------------- ### Contract Deployment with ethers.js Source: https://developer.nodit.io/docs/ethereum-basics-eventlogs This snippet demonstrates how to deploy a smart contract to the Ethereum Sepolia testnet using ethers.js. It includes steps for setting up the provider, wallet, and contract factory, and then deploying the contract. ```APIDOC ## Contract Deployment with ethers.js ### Description This section provides the necessary JavaScript code using ethers.js to deploy a smart contract. It outlines the steps to connect to the Sepolia testnet, create a wallet with a private key, and deploy the contract using its ABI and bytecode. ### Method POST (implicitly, for contract deployment transaction) ### Endpoint N/A (Direct script execution) ### Parameters - **bytecode** (string) - Required - The compiled bytecode of the smart contract. - **abi** (array) - Required - The Application Binary Interface (ABI) of the smart contract. - **provider URL** (string) - Required - The RPC endpoint for the Ethereum network (e.g., Sepolia testnet). - **privateKey** (string) - Required - The private key of the wallet used for deployment. ### Request Example ```javascript const { ethers } = require("ethers"); const bytecode = "{ Your Bytecode }"; const abi = "{ Your ABI }"; const provider = new ethers.providers.JsonRpcProvider("https://ethereum-sepolia.nodit.io/{nodeId}"); const privateKey = "{Your Private Key}"; const wallet = new ethers.Wallet(privateKey, provider); const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet); contractFactory.deploy() .then((deployedContract) => { console.log(`Contract deployed at address: ${deployedContract.address}`); }) .catch((error) => { console.log(`Error deploying contract: ${error}`); }); ``` ### Response #### Success Response - **deployedContract.address** (string) - The address of the successfully deployed smart contract. #### Response Example ```javascript Contract deployed at address: 0x1EBE2a6D4986a6Af1f211bf3D58C138E29b09Ad6 ``` ### Notes - Ensure you replace `{ Your Bytecode }`, `{ Your ABI }`, `{nodeId}`, and `{Your Private Key}` with your actual contract details and Sepolia testnet credentials. - After deployment, you can verify the contract on a block explorer like Sepolia Scan using the returned contract address. ``` -------------------------------- ### Get Next Nonce by Account - PHP Example Source: https://developer.nodit.io/reference/kaia-getnextnoncebyaccount Example of how to call the Nodit API to get the next nonce for an account using PHP. This snippet uses cURL to send a POST request with the required headers and JSON payload. ```php $accountAddress]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode == 200) { $responseData = json_decode($response, true); echo 'Next Nonce: ' . $responseData['nonce'] . "\n"; } else { echo 'Error: ' . $httpCode . " - " . $response . "\n"; } } curl_close($ch); ?> ``` -------------------------------- ### eth_createAccessList Request Example (Shell) Source: https://developer.nodit.io/reference/polygon-eth_createaccesslist Example of making an eth_createAccessList request using cURL. This demonstrates the POST request to the Nodit API with the necessary headers and JSON body. ```shell curl --request POST \ --url https://polygon-mainnet.nodit.io/ \ --header 'X-API-KEY: nodit-demo' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data \ '{ "id": 1, "jsonrpc": "2.0", "method": "eth_createAccessList", "params": [ { "from": null, "to": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "data": "0x70a0823100000000000000000000000047ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503" }, "latest" ] }' ``` -------------------------------- ### Get Next Nonce by Account - Ruby Example Source: https://developer.nodit.io/reference/kaia-getnextnoncebyaccount Example of how to call the Nodit API to get the next nonce for an account using Ruby. This snippet demonstrates making an HTTP POST request with the necessary headers and JSON payload. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse('https://web3.nodit.io/v1/kaia/mainnet/blockchain/getNextNonceByAccount') request = Net::HTTP::Post.new(uri) request['X-API-KEY'] = 'nodit-demo' # Replace with your actual API key request['accept'] = 'application/json' request['content-type'] = 'application/json' account_address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' request.body = { accountAddress: account_address }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end if response.code == '200' puts "Next Nonce: #{JSON.parse(response.body)['nonce']}" else puts "Error: #{response.code} - #{response.body}" end ``` -------------------------------- ### Run Development Server (Bash) Source: https://developer.nodit.io/docs/building-evm-wallet Starts the Nodit EVM Wallet development server. This command builds and runs the application, allowing you to test its functionality. ```bash $ npm run dev ``` -------------------------------- ### Install Node.js and npm on Linux (Ubuntu) Source: https://developer.nodit.io/docs/web3-development-setup Installs Node.js and npm on Ubuntu systems using the apt package manager. ```bash sudo apt-get update sudo apt-get install nodejs npm ``` -------------------------------- ### Get Next Nonce by Account - Python Example Source: https://developer.nodit.io/reference/kaia-getnextnoncebyaccount Example of how to call the Nodit API to get the next nonce for an account using Python. This snippet uses the 'requests' library to send a POST request with the required headers and JSON data. ```python import requests import json url = 'https://web3.nodit.io/v1/kaia/mainnet/blockchain/getNextNonceByAccount' api_key = 'nodit-demo' # Replace with your actual API key account_address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' headers = { 'X-API-KEY': api_key, 'accept': 'application/json', 'content-type': 'application/json' } payload = { 'accountAddress': account_address } response = requests.post(url, headers=headers, data=json.dumps(payload)) if response.status_code == 200: print('Next Nonce:', response.json()['nonce']) else: print(f'Error: {response.status_code} - {response.text}') ``` -------------------------------- ### Nodit API Response for Deployed Module Source: https://developer.nodit.io/docs/aptos-intermediate Example JSON output from the Nodit Get account module API, showing the bytecode and ABI of a deployed module. This helps in verifying the module's contents. ```JSON { "bytecode": "0xa11ceb0b060000...", "abi": { "address": "0xabc...90", "name": "", ... } } ``` -------------------------------- ### Get NFT Holders by Token ID (curl) Source: https://developer.nodit.io/reference/ethereum-getnftholdersbytokenid Example request to the Nodit API to get NFT holders for a specific token ID. This command-line interface example demonstrates how to structure the POST request with necessary parameters. ```curl curl -X POST \ https://web3.nodit.io/v1/{protocol}/{network}/nft/getNftHoldersByTokenId \ -H 'Content-Type: application/json' \ -d '{ "contractAddress": "0x7E6027a6A84fC1F6Db6782c523EFe62c923e46ff", "tokenId": "35454851340381403053777570024400663652390298901786737272698135080385313339362", "page": 1, "rpp": 100, "cursor": "", "withCount": true }' ```