Merge branch 'master' into bip9

This commit is contained in:
jc23424 2018-02-23 08:17:16 -05:00 committed by GitHub
commit f23ddcfd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 29 deletions

103
README.md
View File

@ -1,16 +1,22 @@
Bitcoin Private v1.0.10-1
NOTICE, the default ports have changed! The p2p port is now 7933 and rpcport is 7932
What is Bitcoin Private?
Bitcoin Private
----------------
Bitcoin Private is financial freedom.
**Bitcoin Private v1.0.10-1**
P2P Port: 7933
RPC Port: 7932
Bitcoin Private is a fork of Zclassic, merging in the UTXO set of Bitcoin. BTCP is financial freedom.
### Info
The snapshot will take place on February 28th. The fork (creation of BTCP) will occur shortly after, on March 2nd.
Install
-----------------
### Linux
Get dependencies
Get dependencies:
```{r, engine='bash'}
sudo apt-get install \
build-essential pkg-config libc6-dev m4 g++-multilib \
@ -18,18 +24,27 @@ sudo apt-get install \
zlib1g-dev wget bsdmainutils automake
```
Install
Install:
```{r, engine='bash'}
# Build
./btcputil/build.sh -j$(nproc)
# fetch key
# Fetch Zcash ceremony keys
./btcputil/fetch-params.sh
# Run
./src/btcpd
```
### Windows
Get dependencies
There are two proven ways to build BTCP for Windows:
* On Linux using [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu 16.04 Xenial is proven to work and the instructions is for such release.
* On Windows 10 (64-bit version) using [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about) and Mingw-w64 cross compiler tool chain.
With Windows 10, Microsoft released a feature called WSL. It basically allows you to run a bash shell directly on Windows in an ubuntu environment. WSL can be installed with other Linux variants, but as mentioned before, the distro proven to work is Ubuntu.
Follow this [link](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) for installing WSL first
### Building for Windows 64-Bit
1. Get the usual dependencies:
```{r, engine='bash'}
sudo apt-get install \
build-essential pkg-config libc6-dev m4 g++-multilib \
@ -37,15 +52,48 @@ sudo apt-get install \
zlib1g-dev wget bsdmainutils automake mingw-w64
```
Install (Cross-Compiled, building on Windows is not supported yet)
2. Set the default ming32 gcc/g++ compiler option to posix, fix problem with packages in Xenial
```{r, engine='bash'}
# Build
sudo update-alternatives --config x86_64-w64-mingw32-gcc
sudo update-alternatives --config x86_64-w64-mingw32-g++
```
3. Install Rust
```{r, engine='bash'}
curl https://sh.rustup.rs -sSf | sh
source ~/.cargo/env
rustup install stable-x86_64-unknown-linux-gnu
rustup install stable-x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu
vi ~/.cargo/config
```
and add:
```
[target.x86_64-pc-windows-gnu]
linker = "/usr/bin/x86_64-w64-mingw32-gcc"
```
Note that in WSL, the BTCPrivate source code must be somewhere in the default mount file system. i.e /usr/src/BTCPrivate, and not on /mnt/d/. What this means is that you cannot build directly on the windows system
4. Build for Windows
```{r, engine='bash'}
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
./btcputil/build-win.sh -j$(nproc)
```
The exe will save to `src` which you can then move to a windows machine
5. Installation
After building in WSL, you can make a copy of the compiled executables to a directory on your Windows file system. This is done the following way
```{r, engine='bash'}
make install DESTDIR=/mnt/c/btcp/BTCPrivate
```
This will install the executables to `c:\btcp\BTCPrivate
### Mac
Get dependencies
Get dependencies:
```{r, engine='bash'}
#install xcode
xcode-select --install
@ -56,7 +104,7 @@ brew install cmake autoconf libtool automake coreutils pkgconfig gmp wget
brew install gcc5 --without-multilib
```
Install
Install:
```{r, engine='bash'}
# Build
./btcputil/build-mac.sh -j$(sysctl -n hw.physicalcpu)
@ -66,27 +114,33 @@ Install
./src/btcpd
```
### Additional notes
If you plan to build for windows and linux at the same time, be sure to delete all the built files for whatever you build first. An easy way to do this is by taking the binaries out of the repo, delete all files except the .git folder and then do a git hard reset.
About
--------------
[Bitcoin Private](http://zclassic.org/), like [Zcash](https://z.cash/), is an implementation of the "Zerocash" protocol.
Based on Bitcoin's code, it intends to offer a far higher standard of privacy
[Bitcoin Private](http://zclassic.org/), like [Zclassic](https://zclassic.org/) and [Zcash](https://z.cash/), is an implementation of the "Zerocash" protocol.
Based on Zclassic's code, it intends to offer a far higher standard of privacy
through a sophisticated zero-knowledge proving scheme that preserves
confidentiality of transaction metadata. Technical details are available
in the Zcash [Protocol Specification](https://github.com/zcash/zips/raw/master/protocol/protocol.pdf).
This software is the Bitcoin Private client. It downloads and stores the entire history
of Bitcoin Private transactions; depending on the speed of your computer and network
of Bitcoin Private transactions. Depending on the speed of your computer and network
connection, the synchronization process could take a day or more once the
blockchain has reached a significant size.
It includes both `btcpd` (the daemon) and `btcp-cli` (the command line tools).
Security Warnings
-----------------
See important security warnings in
[doc/security-warnings.md](doc/security-warnings.md).
**Bitcoin Private and Zcash are unfinished and highly experimental.** Use at your own risk.
**Bitcoin Private is unfinished and highly experimental.** Use at your own risk.
Deprecation Policy
------------------
@ -99,27 +153,26 @@ height and can be explicitly disabled.
Where do I begin?
-----------------
We have a guide for joining the main Bitcoin Private network:
https://github.com/BTCPrivate/BitcoinPrivate/wiki/1.0-User-Guide
https://github.com/zcash/zcash/wiki/1.0-User-Guide
### Need Help?
* See the documentation at the [Bitcoin Private Wiki](https://github.com/BTCPrivate/BitcoinPrivate/wiki)
* See documentation at the [Zcash Wiki](https://github.com/zcash/zcash/wiki) and the [Zclassic Wiki](https://github.com/z-classic/zclassic/wiki)
for help and more information.
* Ask for help on the [Bitcoin Private](http://zcltalk.tech/index.php) forum.
### Want to participate in development?
* Code review is welcome!
* If you want to get to know us join our slack: http://zclassic.herokuapp.com/
* If you want to get to know us join our Discord: https://discord.gg/9xezcaK
Participation in the Zcash project is subject to a
Participation in the Bitcoin Private project is subject to a
[Code of Conduct](code_of_conduct.md).
Building
--------
Build Zcash along with most dependencies from source by running
Build BTCP along with most dependencies from source by running
`./btcputil/build.sh`. Currently only Linux is officially supported.
License

View File

@ -6,14 +6,21 @@ $(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=a5760a90d4a1045c8944204f29fa2a3cf2f800afee400f88bf89bbfe2cce1279
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
$(package)_dependencies=rust
ifeq ($(host_os),mingw32)
rust_build=cargo build --release --lib --target="x86_64-pc-windows-gnu"
rust_target=target/x86_64-pc-windows-gnu/release/rustzcash.lib $($(package)_staging_dir)$(host_prefix)/lib/librustzcash.a
else
rust_build=cargo build --release
rust_target=target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/
endif
define $(package)_build_cmds
cargo build --release
$(rust_build)
endef
define $(package)_stage_cmds
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
cp $(rust_target) && \
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
endef
endef

View File

@ -5,7 +5,9 @@ $(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.t
$(package)_sha256_hash_linux=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
$(package)_sha256_hash_darwin=2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926
$(package)_file_name_mingw32=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz
$(package)_sha256_hash_mingw32=523cd248363afdc4e2c0e1f219607897b6925294a33154d7e67224addfd15eb0
define $(package)_stage_cmds
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
endef
endef

View File

@ -50,6 +50,7 @@ public:
consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
consensus.nPowTargetSpacing = 2.5 * 60;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.nPowDifficultyBombHeight = 600000;
consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
@ -216,6 +217,7 @@ public:
consensus.powLimit = uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
@ -223,6 +225,8 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
consensus.nPowDifficultyBombHeight = 600000;
pchMessageStart[0] = 0xf6;
pchMessageStart[1] = 0x1b;
pchMessageStart[2] = 0xf6;
@ -315,12 +319,15 @@ public:
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
consensus.nPowMaxAdjustDown = 0; // Turn off adjustment down
consensus.nPowMaxAdjustUp = 0; // Turn off adjustment up
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL;
consensus.nPowDifficultyBombHeight = 600000;
pchMessageStart[0] = 0xaa;
pchMessageStart[1] = 0xe8;
pchMessageStart[2] = 0x3f;

View File

@ -79,6 +79,8 @@ struct Params {
int64_t AveragingWindowTimespan() const { return nPowAveragingWindow * nPowTargetSpacing; }
int64_t MinActualTimespan() const { return (AveragingWindowTimespan() * (100 - nPowMaxAdjustUp )) / 100; }
int64_t MaxActualTimespan() const { return (AveragingWindowTimespan() * (100 + nPowMaxAdjustDown)) / 100; }
int nPowDifficultyBombHeight;
};
} // namespace Consensus

View File

@ -9,6 +9,7 @@
#include "chain.h"
#include "chainparams.h"
#include "crypto/equihash.h"
#include "main.h"
#include "primitives/block.h"
#include "streams.h"
#include "uint256.h"
@ -23,11 +24,16 @@
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
unsigned int nProofOfWorkBomb = UintToArith256(uint256S("000000000000000000000000000000000000000000000000000000000000ffff")).GetCompact();
// Genesis block
if (pindexLast == NULL)
return nProofOfWorkLimit;
// difficulty bomb
else if(pindexLast->nHeight > params.nPowDifficultyBombHeight)
return nProofOfWorkBomb;
// Find the first block in the averaging interval
const CBlockIndex* pindexFirst = pindexLast;
arith_uint256 bnTot {0};