Developing a Bitcoin application is very simple, even if you have to enter code by hand, as long as you have minimal programming knowledge. If there is something complicated it is understanding what pieces come into play and how. The rest do not change excessively compared to other types of applications, where in a few hours you can have something fully functional.
This article does not deal step by step with how to make an APP, but rather presents a mental outline of the pieces that make up a basic APP and how they interact.
Of course, it is advisable to understand the basics of Bitcoin.
Let us begin. We must think in a modular way. On the one hand there is our application and on the other, Bitcoin.
To interact with Bitcoin, it can be done in two ways: installing your own Bitcoin node or use the node of others. In both cases, they then interact through an API. Sometimes simpler APIs will be used, such as RESTful, and others a little more cumbersome in terms of JSON-RPC. However, luckily, programmers already have reusable libraries . to simplify both cases if desired.
In this case, let's imagine that we use the slightly more complex version, the one based on using your own Bitcoin node, which gives more autonomy and gives rise to a better understanding of how Bitcoin works.
A Bitcoin node is made up of 3 notable pieces:
The "demon": is connected to others nodes, which allows to create that P2P network where all the events that occur in the network are exchanged for sockets.
Blockchain: the database that records events locally on each node. Actually your application will not use that database, but its own if required.
API: Events are converted to a JSON response and transmitted over a port, it may or may not be protected from external listeners.
The node can be installed on a Unix or Windows computer and can be called or listened to when desired through the port it has for it, with or without authentication (to taste), being a channel for two-way communication: you can receive in real time what What happens in the node and you can send it information to do things or inform you of things. How to assemble your Bitcoin node in less than 10 minutes.
Of course you can develop the application in the language you want and it should not necessarily know excessively how the Bitcoin node works.
A simple application is made up of a backend, a database, and a frontend. So far nothing new. You can put an API or not ... the usual. The backend whenever it wants to interact with the Bitcoin network can call the RPC API node or listen to it to make decisions.
We put pieces together: Application + Bitcoin Node
Let's imagine we want to make a blockchain explorer. We simply have to put our backend to listen to all the events that occur in our node (which informs us of what happens in the network) and save the information that the node passes us in our database for subsequent consultations from the front where we show I asked for it.
It should be noted that having an APP similar to blockchain.info, a blockchain browser, with its own RESTful API as a private or public way to interact from your application is a matter of a couple of minutes with the development . called BitPay Insight.
Sending a payment to the network is also very simple, since once the transaction is prepared in the backend, what is done is send it to the node through the JSON-RPC API so that it retransmits it to the rest of nodes, and those to others and so on until it spreads throughout the network. This is why it is important to have the node well paired, and quality pairs, because this ensures that a transaction is retransmitted throughout the network very quickly and will make transactions be confirmed sooner.
Addresses and transactions are prepared offline. That is, the node is not needed for this, just to obtain the information. Then the transaction is prepared and sent to the already encrypted network.
Logically, for almost all languages there are already libraries that simplify everything where, once imported, their methods allow you to do the same but with less code.
Two libraries are normally used in the backend (although both could be in one, depending on the library). The first communicates with the Bitcoin node and the second is responsible for generating addresses or preparing transactions.
This is a simple example and a bird's-eye view of a typical simple organization, but its use, and creativity comes into play, is what makes it possible to create new use cases.
In almost all cryptocurrencies, their node and how they are interacted with at the schema scale is very similar. Setting up a cryptocurrency exchange (such as Coinbase or OKCoin) is not far from the principles that have been set forth here, yes, replicating everything: balanced backends, multiple nodes of each cryptocurrency in case one falls or becomes out of phase ...
A tip: if it is your first time developing on Bitcoin, the best thing is to rent a server (for example one of OVH by 5 € / month), it's a small investment and they give you a dedicated machine ready to “break” as many times as you need. In addition, downloading the blockchain there will be much faster and more comfortable. Then you can develop your APP locally and use the API of the Bitcoin node of the leased machine.
With this you have what it takes to make a mental sketch of where to start creating your application. Depending on the language you want to use, you should only search for the necessary libraries. For example, for NodeJS you can use Bitcore, which has everything you need in the same bookstore. Too Bitcoinjsalthough this only focuses on the working part offline of Bitcoin (create addresses, prepare transactions ...).