### Automake Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing Automake. ```bash #!/bin/bash # Install Automake apt-get update -yqq apt-get install -yqq automake ``` -------------------------------- ### Postgres Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing PostgreSQL. ```bash #!/bin/bash # Install PostgreSQL 12, 13, 14 apt-get update -yqq apt-get install -yqq postgresql ``` -------------------------------- ### Node.js Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing Node.js. ```bash #!/bin/bash # Install Node.js 18.x.x apt-get update -yqq apt-get install -yqq nodejs ``` -------------------------------- ### Libtool Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing Libtool. ```bash #!/bin/bash # Install Libtool apt-get update -yqq apt-get install -yqq libtool ``` -------------------------------- ### Erlang Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing Erlang/OTP. ```bash #!/bin/bash # Install Erlang/OTP 26 apt-get update -yqq apt-get install -yqq erlang ``` -------------------------------- ### Elixir Install Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing Elixir. ```bash #!/bin/bash # Install Elixir 1.15.x apt-get update -yqq apt-get install -yqq elixir ``` -------------------------------- ### Install GMP Devel Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing GMP development files. ```bash #!/bin/bash # Install GMP Devel apt-get update -yqq apt-get install -yqq libgmp-dev ``` -------------------------------- ### Quick Start: Get ETH Balance Source: https://docs.blockscout.com/base-api This example demonstrates how to quickly get the ETH balance for a given address on the Base network using the Blockscout PRO API. ```APIDOC ## Quick Start: Get ETH Balance ### Description Get your first API response in under 60 seconds by fetching the ETH balance for an address on Base. ### Method `curl` (Example) ### Endpoint `https://api.blockscout.com/v2/api?chain_id=8453&module=account&action=balance&address=0xYOUR_ADDRESS&apikey=proapi_YOUR_KEY` ### Parameters #### Query Parameters - **chain_id** (string) - Required - The chain ID for Base (`8453`). - **module** (string) - Required - Specifies the module to use, e.g., `account`. - **action** (string) - Required - Specifies the action to perform, e.g., `balance`. - **address** (string) - Required - The Ethereum address to query. - **apikey** (string) - Required - Your Blockscout PRO API key. ### Request Example ```bash # Get ETH balance for an address on Base via PRO API curl "https://api.blockscout.com/v2/api?chain_id=8453&module=account&action=balance&address=0xYOUR_ADDRESS&apikey=proapi_YOUR_KEY" ``` ### Response #### Success Response (200) - **status** (string) - API response status ('1' for success). - **message** (string) - API response message ('OK' for success). - **result** (string) - The ETH balance of the address. ``` -------------------------------- ### GCC Compiler Example Source: https://docs.blockscout.com/setup/requirements/requirements Example script for installing GCC Compiler. ```bash #!/bin/bash # Install GCC Compiler apt-get update -yqq apt-get install -yqq gcc ``` -------------------------------- ### Install PostgreSQL on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing PostgreSQL on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install postgresql postgresql-contrib ``` -------------------------------- ### Install Node.js on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing Node.js on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install nodejs npm ``` -------------------------------- ### Install Libtool on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing Libtool on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install libtool ``` -------------------------------- ### Install Automake on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing Automake on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install automake ``` -------------------------------- ### Install Erlang/OTP on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing Erlang/OTP on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install erlang-base erlang-dev erlang-escript erlang-runtime-tools erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl ``` -------------------------------- ### Install Elixir on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing Elixir on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install elixir ``` -------------------------------- ### Install GMP on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing GMP on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install libgmp-dev ``` -------------------------------- ### Install GCC Compiler on Ubuntu Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide Example command for installing GCC Compiler on Ubuntu systems. Refer to the linked Terraform script for specific version management. ```bash apt-get install build-essential gcc ``` -------------------------------- ### Quick Start: Get ETH Balance Source: https://docs.blockscout.com/optimism-api A quick example using curl to fetch the ETH balance for a given address on Optimism via the PRO API. ```APIDOC ## Quick Start: Get ETH Balance ```bash # Get ETH balance for an address on Optimism via PRO API curl "https://api.blockscout.com/v2/api?chain_id=10&module=account&action=balance&address=0xYOUR_ADDRESS&apikey=proapi_YOUR_KEY" ``` Get a free API key at [dev.blockscout.com](https://dev.blockscout.com) — required for all PRO API tiers, including free. ``` -------------------------------- ### Create and Migrate Database Source: https://docs.blockscout.com/setup/deployment/manual-old-ui Create the database and run migrations to set up the schema. Be cautious when running `mix do ecto.drop, ecto.create, ecto.migrate` in development as it will delete all data. ```bash mix do ecto.create, ecto.migrate ``` -------------------------------- ### Install and Start PostgreSQL 14 Source: https://docs.blockscout.com/setup/deployment/manual-deployment-guide/macos-setup Installs PostgreSQL version 14 using Homebrew and starts the service. This database is required for Blockscout. ```sh brew install postgresql@14 brew services start postgresql@14 ``` -------------------------------- ### Install Inotify-tools on Ubuntu Source: https://docs.blockscout.com/setup/requirements/requirements Install inotify-tools on Ubuntu using apt-get. ```bash apt-get install inotify-tools ``` -------------------------------- ### Start BlockScout Server Source: https://docs.blockscout.com/setup/configuration-options/untitled-2 Starts the BlockScout web server using Mix and Phoenix. This command is used after installing Prometheus and before starting Prometheus. ```bash iex -S mix phx.server ``` -------------------------------- ### Merge Blockscout and All Configuration Files Source: https://docs.blockscout.com/setup/deployment/ansible-deployment/deploying-blockscout Combine 'blockscout.yml.example' and 'all.yml.example' into a single host-specific configuration file. This is a common step for setting up individual Blockscout instances. ```bash cat host_vars/blockscout.yml.example host_vars/all.yml.example > host_vars/host.yml ``` -------------------------------- ### Start Grafana Service Source: https://docs.blockscout.com/setup/configuration-options/untitled-2 Starts the Grafana service using Homebrew services. This command assumes Grafana has been installed. ```bash brew services start grafana ``` -------------------------------- ### Start PostgreSQL Server Source: https://docs.blockscout.com/setup/deployment/manual-old-ui Start the PostgreSQL server if it is not already running. The command may vary depending on your PostgreSQL installation. ```bash pg_ctl -D /usr/local/var/postgres start ``` -------------------------------- ### Run tests with Geth and Mox Source: https://docs.blockscout.com/setup/testing Setup for running tests with Geth and Mox. ```bash ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Geth.Mox \ ETHEREUM_JSONRPC_WEB_SOCKET_CASE=EthereumJSONRPC.WebSocket.Case.Mox \ mix test --no-start --exclude no_geth ``` -------------------------------- ### Launch with Geth Client Source: https://docs.blockscout.com/setup/deployment/docker-compose-deployment Starts Blockscout containers configured to connect to a Geth (or Reth) Ethereum JSON RPC client. ```bash docker compose -f geth.yml up -d ``` -------------------------------- ### Keyset Pagination Example Source: https://docs.blockscout.com/devs/wallet-history Demonstrates how to use keyset pagination parameters to fetch subsequent pages of results. The `next_page_params` object from a response should be appended to the next request. ```json { "items": [ ... ], "next_page_params": { "block_number": 18678766, "index": 119, "items_count": 50 } } ``` ```bash curl "https://api.blockscout.com/1/api/v2/addresses/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/transactions?block_number=18678766&index=119&items_count=50&apikey=YOUR_KEY" ``` -------------------------------- ### Launch with Erigon Client Source: https://docs.blockscout.com/setup/deployment/docker-compose-deployment Starts Blockscout containers configured to connect to an Erigon Ethereum JSON RPC client. ```bash docker compose -f erigon.yml up -d ``` -------------------------------- ### Get ERC-20 Token Balance Source: https://docs.blockscout.com/api-reference/account/get-erc-20-token-balance-for-a-single-address This example demonstrates how to get the ERC-20 token balance for a single address using the Blockscout RPC API. ```APIDOC ## GET /?module=account&action=tokenbalance ### Description Returns the token balance for a specific token contract and address ### Method GET ### Endpoint /?module=account&action=tokenbalance ### Parameters #### Query Parameters - **module** (string) - Required - Module name (must be 'account') - **action** (string) - Required - Action name (must be 'tokenbalance') - **contractaddress** (string) - Required - Token contract address - **address** (string) - Required - Account address ### Response #### Success Response (200) - **result** (string) - Token balance ### Request Example ``` https://eth-sepolia.blockscout.com/api?module=account&action=tokenbalance&contractaddress=0x1234567890abcdef1234567890abcdef12345678&address=0xabcdef1234567890abcdef1234567890abcdef12345678 ``` ### Response Example ```json { "status": "1", "message": "OK", "result": "135499" } ``` ``` -------------------------------- ### Get Token Holders Request Example Source: https://docs.blockscout.com/api-reference/token/get-token-holders This example demonstrates how to call the `getTokenHolders` endpoint using a GET request. You need to specify the token contract address and can optionally include pagination parameters like `page` and `offset`. API keys are optional but recommended for higher rate limits. ```http GET /?module=token&action=getTokenHolders&contractaddress=0x123...&page=1&offset=100 HTTP/1.1 Host: eth-sepolia.blockscout.com Accept: application/json ``` -------------------------------- ### Install Blockscout App SDK Source: https://docs.blockscout.com/devs/blockscout-sdk Install the SDK using npm or yarn. ```sh npm install @blockscout/app-sdk # or yarn add @blockscout/app-sdk ``` -------------------------------- ### Run Docker Containers (Pre-built Image) Source: https://docs.blockscout.com/setup/deployment/docker-compose-deployment Launches Blockscout using a pre-built backend Docker image. This is faster if no backend customizations are needed. ```bash docker compose up ``` -------------------------------- ### Start Autoscout Instance Request Source: https://docs.blockscout.com/devs/apis/autoscout-api Send a POST request to update the status of an instance to 'START'. Use the `instance_id` obtained from the creation step. The request body specifies the action to perform. ```text x-api-key: YOUR_API_KEY Content-Type: application/json ``` ```json { "action": "START" } ``` ```shellscript curl -X POST https://autoscout.services.blockscout.com/api/v1/instances/your-instance-id/status:update \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "START" }' ``` ```json { "status": "QUEUED", "deployment_id": "your-deployment-id" } ```