Hello, it’s GetBlock. Today, we are going to show you what is going on when our clients are getting connected to Litecoin, one of the earliest Bitcoin (BTC) forks and large Proof-of-Work network.
Although Litecoin doesn’t support smart contracts, its node is very popular for analytical services, trading bots, charts dashboards, cross-chain DEXes and so on.
In this short guide we will experiment with Litecoin shared nodes. It is an entry-level offering by GetBlock: your services are using the same node with other clients. There's also a video on Youtube on how to connect to Litecoin (LTC) Node.
As such, we need to open the ‘Shared Nodes’ section in the Main Menu.
Let’s find the Litecoin node. You can use the ticker LTC.
To start the demonstration we need to copy the endpoint address from the ‘Endpoints’ tab.
Then, we should copy the endpoint address to the Postman terminal and choose ‘POST’ as the type of request by changing ‘GET’ value to ‘POST’ value.
Once this is done, go to the ‘Headers’ tab and set the parameters of our connection. First, let’s input ‘x-api-key’ as the type of our key.
To set the ‘VALUE’ properly, we need to have our unique API key, i.e. the number of our account assigned by GetBlock mechanisms.
To do so, we need to get back to our GetBlock account and open the ‘Your API settings’ segment. We copy API data from the black field and paste them into the corresponding string of ‘Headers’.
(Once API data is filled, we need to set other inputs for our request in the ‘Body’ tab. We need ‘raw’ data about the blockchain processes, so let's choose ‘RAW’ as a type of data requested and JSON as data format.
To set up the body of our request, let’s get back to GetBlock once again. In the ‘Main menu’, let’s open the ‘Documentation’ module.
Then please find the drop-down menu ‘Available Nodes Methods’ in the left section of the menu. Find the Litecoin point and choose ‘getblockhash’ command.
What does this mean? This command allows us to see the hash (‘secret’) of the block with this or that number. In blockchains, hashes are used to secure the integrity of the block mining process.
As such, we need to copy the last seven strings of the requests (the part that starts after the words ‘data raw’) and paste it into the request field.
Right now, just one thing separates us from sending the request to the Litecoin blockchain: we need to know the number of blocks we’re seeking for a hash of.
Let’s just repeat our first steps: go to the Litecoin section in the ‘Shared Nodes’ menu. Then, please, copy the ‘Height’ value: in blockchains, the number of last blocks added is called ‘block height’.
Then, let’s copy this number to the ‘Params’ string and send the request (blue button in the upper right) to blockchain.
And that’s it: the hash is demonstrated in the ‘Result’ string. We’re good to go: we just reached the Litecoin blockchain with our GetBlock API key and extracted crucial raw data.
Have a great day and stay tuned for more updates from us!