Merge pull request #8 from jl777/dPoW

new read me
This commit is contained in:
jl777
2016-09-21 16:21:45 -03:00
committed by GitHub
2 changed files with 87 additions and 73 deletions

View File

@@ -1,3 +1,4 @@
Zcash Zcash
===== =====
@@ -32,62 +33,79 @@ Zcash is released under the terms of the MIT license. See [COPYING](COPYING) for
information or see http://opensource.org/licenses/MIT. information or see http://opensource.org/licenses/MIT.
>>>>>>>>>>>>>>>>>>>> Komodo specific notes: Komodo Specific Notes
=====================
Installation of BDB
-------------------
``` ```
if you dont have BDB installed: #If you do not have BDB installed, do the following:
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xvf db-4.8.30.NC.tar.gz tar -xvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/
cd db-4.8.30.NC/build_unix
mkdir -p build mkdir -p build
BDB_PREFIX=$(pwd)/build BDB_PREFIX=$(pwd)/build
cd build
../dist/configure disable-shared enable-cxx with-pic prefix=$BDB_PREFIX ../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX
make install make install
cd ../.. cd ../..
```
The following packages are needed: Dependencies
------------
```
#The following packages are needed:
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev
```
Komodo
------
```
git clone https://github.com/jl777/komodo git clone https://github.com/jl777/komodo
cd komodo cd komodo
./autogen.sh ./autogen.sh
./configure --with-incompatible-bdb --with-gui ./configure --with-incompatible-bdb --with-gui
# This command might finish with: configure: error: libgmp headers missing. This can be ignored.
./zcutil/fetch-params.sh ./zcutil/fetch-params.sh
cp ~/.zcash-params/testnet3/z9* ~/.zcash-params cp ~/.zcash-params/testnet3/z9* ~/.zcash-params
./zcutil/build.sh -j8 # -j8 uses 8 threads ./zcutil/build.sh -j8 # -j8 uses 8 threads
#This can take some time.
```
Once things are setup, you can build komodod with make from komodo/src directory. Also the error: configure: error: libsnark include directory not found, might appear and it looks like it can be ignored. Create komodo.conf
------------------
Create ~/.komodo/komodo.conf: ```
cd ~
mkdir .komodo
cd .komodo
gedit komodo.conf
#For the above, you can use any text editor other than gedit.
#Add the following lines to the komodo.conf file:
rpcuser=bitcoinrpc rpcuser=bitcoinrpc
rpcpassword=password rpcpassword=password
addnode="5.9.102.210" addnode="5.9.102.210"
addnode="78.47.196.146" addnode="78.47.196.146"
Start mining:
komodo/src/komodod -gen=1 -genproclimit=1 -addnode="78.47.196.146"
komodo/src/komodo-cli getinfo
``` ```
Start mining
------------
```
cd ~
cd komodo
#Go to your komodo directory
./src/komodod -gen=1 -genproclimit=1 &
#This starts komodo as a process
komodo/src/komodo-cli getinfo
#To view the process:
ps aux | grep komodod
#To view komodod output:
gedit ~/.komodo.debug.log
```

View File

@@ -2946,25 +2946,21 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW) bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW)
{ {
int32_t retval; int32_t retval;
// Check timestamp
if (block.GetBlockTime() > GetAdjustedTime() + 60)
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new");
if ( (retval= komodo_blockcheck((void *)&block)) == 0 ) if ( (retval= komodo_blockcheck((void *)&block)) == 0 )
{ {
// Check Equihash solution is valid // Check Equihash solution is valid
if (fCheckPOW && !CheckEquihashSolution(&block, Params())) if (fCheckPOW && !CheckEquihashSolution(&block, Params()))
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"), return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
REJECT_INVALID, "invalid-solution");
// Check proof of work matches claimed amount // Check proof of work matches claimed amount
if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus())) if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus()))
return state.DoS(50, error("CheckBlockHeader(): proof of work failed"), return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),REJECT_INVALID, "high-hash");
REJECT_INVALID, "high-hash");
} }
else if ( retval < 0 ) // komodo rejects block, ie. prior to notarized blockhash else if ( retval < 0 ) // komodo rejects block, ie. prior to notarized blockhash
return(false); return(false);
// Check timestamp
if (block.GetBlockTime() > GetAdjustedTime() + 600)
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),
REJECT_INVALID, "time-too-new");
return true; return true;
} }