From 6b5ae740f578982190946b789570e67ac90754f2 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 22 Apr 2017 01:02:18 -0500 Subject: [PATCH] Add ScriptTypes: witness_v0_keyhash and witness_v0_scripthash. Use testnet genesis tx. Use version 0.5.8.1. of btcd rpc lib. Update docs --- core/pom.xml | 4 +-- .../core/dao/blockchain/btcd/ScriptTypes.java | 5 +++- .../dao/blockchain/parse/BsqChainState.java | 5 ++-- doc/build.md | 25 ++++++++++--------- doc/rpc.md | 13 +++++++--- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 56e7308b33..2a141f51a4 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -34,7 +34,7 @@ com.neemre.btcd-cli4j btcd-cli4j-core - 0.5.8 + 0.5.8.1 org.slf4j @@ -66,7 +66,7 @@ com.neemre.btcd-cli4j btcd-cli4j-daemon - 0.5.8 + 0.5.8.1 org.slf4j diff --git a/core/src/main/java/io/bisq/core/dao/blockchain/btcd/ScriptTypes.java b/core/src/main/java/io/bisq/core/dao/blockchain/btcd/ScriptTypes.java index dcfe9deb37..52500b05e0 100644 --- a/core/src/main/java/io/bisq/core/dao/blockchain/btcd/ScriptTypes.java +++ b/core/src/main/java/io/bisq/core/dao/blockchain/btcd/ScriptTypes.java @@ -32,11 +32,14 @@ import java.io.Serializable; @JsonIgnoreProperties(ignoreUnknown = true) public enum ScriptTypes implements Serializable { + // https://github.com/bitcoin/bitcoin/blob/8152d3fe57a991e9088d0b9d261d2b10936f45a9/src/script/standard.cpp PUB_KEY("pubkey"), PUB_KEY_HASH("pubkeyhash"), SCRIPT_HASH("scripthash"), MULTISIG("multisig"), NULL_DATA("nulldata"), + WITNESS_V0_KEYHASH("witness_v0_keyhash"), + WITNESS_V0_SCRIPTHASH("witness_v0_scripthash"), NONSTANDARD("nonstandard"); private final String name; @@ -57,6 +60,6 @@ public enum ScriptTypes implements Serializable { } } throw new IllegalArgumentException("Expected the argument to be a valid 'bitcoind' script type, " - + "but was invalid/unsupported instead."); + + "but was invalid/unsupported instead. Received scriptType=" + name); } } \ No newline at end of file diff --git a/core/src/main/java/io/bisq/core/dao/blockchain/parse/BsqChainState.java b/core/src/main/java/io/bisq/core/dao/blockchain/parse/BsqChainState.java index 506c424567..257fc9184b 100644 --- a/core/src/main/java/io/bisq/core/dao/blockchain/parse/BsqChainState.java +++ b/core/src/main/java/io/bisq/core/dao/blockchain/parse/BsqChainState.java @@ -83,9 +83,8 @@ public class BsqChainState implements Persistable { private static final String REG_TEST_GENESIS_TX_ID = "389d631bb48bd2f74fcc88c3506e2b03114b18b4e396c3bd2b8bb7d7ff9ee0d6"; private static final int REG_TEST_GENESIS_BLOCK_HEIGHT = 1441; // TEST NET - // https://testnet.blockexplorer.com/block/00000000f1cd94c6ccc458a922f2a42c975c3447180f0db1e56322a26ab3f0ec - private static final String TEST_NET_GENESIS_TX_ID = "8853756990acfc1784aac1ee1a50d331c915a46876bb4ad98f260ef2d35da845"; - private static final int TEST_NET_GENESIS_BLOCK_HEIGHT = 327626; //Mar 16, 2015 + private static final String TEST_NET_GENESIS_TX_ID = "9ba05c1923b414c8be53adcb95d7a06b27d722373d17ae812bd325c22cd8d4bb"; + private static final int TEST_NET_GENESIS_BLOCK_HEIGHT = 1119480; // block 376078 has 2843 recursions and caused once a StackOverflowError, a second run worked. Took 1,2 sec. diff --git a/doc/build.md b/doc/build.md index a6fe8d64b6..04c8618110 100644 --- a/doc/build.md +++ b/doc/build.md @@ -88,24 +88,17 @@ At IntelliJ 14 you need to edit the idea.properties in the app container: Build bitcoinj and btcd-cli4j fork ----------------- -### 3. 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). -We removed usage of Cartographer/HttpDiscovery in our [fork of version 0.13.1.7](https://github.com/bisq/bitcoinj/tree/bisq_0.14.4.1). -Beside the Java serialisation issues there are [privacy concerns](http://bitcoin-development.narkive.com/hczWIAby/bitcoin-development-cartographer#post3) regarding Cartographer. -Here is a Github issue with background and open tasks regarding [Bloom Filters](https://github.com/bisq/bisq/issues/414)._ Note: use a fresh directory, this should not be done inside the bisq folder. - -Btcd-cli4j is used for RPC communication to a local Bitcoin Core node. -TODO: remove if not used in production +### 3. Install BitcoinJ fork (bisq_0.14.4.1) and Btcd-cli4j +Btcd-cli4j is used for RPC communication to a local Bitcoin Core node for verifying the BSQ transactions. +It is not needed for a normal user to run such a "full node" but for the build it is required. $ cd .. - $ git clone -b bisq_0.14.4.1 https://github.com/bisq/bitcoinj.git + $ git clone -b bisq_0.14.4.1 https://github.com/bitsquare/bitcoinj.git $ cd bitcoinj $ mvn clean install -DskipTests -Dmaven.javadoc.skip=true $ cd .. - $ git clone https://github.com/bisq/btcd-cli4j.git + $ git clone https://github.com/bitsquare/btcd-cli4j.git $ cd btcd-cli4j $ mvn clean install -DskipTests -Dmaven.javadoc.skip=true @@ -163,6 +156,14 @@ Build binaries If you want to build the binaries check out the build scripts under the package directory. + +DAO full node +----------------- +If you want to run your own BSQ transaction verification node you have to run Bitcoin Core with RPC enabled and +use dedicated program arguments for the bisq node. +See the rpc.md doc in the same directory. + + Development mode ----------------- diff --git a/doc/rpc.md b/doc/rpc.md index f78596755e..9540e3f320 100644 --- a/doc/rpc.md +++ b/doc/rpc.md @@ -6,14 +6,21 @@ You need to setup the bitcoin.conf and add a blocknotify sh file. See the exampl To enable RPC calls you need to pass those program arguments: --rpcUser=bisq --rpcPassword=bisqPW --rpcPort=18332 --rpcBlockNotificationPort=4159 +The default rpcPort for regtest and testnet is: 18332 +For mainnet: 8332 + If you run 2 clients and want to receive the block notifications on both use different rpcBlockNotificationPorts 5159 and 4159 are defined in the blocknotify file. For reg test setup with localhost those are typical program arguments: --bitcoinNetwork=regtest --useLocalhostForP2P=true --nodePort=3332 --appName=bisq-LRTAli --rpcUser=bisq --rpcPassword=bisqPW --rpcPort=18332 --rpcBlockNotificationPort=4159 -If you use mainnet it is recommended to use a node with no funds in the wallet to avoid security risks when -enabling rpc or take sufficient precautions from from network setup. +For mainnet: +--fullDaoNode=true --rpcUser=bisq --rpcPassword=bisqPW --rpcPort=8332 --rpcBlockNotificationPort=4159 -txindex=1 need to be set. That causes a re-index of the whole data base which takes considerable time with a +If you use mainnet it is recommended to use a Bitcoin node with no funds in the wallet to avoid security risks when +enabling rpc or take sufficient precautions from your network setup. + +In the bitcoin.conf file you need to set txindex=1. +That causes a re-index of the whole data base which takes considerable time with a mainnet node.