BitcoinJ installation

For this section, we will use BitcoinJ, which is a Java library designed to interact with the bitcoin network with support for BIP 70 (https://bitcoinj.github.io/payment-protocol). In order to make things simpler, we will install Maven's BitcoinJ plugin (version 0.14.17). If you're not a Java developer, Maven is a build automation tool for Java projects, used to download the dependencies required for a project.

Open Eclipse and create a new Maven project via File | New | Other…​ | Maven | Maven and follow the wizard instructions to finish the creation process (further instructions about setting up a Maven project are presented in Chapter 6, Blockchain-Based Futures System). Once the project is created, browse to the pom.xml file and add a reference to BitcoinJ and slf4j-api dependencies using the following lines inside: 

<dependency>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-core</artifactId>
<version>0.14.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>

Slf4J is the logging framework used by BitcoinJ. It serves to handle the logs and helps us understand, via valuable logging messages (network connection and transaction information), the behavior of the BitcoinJ application and evaluate its execution. After that, right-click the pom.xml file and select Run As | Maven to build and run the empty project.  

Now we can finally start programming using BitcoinJ.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset