From c02f6481b2566538aecacaad2b1d517c4f20a86c Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 16 Apr 2016 22:36:34 +0200 Subject: [PATCH] v0.4.2, new seednodes --- common/pom.xml | 2 +- .../main/java/io/bitsquare/app/Version.java | 2 +- core/pom.xml | 2 +- .../java/io/bitsquare/btc/WalletService.java | 51 ++++++++++++++++--- gui/pom.xml | 2 +- gui/src/main/resources/logback.xml | 2 +- jsocks/pom.xml | 2 +- jtorctl/pom.xml | 2 +- jtorproxy/pom.xml | 2 +- network/pom.xml | 2 +- .../p2p/seed/SeedNodesRepository.java | 13 +++-- package/linux/create_32bit_app.sh | 2 +- package/linux/create_app.sh | 5 +- package/mac/create_app.sh | 2 +- package/windows/Bitsquare.iss | 2 +- package/windows/create_32bit_app.bat | 6 +-- package/windows/create_app.bat | 6 +-- pom.xml | 2 +- seednode/pom.xml | 2 +- 19 files changed, 77 insertions(+), 32 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index a69f604b27..e78e6c4f7e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/common/src/main/java/io/bitsquare/app/Version.java b/common/src/main/java/io/bitsquare/app/Version.java index a9c359acc7..834e5edf9e 100644 --- a/common/src/main/java/io/bitsquare/app/Version.java +++ b/common/src/main/java/io/bitsquare/app/Version.java @@ -24,7 +24,7 @@ public class Version { private static final Logger log = LoggerFactory.getLogger(Version.class); // The application versions - public static final String VERSION = "0.4.1"; + public static final String VERSION = "0.4.2"; // The version nr. for the objects sent over the network. A change will break the serialization of old objects. // If objects are used for both network and database the network version is applied. diff --git a/core/pom.xml b/core/pom.xml index 703761ec58..494d500cfa 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -6,7 +6,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 core diff --git a/core/src/main/java/io/bitsquare/btc/WalletService.java b/core/src/main/java/io/bitsquare/btc/WalletService.java index 8eb1bfe097..f9ed52edbf 100644 --- a/core/src/main/java/io/bitsquare/btc/WalletService.java +++ b/core/src/main/java/io/bitsquare/btc/WalletService.java @@ -31,6 +31,7 @@ import io.bitsquare.common.handlers.ErrorMessageHandler; import io.bitsquare.common.handlers.ExceptionHandler; import io.bitsquare.common.handlers.ResultHandler; import io.bitsquare.storage.FileUtil; +import io.bitsquare.storage.Storage; import io.bitsquare.user.Preferences; import javafx.beans.property.*; import org.bitcoinj.core.*; @@ -95,6 +96,8 @@ public class WalletService { private final IntegerProperty numPeers = new SimpleIntegerProperty(0); private final ObjectProperty> connectedPeers = new SimpleObjectProperty<>(); public final BooleanProperty shutDownDone = new SimpleBooleanProperty(); + private final Storage storage; + private final Long bloomFilterTweak; /////////////////////////////////////////////////////////////////////////////////////////// @@ -103,14 +106,23 @@ public class WalletService { @Inject public WalletService(RegTestHost regTestHost, TradeWalletService tradeWalletService, AddressEntryList addressEntryList, UserAgent userAgent, - @Named(DIR_KEY) File walletDir, Preferences preferences) { + @Named(DIR_KEY) File appDir, Preferences preferences) { this.regTestHost = regTestHost; this.tradeWalletService = tradeWalletService; this.addressEntryList = addressEntryList; this.params = preferences.getBitcoinNetwork().getParameters(); - this.walletDir = new File(walletDir, "bitcoin"); + this.walletDir = new File(appDir, "bitcoin"); this.userAgent = userAgent; useTor = preferences.getUseTorForBitcoinJ(); + + storage = new Storage<>(walletDir); + Long persisted = storage.initAndGetPersisted("BloomFilterNonce"); + if (persisted != null) { + bloomFilterTweak = persisted; + } else { + bloomFilterTweak = new Random().nextLong(); + storage.queueUpForSave(bloomFilterTweak, 100); + } } @@ -143,10 +155,6 @@ public class WalletService { if (params != RegTestParams.get()) walletAppKit.peerGroup().setMaxConnections(11); - // https://groups.google.com/forum/#!msg/bitcoinj/Ys13qkTwcNg/9qxnhwnkeoIJ - // DEFAULT_BLOOM_FILTER_FP_RATE = 0.00001 - walletAppKit.peerGroup().setBloomFilterFalsePositiveRate(0.00001); - wallet = walletAppKit.wallet(); wallet.addEventListener(walletEventListener); @@ -203,6 +211,37 @@ public class WalletService { } }; + // Bloom filters in BitcoinJ are completely broken + // See: https://jonasnick.github.io/blog/2015/02/12/privacy-in-bitcoinj/ + + // FalsePositiveRate of 0.5% leads to a probability of 0.0071 with 56 million pubkeys in the block chain and + // 200 keys. + // See: https://www.reddit.com/r/Bitcoin/comments/2vrx6n/privacy_in_bitcoinj_android_wallet_multibit_hive/coknjuz + // We use 1000 keys so we get an even better value. + // walletAppKit.setBloomFilterFalsePositiveRate(0.005); + // walletAppKit.setBloomFilterFalsePositiveRate(0.00001); //0.00001; + // Nr of false positives (56M keys in the blockchain): 0.005 * 56 000 000 = 280 000 + // 0,00001 * 56 000 000 = 28 000 = 560 + // 0,0001 * 56 000 000 = 28 000 = 5600 + // 0,001 * 56 000 000 = 28 000 = 56 000 + // 1333 / 5600 = 0.23 -> 23 % probability that pub key is in our wallet + // With higher fp rate values it fails to download the svp chain - seems it triggers Bitcoins DDoS protection ? + walletAppKit.setBloomFilterFalsePositiveRate(0.0001); // default is 0,00001; + + // Default only 266 keys are generated (2 * 100+33). That would trigger new bloom filters when we are reaching + // a third under the limit (66). To avoid that we create much more keys which are unlikely to hit the + // new filter creation for most users. With 500 we get 1333 keys which should be enough for most users to + // never need to re-create a bloom filter + walletAppKit.setLookaheadSize(500); + + // Bitsquare's BitcoinJ fork has added setBloomFilterTweak setter to reuse the same seed avoiding the trivial vulnerability + // by getting the real pub keys by intersections of several filters sent at each startup. + walletAppKit.setBloomFilterTweak(bloomFilterTweak); + + // Avoid weakening probability by square root due to the default implementation using both pubkey and hash of pubkey + // See: https://jonasnick.github.io/blog/2015/02/12/privacy-in-bitcoinj/ + walletAppKit.setInsertPubKey(false); + // TODO Get bitcoinj running over our tor proxy. BlockingClientManager need to be used to use the socket // from jtorproxy. To get supported it via nio / netty will be harder if (useTor && params.getId().equals(NetworkParameters.ID_MAINNET)) diff --git a/gui/pom.xml b/gui/pom.xml index 40e53a4b22..ec41aaf685 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -22,7 +22,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/gui/src/main/resources/logback.xml b/gui/src/main/resources/logback.xml index 043556fdce..92d0be0821 100644 --- a/gui/src/main/resources/logback.xml +++ b/gui/src/main/resources/logback.xml @@ -43,6 +43,6 @@ - + diff --git a/jsocks/pom.xml b/jsocks/pom.xml index 7c60e3f009..021065511f 100644 --- a/jsocks/pom.xml +++ b/jsocks/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/jtorctl/pom.xml b/jtorctl/pom.xml index 9e2855281c..27d58da8fb 100644 --- a/jtorctl/pom.xml +++ b/jtorctl/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/jtorproxy/pom.xml b/jtorproxy/pom.xml index 1400c3e0b6..b6435092af 100644 --- a/jtorproxy/pom.xml +++ b/jtorproxy/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/network/pom.xml b/network/pom.xml index 19eb1d6fc5..9234355312 100644 --- a/network/pom.xml +++ b/network/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0 diff --git a/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java b/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java index b9bd742d4d..21fd11882e 100644 --- a/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java +++ b/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java @@ -26,10 +26,15 @@ public class SeedNodesRepository { new NodeAddress("3efgjjbdvhbvck3x.onion:8000"), new NodeAddress("3unfcshgwipxhxfm.onion:8000"),*/ - // v0.4.0 - new NodeAddress("ybmi4iaesugslxrw.onion:8000"), + // v0.4.0, v0.4.1 + /* new NodeAddress("ybmi4iaesugslxrw.onion:8000"), new NodeAddress("ufwnvo775jfnjeux.onion:8000"), - new NodeAddress("b66vnevaljo6xt5a.onion:8000"), + new NodeAddress("b66vnevaljo6xt5a.onion:8000"),*/ + + // v0.4.2 + new NodeAddress("tyng4uwrmynumrlr.onion:8000"), + new NodeAddress("45tr2h3hte27tnx3.onion:8000"), + new NodeAddress("j5fjv3elo372agzo.onion:8000"), // testnet new NodeAddress("znmy44wcstn2rkva.onion:8001"), @@ -39,7 +44,7 @@ public class SeedNodesRepository { // 1. Run a seed node with prog args: rxdkppp3vicnbgqt.onion:8002 2 50 // 2. Find your local onion address in Bitsquare_seed_node_rxdkppp3vicnbgqt.onion_8002/tor/hiddenservice/hostname // 3. Shut down the seed node - // 4. Rename the directory with your local onion address + // 4. Rename the directory with your local onion address // 5. Edit here your found onion address (new NodeAddress("YOUR_ONION.onion:8002") new NodeAddress("rxdkppp3vicnbgqt.onion:8002"), new NodeAddress("brmbf6mf67d2hlm4.onion:8002"), diff --git a/package/linux/create_32bit_app.sh b/package/linux/create_32bit_app.sh index 66fd88ad73..9153ce8bff 100644 --- a/package/linux/create_32bit_app.sh +++ b/package/linux/create_32bit_app.sh @@ -6,7 +6,7 @@ mkdir -p gui/deploy set -e # Edit versions -fullVersion=0.4.1 +fullVersion=0.4.2 jarFile="/home/bitsquare/Desktop/sf_vm_shared_ubuntu14_32bit/Bitsquare-$fullVersion.jar" # Note: fakeroot needs to be installed on linux diff --git a/package/linux/create_app.sh b/package/linux/create_app.sh index b0480136f6..dcf624b5d1 100644 --- a/package/linux/create_app.sh +++ b/package/linux/create_app.sh @@ -6,7 +6,7 @@ mkdir -p gui/deploy set -e # Edit versions -fullVersion=0.4.1 +fullVersion=0.4.2 jarFile="/home/mk/Desktop/sf_vm_shared_ubuntu/Bitsquare-$fullVersion.jar" # Note: fakeroot needs to be installed on linux @@ -33,6 +33,7 @@ rm gui/deploy/Bitsquare.jnlp rm gui/deploy/LICENSE mv "gui/deploy/bundles/bitsquare-$fullVersion.deb" "gui/deploy/Bitsquare-$fullVersion.deb" rmdir gui/deploy/bundles -cp "gui/deploy/Bitsquare-$fullVersion.deb" "/home/mk/Desktop/sf_vm_shared_ubuntu/Bitsquare-$fullVersion.deb" +cp "gui/deploy/Bitsquare-$fullVersion.deb" "/home/mk/Desktop/sf_vm_shared_ubuntu/Bitsquare-64bit-$fullVersion.deb" +cp "gui/deploy/Bitsquare-32bit-$fullVersion.deb" "/home/mk/Desktop/Bitsquare-64bit-$fullVersion.deb" cd package/linux \ No newline at end of file diff --git a/package/mac/create_app.sh b/package/mac/create_app.sh index 5bdca1daa4..a470aeea6f 100644 --- a/package/mac/create_app.sh +++ b/package/mac/create_app.sh @@ -5,7 +5,7 @@ mkdir -p gui/deploy set -e -fullVersion="0.4.1" +fullVersion="0.4.2" mvn clean package -DskipTests -Dmaven.javadoc.skip=true diff --git a/package/windows/Bitsquare.iss b/package/windows/Bitsquare.iss index 021ecb9a96..3d49b5ab5c 100755 --- a/package/windows/Bitsquare.iss +++ b/package/windows/Bitsquare.iss @@ -3,7 +3,7 @@ [Setup] AppId={{bitsquare}} AppName=Bitsquare -AppVersion=0.4.1 +AppVersion=0.4.2 AppVerName=Bitsquare AppPublisher=Bitsquare AppComments=Bitsquare diff --git a/package/windows/create_32bit_app.bat b/package/windows/create_32bit_app.bat index 2c45e09ac1..f581f6f966 100644 --- a/package/windows/create_32bit_app.bat +++ b/package/windows/create_32bit_app.bat @@ -1,13 +1,13 @@ cd ..\..\ mkdir gui\deploy -:: edit iss file -> AppVersion=0.4.1 +:: edit iss file -> AppVersion=0.4.2 :: Copy gui/deploy.Bitsquare.jar file from mac build to windows -:: edit -> -BappVersion=0.4.1 and -srcfiles +:: edit -> -BappVersion=0.4.2 and -srcfiles :: 32 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -call "C:\Program Files\Java\jdk1.8.0_77\bin\javapackager.exe" -deploy -BappVersion=0.4.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.1.jar" -outfile Bitsquare-32bit -Bruntime="C:\Program Files\Java\jdk1.8.0_77\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true +call "C:\Program Files\Java\jdk1.8.0_77\bin\javapackager.exe" -deploy -BappVersion=0.4.2 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.2.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_77\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true cd package\windows \ No newline at end of file diff --git a/package/windows/create_app.bat b/package/windows/create_app.bat index ebf92f0102..3b00003886 100644 --- a/package/windows/create_app.bat +++ b/package/windows/create_app.bat @@ -1,13 +1,13 @@ cd ..\..\ mkdir gui\deploy -:: edit iss file -> AppVersion=0.4.1 +:: edit iss file -> AppVersion=0.4.2 :: Copy gui/deploy.Bitsquare.jar file from mac build to windows -:: edit -> -BappVersion=0.4.1 and -srcfiles +:: edit -> -BappVersion=0.4.2 and -srcfiles :: 64 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -call "C:\Program Files\Java\jdk1.8.0_66\bin\javapackager.exe" -deploy -BappVersion=0.4.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.1.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_66\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true +call "C:\Program Files\Java\jdk1.8.0_66\bin\javapackager.exe" -deploy -BappVersion=0.4.2 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.2.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_66\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true cd package\windows \ No newline at end of file diff --git a/pom.xml b/pom.xml index 07b7ae32d1..daa4c7f357 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.bitsquare parent pom - 0.4.1 + 0.4.2 Bitsquare - The decentralized bitcoin exchange https://bitsquare.io diff --git a/seednode/pom.xml b/seednode/pom.xml index 9006c829ee..11aaba39fa 100644 --- a/seednode/pom.xml +++ b/seednode/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.1 + 0.4.2 4.0.0