13. Blockchain is an immutable registry, once a transaction is logged it becomes tamper-proof
(virtually impossible to delete or modify the data.) As the blocks (transaction groups) are
interconnected cryptographically.
Chain of blocks
15. N5545 N5546
Block validated by the network
- and added in the blockchain
(updated)
TX+Signature
Cryptographically sign
the transaction and send
it to the network
ADDRESS:
1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2
Transaction validated
N5547
Tx is checked and included
in a block (time window)
TXj+Signature
TXi+Signature
N5547
How transaction get proceeded?
21. www.Mchain.uk
Localhost Env
Regtest Mode
21
A local testing environment in
which developers can almost
instantly generate blocks on
demand for testing events, and
can create private satoshis with
no real-world value. There are
two other options : Mainnet
and Testnet.
>> bitcoind –regtest // or define bitcon.conf
>> bitcoin-cli getnewaddress //new address
>> bitcoin-cli generate 101
>> bitcoin-cli listunspent
27. 27
Devoxx Coin Design
Coin’s Name DevoxxCoin
Coin’s Symbol DEC
Block Time 2.5 minutes
Initial block reward 10
Halving interval Every 100000 blocks (174 days)
Ports RPC port: 19333
P2P port: 9333
Total supply 2 000 000 units
Difficulty readjustment After 576 blocks
Block size Up to 8 Mb
D
36. 36
Genesis block
A genesis block is the first block in a blockchain. When a node boots, it initializes its copy
of the blockchain alongside the genesis block and then begins the synchronization
process.
New pszTimestamp
New nonce, epoch time, and nbits
genesis = CreateGenesisBlock(time, nonce, bits, 1,
10 * COIN);
assert (hashGenesisBlock == uint256 ("genesis
block hash"));
Editing the Merkle root
In testparams.cpp change:
assert( genesis.hashMerkleRoot ==
uint256s('merkle hash value');
37. 37
Total supply
Bitcoin is designed in a such manner so it has a total circulation of
approximately 21 million bitcoins (20,999,999.9769 bitcoins). TS depends on
Halving, initial reward and Block time.
In the header file amount.h there is a total supply MAX_MONEY sanity check:
As per our design we will set MAX_MONEY to 20,000,000 (rounded number) //
1999999.987 in our case
38. 38
POW parameters: target
Each hash basically gives a random number between 0 and the maximum
value of a 256-bit number (which is huge). If the miner's hash is below the
given target (a special hash value) then he wins. If not, he increments the
nonce (completely changing the hash) and tries again.
41. 41
Max Difficulty (Difficulty of 1):
Difficulty = original_target / target
If diff= 6653303141405 it's currently 6,653,303,141,405 times more difficult to
mine a block
42. 42
New block time : Difficulty adjustment time
interval ( retargeting period)
In Bitcoin after each 2016 blocks (14 days worth of blocks), each node looks at the time stamps of the past 2015
blocks and adjusts the difficulty using the following function defined in src/consensus/params.h
Both parameters nPowTargetTimespan and nPowTargetSpacing are defined in chainparams.cpp where we will set the
new following values to keep block generation at 2.5 minutes (retargeting 24 H):
43. 43
This specifies the minimum amount of chain work that a client must have
before it will consider itself synchronized. As we are running a new chain, the
minimum should be zero for both testnet and mainnet:
Minimum amount of chain work
44. 45
Time maturity
The coinbase maturity indicator indicates a time window of 100 blocks
between the creating block and the spending block. For ReaderCoin we
decrease this limit from 100 to 50. In the src/consensus/consensus.h file we
edit the following line of code:
45. 46
Block size
After Segwit activation, the weight parameters have been defined in consensus.h:
To double the weight we have to double the values of these four parameters.
46. 47
BIPs : Bitcoin Improvement Proposals
BIPs as a way to introduce new features to the Bitcoin protocol. Each new
improvement (BIP) is activated at a future block height to give Bitcoin users time
to update their software
47. 48
Compiling and testing
./autogen.sh
./configure--with-gui=qt5 --enable-
debug--disable-tests
make && sudo make install
devoxxcoin-qt -printtoconsole
readercoin-cli addnode 192.168.1.3:9333onetry
(in nodeA)
readercoin-cli addnode 192.168.1.8:9333onetry
(in nodeB)
devoxxcoin-cli getpeerinfo
Maybe run 2 node same pc
48. 49
GUI
Define your own Logo/Icon and Splash screen.
The resource files corresponding to different dialogue forms are editable files
with .ui extensions and are located under src/qt/forms
49. 50
Mining
In 0.16 version bitcoin client doesn’t have an internal miner. We use therefore
CPUminer :
./minerd -o http://127.0.0.1:9332 -u user -p password -a sha256d --nolongpoll --
no-getwork --no-stratum --coinbase-addr=your_address