Litecoin API and its usage

January 29, 2020

As an ever increasing number of individuals are grasping the universe of digital money, individuals are searching for alternatives to Bitcoin and Ethereum. A clear popular decision is Litecoin.

In the technical point of view, Litecoin is very similar to Bitcoin. It is a fork of Bitcoin with these essential differences:

Less block generation time (2.5 minutes compared to 10) 4 times higher limit for coin numbers (84 million instead of 21 million) Scrypt Hashing Algorithm (instead of SHA-256)

Litecoin has gained quite a momentum since its first release in 2011. It was the first to implement a solution, out of all top 5 blockchains by market cap, for the transaction space in the block which also affected its pose towards threats. This solution consists of Segwit. Litecoin was also used to complete the very first Lightning Network transaction from Zürich to San Francisco in under one second (check out our glossary if not familiar).

Hence, surely Litecoin couldn’t miss among the blockchains that CryptoAPIs supports through its Blockchain as a service APIs.

Its use cases match the ones of Bitcoin API, such as:

Transactions endpoint

Litecoin API allows you to look up information about unconfirmed transactions, query transactions based on hash, create and propagate your own transactions, including multisignature transactions, and embed data on the blockchain—all based on the Litecoin resource.

If you are not familiar with Bitcoin and the process of transaction, here is a quick recap on it:

“Unspent transaction outputs” (also known as UTXOs) go through as “transaction inputs”, on which it creastes new “locking scripts”. New addresses “receive” them (to become new UTXOs). While most of these public addresses are reference points for single private keys that can “unlock” the newly created UTXOs, occasionally they are sent to more exotic addresses through pay-to-script-hash, typically multisignature addresses.

How does Litecoin API help in getting transaction information?

Firstly, the information on such transactions goes through one of the endpoints based on the Txid, which is a string representing the id of the block you want to query, for example:

924e34052a093da9c9bb74ff1802034be5c98df811333a5da31437116ab81b5e

Secondly, the returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it (in litecoins), the inputs and outputs, and more.

Payment Forwarding endpoint

Payment Forwarding is an automatic way to move any received funds to another wallet, it mainly serves to move funds once cold wallets “receives” them.

CryptoAPIs do not take a fee on payment forwarding, other than the required miner fee; payments are free.

How does Litecoin API help in creating payment?

In order to create a payment forwarding you need to include the following data (POST request)

– wallet – from – to – callback (url) – wallet password – confirmations – fee (optional)

If field fee is not set, the payment forwarding will be executed with the recommended fee from the Transactions Fee Endpoint.

When payment forwarding is triggered you will receive a notification on the callback(url) you’ve specified when the payment forwarding was created.

Webhook Notifications endpoint

Instead of requiring the users to continuously poll resources, CryptoAPIs provides push Litecoin APIs to facilitate the process, and supports both WebSockets and Webhooks. Therefore, webhooks are the most reliable way to get event notifications but requires running a server to receive the callbacks. The trigger automatically retries HTTP requests 5 times.

Finally, a Webhook request expects a response with status code 200 (OK) or it will retry the request.

How does Litecoin API help in creating block Webhook?

For instance, by creating New Block Webhook, user receives a notification after every new block.

The request object will be as follows:

{ “event”: “NEW_BLOCK”, “url”:{CALLBACK_URL}

And the query parameters will be the network, event and callback url.

Hence, these are a few examples of how endpoints help in integrating the Litecoin API into your website. They provide the backbone into the complete process of participating in this blockchain.

Read more on our docs on Litecoin API.