Overview

Getting Started with GetBlock

To get started, follow these steps:

  1. Sign up: Create an account to access your Access Token.

  2. Generate access token: Navigate to the dashboard, and generate your first access token for API authentication.

  3. Choose the blockchain name and type: Select the blockchain network you want to interact with, set up testnet/mainnet, and choose the interface you’re going to use.

  4. Send your first request:

import requests
url = "https://go.getblock.io/<ACCESS-TOKEN>/"
headers = { "Content-Type": "application/json" }
payload = { "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": "getblock.io" }
response = requests.post(url, headers=headers, json=payload)
print(response.json())

Key Features of GetBlock

GetBlock is offering one of the most comprehensive APIs toolkits in the segment supporting hundreds of dApps with fast and reliable connection to blockchain nodes.

50+ blockchains in store

  • Seamless connection to full and archive nodes

  • Shared and dedicated nodes: Tailored for your dApp’s needs.

  • Programmable and non-programmable blockchains

  • L1 and L2 protocols

  • EVM and non-EVM networks

  • WebSockets

  • JSON RPC

  • GraphQL

  • REST API

  • And more to come

Industry-leading suite of add-ons and ready-made APIs

  • DAS API

  • Firehose

  • Blockbook

  • Yellowstone Geyser

Examples for Console REST API Requests

cURL

Most *nix-based systems come with cURL pre-installed. cURL is a command-line tool and library for transferring data with URLs. To check if cURL is installed, run the following command:

curl -h

Example of requesting the latest block number using the GetBlock API and cURL:

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": "getblock.io"
}'

Python

To run Python examples, ensure Python is installed along with the requests package. You can install the package using the following command:

python -m pip install requests

Example:

import requests
url = "https://go.getblock.io/<ACCESS-TOKEN>/"
headers = { "Content-Type": "application/json" }
payload = { "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": "getblock.io" }
response = requests.post(url, headers=headers, json=payload)
print(response.json())

JavaScript

For JavaScript examples, you'll need Node.js version 18 or later. Follow the official documentation to install the latest stable version globally. Verify your installation by running:

node -v

Ruby

To execute Ruby examples, install Ruby on your machine. Refer to the official installation guide for details. Confirm installation by running:

ruby -v

Supported networks

We provide APIs for a wide range of networks, including:

Last updated