Following up on our latest API article on Litecoin, here is another hard fork on Bitcoin blockchain: Bitcoin Cash. Before diving into this, we suggest to briefly go through Bitcoin, to better understand its features.
Firstly, this fork was done with the premises to increase the block size from 1 MB to at least 8 MB in 2017. Ever since, the block size can go up to 32 MB. This basically means more transactions per block, less efforts, waiting time and processing costs. For instance, the usual number of transactions per block on Bitcoin is somewhere in the range of 1000 and 1500. On Bitcoin Cash that number reached 25000 for each block. Above all, this has been argued to be one of this fork’s major advantages towards the vision of scalability and adoption.
Secondly, Bitcoin Cash does not include SegWit solution (check Segregated Witness on our glossary). It doesn’t follow the logic of having metadata of a transaction, rather stores the entire data in the block.
However, the two blockchains do have similarities. They both:
- use the same consensus mechanism in mining (Proof of Work)
- use the same algorithm (Emergency Difficulty Adjustment)
- have the same supply cap (21 million).
Hence, the API endpoints are similar to the ones also provided by Bitcoin APIs.
Finally, the focus of this article will be on 3 use cases that CryptoAPIs provides through the use of Bitcoin Cash API: transactions, payment forwarding and webhook notifications.
New transaction endpoint
The New Transaction Endpoint combines three endpoints: Create, Sign and Send Endpoints. Users should provide:
- the inputs and outputs fields with the corresponding data
- the fee
- the wifs (private ECDSA keys) of the addresses
Then, the POST request creates, signs and broadcasts the new transaction to the Bitcoin Cash Blockchain.
where PAYMENT_UUID is the Generated UUID when payment forwarding have been created and it is represents the payment forwarding request the user wants to delete.
Create Transaction Confirmations Webhook
Webhooks are essential when it comes to automatic confirmations on transactions happening behind-the-scenes. So by creating Confirmed Transaction Webhook, the user will receive a notification after every confirmation (new block) for every new incoming/outgoing transaction.
The confirmations shows the number of confirmations before receiving Webhook. This can be any number between 1 and 20. Set to 1 means that webhooks will be sent immediately after the block that includes transactions with the specified address is mined. However, since there is the possibility of blockchain block re-write, we suggest that users set the confirmations at least to 3.
In conclusion, these are a few examples of how endpoints help in integrating the Bitcoin Cash API into your website. They provide the backbone into the complete process of participating in this blockchain.