mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-12-23 07:08:13 +00:00
source genesis block test
This commit is contained in:
parent
e6f7c4750c
commit
a0cb9c53fb
@ -2,12 +2,6 @@
|
||||
|
||||
= Mastering Bitcoin
|
||||
|
||||
by Andreas M. Antonopoulos
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
include::preface.asciidoc[]
|
||||
|
||||
|
@ -6,6 +6,35 @@
|
||||
=== Simple Transactions
|
||||
=== Wallets, addresses and coins
|
||||
=== The Blockchain
|
||||
|
||||
==== The Genesis Block
|
||||
|
||||
The very first block mined, by Satoshi Nakamoto on Sat, 03 Jan 2009, is included in the source code of any "full node" client, as the basis for validating the entire blockchain.
|
||||
|
||||
[[genesis_block_cpp]]
|
||||
.The Genesis Block, statically encoded in the source code of the reference client
|
||||
link:$$https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L120$$[bitcoin/src/chainparams.cpp:line 120]
|
||||
====
|
||||
[source, c++]
|
||||
----
|
||||
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
|
||||
CTransaction txNew;
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize(1);
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vout[0].nValue = 50 * COIN;
|
||||
txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||
genesis.vtx.push_back(txNew);
|
||||
genesis.hashPrevBlock = 0;
|
||||
genesis.hashMerkleRoot = genesis.BuildMerkleTree();
|
||||
genesis.nVersion = 1;
|
||||
genesis.nTime = 1231006505;
|
||||
genesis.nBits = 0x1d00ffff;
|
||||
genesis.nNonce = 2083236893;
|
||||
|
||||
----
|
||||
====
|
||||
|
||||
=== Bitcoin mining
|
||||
=== Transaction Fees
|
||||
=== Currency exchange
|
||||
|
Loading…
Reference in New Issue
Block a user