Block Chain Eg
Block Chain Eg
Block Chain Eg
Bellaj Badr
Richard Horrocks
Xun (Brian) Wu
BIRMINGHAM - MUMBAI
Table of Contents
Preface 1
Chapter 1: Say Hello to Blockchain 7
The emergence of blockchain and cryptocurrency 8
From virtual currencies to cryptocurrency 8
The invention of bitcoin 9
What is blockchain? 11
Blocks 12
Transactions 12
Smart contracts 12
Interact with the blockchain 13
Getting started 13
Running a bitcoin client for the first time 14
Synchronizing the blockchain 15
Running Bitcoin Core 16
Running Electrum 19
Method 1 – Building a raw transaction using Bitcoin Core 20
Funding our address 20
Unspent transaction output 21
Creating the transaction 22
Transaction structure 24
Signing the transaction 25
Sending the transaction 28
Retrieving your message online from the blockchain 28
Using the local blockchain 29
Method 2 – build a raw bitcoin transaction in JavaScript 31
Preparation 31
Let's code 32
Types of blockchains 35
Classification of blockchains 35
Summary 37
Chapter 2: Building a Bitcoin Payment System 39
What is Bitcoin? 40
Why choose Bitcoin as a platform? 40
Getting started with Bitcoin 41
Setting up a Regtest environment 41
First commands 42
Transactions in bitcoin 43
Mining 44
Bitcoin scripting 44
Building a P2PKH script using JavaScript 47
Building a custom script 48
Table of Contents
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Table of Contents
[ vii ]
Table of Contents
[ viii ]
Table of Contents
[ ix ]
Table of Contents
[x]
Table of Contents
[ xi ]