How To Connect to Bitcoin Node via GetBlock

By GetBlock | GetBlock News & Updates | 28 Oct 2022


Hello everyone, today we’re going to demonstrate what is under the hood of GetBlock’s API nodes connection instruments.

Let’s try reaching the Bitcoin node via GetBlock API and check the header of the Bitcoin block. Block header represents the encrypted summary of the information about this or that block; the blockchain algorithm needs it to find the block.

We’re going to experiment with Bitcoin, a flagship cryptocurrency and the earliest of all blockchain in existence. It was proposed in 2008 by a pseudonymous developer Satoshi Nakamoto as a first implementation of the blockchain concept itself.

Let’s choose the Bitcoin endpoint on GetBlock. To achieve this goal, we need to open the ‘Shared Nodes’ section in Main Menu.

In the first row, we see ‘Bitcoin’, ‘Ethereum’ and ‘Binance Smart Chain’ blockchains. Let’s open the first one.

Bitcoin’ dashboard GetBlock

In the ‘Bitcoin’ dashboard, we need to find the URL of its endpoint and copy it.

In parallel, let’s launch Postman terminal, a user-friendly instrument for experiments with API requests. Then, let’s paste the address of the endpoint to the corresponding field.

Postman terminal

To continue our experiment, we need to specify the parameters of our API request. To set the ‘VALUE’ properly, we should copy the number of our API key. GetBlock utilizes this public number to identify the accounts of users and their requests.

To do so, we need to open the ‘Your API settings’ segment. We copy the API public address from the black box and paste it into the ‘VALUE’ field.

x-api-key

Once this is done, we should set the parameters of our request in the ‘Headers’ tab. We should set ‘x-api-key’ as the type of our key.

Once API data is filled, let’s set the rest of the parameters in the ‘Body’ tab. Please choose ‘RAW’ as a type of data requested — as we need the unprocessed ‘raw’ data from the Bitcoin blockchain — and JSON as data format.

Main menu

To fill the main body of our request, we need to open the GetBlock website main page once again by clicking ‘Back to the site’. In the ‘Main menu’, choose the ‘Documentation’ tab.

In the drop-down menu ‘Available Nodes Methods’ in the left section of the screen. Find the Bitcoin (first point) and choose ‘getblockheader’ command.

As we know already, block header is a crucial data set which is unique for different blocks. Choose the ‘getblockheader’ command and copy the code of request. We need the code part between ‘json rpc’ and ‘getblock.io’ strings.

Code the text of request to the Postman ‘body’ field. To authorize the request we need to choose ‘POST’ as the type of request (‘GET’ type is set by default).

To send a request you should click the ‘SEND’ button. The result of the request will be displayed in the lower field. All data about the latest mined block will be displayed here.

That’s it, enjoy our tutorial and have a great day!

There’s also a video version of it.

How do you rate this article?

31


GetBlock
GetBlock Verified Member

GetBlock is a Blockchain RPC provider that offers fast and easy API connection to full nodes of 50+ blockchains, including Bitcoin (BTC), Ethereum (ETH), Binance Smart Chain (BSC), among others.


GetBlock News & Updates
GetBlock News & Updates

GetBlock is a Blockchain-as-a-Service (BaaS) platform that provides a fast and easy API connection to full nodes from many leading blockchain platforms. Here we're going to publish updates related to the project development.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.