2016-10-19 15:38:53 +10:00
Building From Source
2014-10-03 11:43:42 +02:00
====================
This guide will walk you through the process of building Bitsquare from source.
> _**NOTE:** For most users, building from source is not necessary. See the [releases page](https://github.com/bitsquare/bitsquare/releases), where you'll find installers for Windows, Linux and Mac OS X._
2016-08-02 11:10:47 +02:00
There is an install script (2 parts) for setup (JDK, git, maven, Bitcoinj, Bitsquare) on Linux in that directory (install_on_unix.sh, install_on_unix_fin.sh).
2016-07-25 19:37:15 +02:00
System requirements
2014-10-03 11:43:42 +02:00
-------------
2016-10-20 19:15:44 +10:00
The prerequisite for building Bitsquare is installing the Java Development Kit (JDK), version 8u112 or better (as well as maven and git).
2016-03-16 14:43:00 +01:00
In Debian/Ubuntu systems with OpenJDK you'll need OpenJFX as well, i.e. you'll need the `openjfx` package besides the `openjdk-8-jdk` package.
2014-10-03 11:43:42 +02:00
2017-02-09 22:09:05 -05:00
$ sudo apt-get install openjdk-8-jdk maven libopenjfx-java
2016-07-25 19:37:15 +02:00
### 1. Check the version of Java you currently have installed
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
$ java -version
2014-10-03 11:43:42 +02:00
2017-02-07 18:46:11 -05:00
If `java` is not found, or your version is anything less than `1.8.0_121` , then follow the next steps, otherwise you can skip to step 2:
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
#### 1.1 Debian based systems (Ubuntu)
2016-06-25 11:29:07 +02:00
2016-10-06 03:50:32 +02:00
You can use either OpenJDK or Oracle JDK.
**To install OpenJDK use:**
2016-06-25 11:29:07 +02:00
$ sudo apt-get install openjdk-8-jdk maven libopenjfx-java
2016-06-25 12:52:03 +02:00
2016-10-06 03:50:32 +02:00
Unfortunately, Ubuntu 14.04 & Linux Mint 17.3 are missing OpenJdk 8 and OpenJFX, so this might be useful:
If `openjdk-8-jdk` is not found you can add this ppa, update, then try again:
$ sudo apt-add-repository ppa:openjdk-r/ppa & & sudo apt-get install openjdk-8-jdk
If `libopenjfx-java` is not found you can build & install it yourself:
* [How to install OpenJFX on Ubuntu 14.04 or Linux Mint 17.3 ](http://askubuntu.com/questions/833193/how-do-i-install-openjfx-on-ubuntu-14-04-linux-mint-17 )
**To install the Oracle JDK use:**
2016-06-25 12:52:03 +02:00
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
2016-08-02 11:10:47 +02:00
$ sudo apt-get -y install oracle-java8-installer
2016-07-25 19:37:15 +02:00
2016-10-06 03:50:32 +02:00
**Check if $JAVA_HOME is set:**
2016-06-25 12:52:03 +02:00
2016-07-25 19:37:15 +02:00
$ echo $JAVA_HOME
2016-06-25 12:52:03 +02:00
2016-10-06 03:50:32 +02:00
If `$JAVA_HOME` is not present, open your `.bashrc` file:
$ touch ~/.bashrc
$ gedit ~/.bashrc
For OpenJDK add: `export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64`
For Oracle JDK add: `export JAVA_HOME=/usr/lib/jvm/java-8-oracle`
Save and close the file.
Reload the file in your shell:
$ . ~/.bashrc
$ echo $JAVA_HOME
2016-06-25 11:29:07 +02:00
2016-07-25 19:37:15 +02:00
#### 1.2 Other systems
2016-06-25 11:29:07 +02:00
2016-10-18 18:04:58 +02:00
[Download and install the latest Oracle JDK ](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html ) for your platform.
For Mac OSX, you will need to set JAVA_HOME as:
$ echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.bashrc
$ . ~/.bashrc
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
Build bitcoinj
-----------------
2016-10-06 03:50:32 +02:00
### 2. Install bitcoinj fork
> _**NOTE:**
Bitcoinj versions later than 0.13.1 has removed support for Java serialisation.
Version 0.13.1 is also missing support for Java serialisation in MainNetParams (HttpDiscovery.Details).
2016-11-19 14:31:41 +01:00
We removed usage of Cartographer/HttpDiscovery in our [fork of version 0.13.1.7 ](https://github.com/bitsquare/bitcoinj/tree/FixBloomFilters ).
2016-10-06 03:50:32 +02:00
Beside the Java serialisation issues there are [privacy concerns ](http://bitcoin-development.narkive.com/hczWIAby/bitcoin-development-cartographer#post3 ) regarding Cartographer.
2016-10-18 18:04:58 +02:00
Here is a Github issue with background and open tasks regarding [Bloom Filters ](https://github.com/bitsquare/bitsquare/issues/414 )._ Note: use a fresh directory, this should not be done inside the bitsquare folder.
2016-10-06 03:50:32 +02:00
2016-10-18 18:04:58 +02:00
$ cd ..
2016-10-06 03:50:32 +02:00
$ git clone -b FixBloomFilters https://github.com/bitsquare/bitcoinj.git
$ cd bitcoinj
2016-04-30 01:05:24 +02:00
$ mvn clean install -DskipTests -Dmaven.javadoc.skip=true
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
Prepare Bitsquare build
-----------------
### 3. Get Bitsquare source code and build a preliminary Bitsquare version
2014-10-03 11:43:42 +02:00
2016-10-19 16:53:06 +02:00
You need to get the Bitsquare dependencies first as we need to copy the BouncyCastle jar to the JRE directory.
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
$ git clone https://github.com/bitsquare/bitsquare.git
2015-03-03 23:09:04 +01:00
$ cd bitsquare
2016-07-25 19:37:15 +02:00
$ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
2016-10-06 03:50:32 +02:00
2016-10-19 16:53:06 +02:00
### 4. Copy the BouncyCastle provider jar file
2016-07-25 19:37:15 +02:00
Copy the BountyCastle provider jar file from the local maven repository to the jre/lib/ext directory.
This prevents a "JCE cannot authenticate the provider BC" exception when starting the Bitsquare client.
2016-10-06 03:50:32 +02:00
$ sudo cp ~/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.53/bcprov-jdk15on-1.53.jar $JAVA_HOME/jre/lib/ext/
2016-07-25 19:37:15 +02:00
2016-10-19 16:53:06 +02:00
###5. Edit the java.security file and add BouncyCastleProvider
2016-07-25 19:37:15 +02:00
Add org.bouncycastle.jce.provider.BouncyCastleProvider as last entry at: List of providers and their preference orders
E.g.:
security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider
2016-10-06 03:50:32 +02:00
2016-07-25 19:37:15 +02:00
$ sudo gedit $JAVA_HOME/jre/lib/security/java.security
... edit and save
2016-10-06 03:50:32 +02:00
2016-10-19 16:53:06 +02:00
### 6. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK)
2016-07-25 19:37:15 +02:00
2016-10-18 18:04:58 +02:00
If you are using Oracle JDK 8 you must ** [enable strong cryptographic cyphers ](https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md )**. If you use OpenJDK + OpenJFX you can skip this step.
2016-10-06 03:50:32 +02:00
2016-10-19 15:38:53 +10:00
In Windows the new crypto files need to be copied to `Java/jdk1.8.0_xxx/jre/lib/security` AND `Java/jre1.8.0_xxx/jre/lib/security` otherwise the test in the above page will fail.
2014-10-03 11:43:42 +02:00
2016-07-25 19:37:15 +02:00
Build Bitsquare
-----------------
2016-10-19 16:53:06 +02:00
### 7. Build final Bitsquare jar
2014-10-03 11:43:42 +02:00
2016-10-06 03:50:32 +02:00
Now we have all prepared to build the correct Bitsquare jar.
2016-07-25 19:37:15 +02:00
$ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
2016-10-06 03:50:32 +02:00
When the build completes, you will find an executable jar: `gui/target/shaded.jar` .
2015-03-03 23:09:04 +01:00
To run it use:
2014-10-03 11:43:42 +02:00
2015-05-04 01:17:27 +02:00
$ java -jar gui/target/shaded.jar
2016-07-25 19:37:15 +02:00
Build binaries
-----------------
2016-10-06 00:10:42 +02:00
If you want to build the binaries check out the build scripts under the package directory.
2016-07-25 19:37:15 +02:00
Development mode
-----------------
2016-10-06 03:50:32 +02:00
2016-07-26 18:35:24 +02:00
Please check out our wiki for more information about [testing ](https://github.com/bitsquare/bitsquare/wiki/Testing-Bitsquare-with-Mainnet )
2015-12-19 18:05:22 +01:00
and how to use [regtest ](https://github.com/bitsquare/bitsquare/wiki/How-to-use-Bitsquare-with-regtest-%28advanced%29 )
2014-10-03 11:43:42 +02:00
2016-10-06 03:50:32 +02:00
Here are example program arguments for using regtest with localhost environment (not using Tor):
$ java -jar seednode/target/SeedNode.jar --bitcoinNetwork=REGTEST --useLocalhost=true --myAddress=localhost:2002 --nodePort=2002 --appName=Bitsquare_seed_node_localhost_2002
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --useLocalhost=true --myAddress=localhost:2222 --nodePort=2222 --appName=Bitsquare-Local-Regtest-Arbitrator
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --useLocalhost=true --myAddress=localhost:3333 --nodePort=3333 --appName=Bitsquare-Local-Regtest-Alice
2016-07-25 19:37:15 +02:00
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --useLocalhost=true --myAddress=localhost:4444 --nodePort=4444 --appName=Bitsquare-Local-Regtest-Bob
2016-10-06 03:50:32 +02:00
2016-07-25 19:37:15 +02:00
Running local seed node with Tor and RegTest
-----------------
2015-12-20 15:39:39 +01:00
If you want to run locally a seed node via Tor you need to add your seed node's hidden service address to the SeedNodesRepository.java class.
2016-10-06 03:50:32 +02:00
You can find the hidden service address after you started once a seed node. Start it with a placeholder address like:
2016-07-25 19:37:15 +02:00
$ java -jar seednode/target/SeedNode.jar --bitcoinNetwork=REGTEST --nodePort=8002 --myAddress=xxxxxxxx.onion:8002 --appName=Bitsquare_seed_node_xxxxxxxx.onion_8000
2016-10-06 03:50:32 +02:00
Once the hidden service is published (check console output) quit the seed node and copy the hidden service address from the console output.
2015-12-20 15:39:39 +01:00
Alternatively you can navigate to the application directory and open Bitsquare_seed_node_xxxxxxx.onion_8002/tor/hiddenservice/hostname.
use that hidden service address also to rename the xxxxxxx placeholder of your Bitsquare_seed_node_xxxxxxx.onion_8002 directory.
Start again the SeedNode.jar now with the correct hidden service address.
2016-02-11 11:09:40 +01:00
Instructions are also at the SeedNodesRepository class.
2016-10-06 03:50:32 +02:00
Here are example program arguments for using regtest and using the Tor network (example onion address is ewdkppp3vicnbgqt):
$ java -jar seednode/target/SeedNode.jar ewdkppp3vicnbgqt.onion:8002 2 50
$ java -jar seednode/target/SeedNode.jar --bitcoinNetwork=REGTEST --nodePort=8002 --myAddress=ewdkppp3vicnbgqt.onion:8002 --appName=Bitsquare_seed_node_ewdkppp3vicnbgqt.oinion_8002
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --myAddress=localhost:2222 --nodePort=2222 --appName=Bitsquare-Local-Regtest-Arbitrator
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --myAddress=localhost:3333 --nodePort=3333 --appName=Bitsquare-Local-Regtest-Alice
2016-07-25 19:37:15 +02:00
$ java -jar gui/target/shaded.jar --bitcoinNetwork=REGTEST --myAddress=localhost:4444 --nodePort=4444 --appName=Bitsquare-Local-Regtest-Bob
2016-10-06 03:50:32 +02:00
2014-10-03 11:43:42 +02:00
Problems?
---------
If the instructions above don't work for you, please [raise an issue ](https://github.com/bitsquare/bitsquare/issues/new?labels=%5Bbuild%5D ). Thanks!