1
1
I'm playing around with the code and tried to adjust difficulty by changing code from
bnProofOfWorkLimit = ~uint256(0) >> 1
to
bnProofOfWorkLimit = ~uint256(0) >> 20
inside code block for Regression Test in chainparams.cpp (bitcoin-0.10.0).
I configured, did make, then make install with binaries in a custom directory (not default /usr/local/bin/bitcoind !), started bitcoind in regtest mode and generated some blocks.
Somehow it feels like it takes same amount of time for generating blocks as before modifying the code.
What am I doing wrong?
UPDATE:
Changed difficulty in chainparams.cpp from
bnProofOfWorkLimit = ~uint256(0) >> 1
to
bnProofOfWorkLimit = ~uint256(0) >> 32
still getting this:
Bitcoin version v0.10.0.0-g047a898 (Fri, 13 Feb 2015 09:55:11 +0100)
Using OpenSSL version OpenSSL 1.0.1f 6 Jan 2014
Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
Default data directory /home/aliakbar/.bitcoin
Using data directory /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest
Using config file /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/bitcoin.conf
Using at most 125 connections (1024 file descriptors available)
Using 4 threads for script verification
Binding RPC on address ::1 port 23333 (IPv4+IPv6 bind any: 0)
Binding RPC on address 127.0.0.1 port 23333 (IPv4+IPv6 bind any: 0)
Using wallet wallet.dat
init message: Verifying wallet...
CDBEnv::Open : LogDir=/home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/database ErrorFile=/home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/db.log
Bound to [::]:13333
Bound to 0.0.0.0:13333
init message: Loading block index...
Opening LevelDB in /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/blocks/index
Opened LevelDB successfully
Opening LevelDB in /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/chainstate
Opened LevelDB successfully
LoadBlockIndexDB: last block file = 0
LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
Checking all blk files are present...
LoadBlockIndexDB(): transaction index disabled
Initializing databases...
Pre-allocating up to position 0x1000000 in blk00000.dat
ERROR: CheckProofOfWork() : nBits below minimum work
ERROR: CheckBlockHeader() : proof of work failed
InvalidChainFound: invalid block=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 log2_work=1 date=2011-02-02 23:16:42
What am I doing wrong? Do I have to adjust difficulty somewhere else than in chainparams.cpp?
If you're using the most recent code, though, then rather than adjusting the regtest parameters, you could also just add your own set of parameters. - if adding new own set of parameters, where am I going to call them? I mean, even a parameter, such as
nSubsidyHalvingInterval, doesn't show up anywhere else (like in main.cpp) than in chainparams.cpp only!? – Aliakbar Ahmadi – 2015-05-27T16:04:44.9831You would have to modify the startup process to recognize some new flag (like
-myparams) and select the parameters based on that flag. Then all calls toParams()will return your params. – morsecoder – 2015-05-27T16:11:59.757Unfortunately I can't follow you with modify the startup process, do you mean a flag, like
-regtestor-testnet?If so, I searched for them in src but only found out - to my perception - that out ofbitcoind.cppthere isn't any call for parameters defined inchainparams.cpp..Could you please give me hints or give me concrete instructions on how to set new set of parameters? – Aliakbar Ahmadi – 2015-05-27T16:51:03.993