Building a Bitcoin Payment System

The previous chapter was an excellent starting point for understanding the blockchain and learning about bitcoin. In fact, we covered many basic concepts and elementary operations, such as signing, sending raw transactions, and storing data in the blockchain. In this chapter, we'll continue to explore the blockchain, firstly by building a customer-friendly payment system based on the Bitcoin payment protocol, and secondly, by building our first smart contract in the bitcoin system.

The end goal of this chapter is to help you acquire the necessary technical background to understand bitcoin's mechanics and build your first  bitcoin applications using very common languages such as JavaScript and Java. If you're an experienced programmer, most likely you are familiar with one of these technologies; if not, I recommend you spend time reading their official "getting started" documentation.

Throughout this chapter, we will cover the following key points:

  • Introducing bitcoin
  • Building a BIP 70 payment system using Node.js and bitcore-lib
  • Building a bitcoin client using BitcoinJ
  • Writing and deploying a smart contract in bitcoin using Rootstock

This is a fully hands-on coding chapter; I will insist that you code each of the snippets presented herein to make sure you get the most out of the chapter. Happy coding!