Integrating BSV Into Your Application - It-s-A-Draft/Build-on-Bitcoin-SV GitHub Wiki
Fundamentally, the only difference between building a traditional application and building a Bitcoin application is the integration of Bitcoin into the process. This document sets out to help you do just that. It is different than our other Learning Path documents because it is designed to give you the resources you need directly, using outside resources as a supplement to the process.
It is highly recommended that you have a general background knowledge of Bitcoin before you work to integrate it into your application.
Integrating into Your Application
For the purposes of this document, we will assume that you are building a traditional web application with a front and back end, and a database for your specific business concerns.
While this assumption will not fit all people’s work, we consider this to be the best one-size-fits-all starting point for getting people started building Bitcoin apps. Not only does it fit a large class of use cases, but portions of this guide can be used independently with different application designs. It is currently left as an exercise for the reader to determine how to mix and match these tools to fit specific application architectures. Tools
For the purposes of this guide, we will be focusing on four specific tools that can help you get started integrating Bitcoin into your application:
- BSV.js Library
- TxForge.js Library
- TXQ Transaction Storage Queue
- [NEED A READING FROM THE CHAIN TOOL]
- [NEED WALLET/PAYMENTS INTEGRATIONS]
These tools are all programmed in JavaScript, or TypeScript, making them accessible to anyone following our complete Building on BSV Learning Path
BSV.js Library
The BSV.js Library is developed by MoneyButton
The BSV.js library provides wallet functionality such as creating a private key, building an associated public/private key pair, and building transactions.
This is a relatively low level library and, while it is very powerful, it is also somewhat difficult to get started with. As such, we also recommend that you use TxForge.js.
TxForge.js Library
The TxForge.js Library is developed by Libitx
TxForge is an interface to the BSV.js library that enables more intuitive transaction construction, including the creation of “Casts” that define custom or standard transaction types. To be clear, it is possible to do everything TxForge does with BSV.js alone, but TxForge makes life a lot easier for a developer, especially one who is new to building on Bitcoin.
With TxForge, all you need is a UTXO associated with your public/private key pair, and the transaction outputs you’d like to create, as well as a Cast for the transaction type you want to build.
With these, you can build your transaction and return a rawtx, which can be broadcast to the network, or sent through other tools such as TXQ to maintain a dedicated, application specific storage pool for transactions you care about.
TXQ Transaction Storage Queue
The TXQ Transaction Storage Queue application is developed by Matterpool
TXQ is a transaction management tool designed to be your interface between miners and your application. TXQ stores all transactions you send to it and automatically syncs them with miners to be included in the blockchain. Additionally, all transactions stored in TXQ can be stored with associated metadata that is not a part of the transaction itself, meaning it is not included in the blockchain.
TXQ serves as a repository for all transactions you have added to it, along with their associated metadata, enabling you to find your transactions without relying on third parties such as miners or transaction indexers.
Ideally, every transaction your application is involved with will be stored in TXQ, enabling you to scale your application separately from dependencies on third parties.
However, TXQ can only serve transactions it has in local storage. For this reason, if your application depends on pulling information from third parties rather than sourcing all transactions through your application and sending them to miners for settlement, you will need another tool to gather transactions from those third parties.
Additionally, in the case of a catastrophic failure, any transactions that are lost from your TXQ dataset may be recovered from the blockchain through third parties (likely at a cost,) if you have a means of identifying them among the global transaction set on chain. As such, it is useful to have a tool with which to read from the chain, or to gather specific transactions from transaction indexing services.
READING FROM THE CHAIN TOOL
[Tool info here]
INTEGRATING WITH WALLETS/PAYMENTS
[Tool(s) info here]
Building Your Application
Developing With the Testnet
Bitcoin Test Networks In order to facilitate development of software built to use Bitcoin as a base layer, and the Bitcoin mining node client… wiki.bitcoinsv.io
Bitcoin SV Testnet Faucet Bitcoin SV testnet and scaling testnet (STN) faucet faucet.bitcoincloud.net
BSV Explorer — Testnet Leading Blockchain Explorer for Bitcoin SV. Blocks, Transactions tagged from memo.cash, yours.org, tokenized and… test.whatsonchain.com