i
,About the Tutorial
Blockchain is the current buzz that is dominating the software development trends. The
development and designing of Blockchain involves three major components: client, miner
and blockchain.
This tutorial is aimed to give you a crisp understanding of the process of building your own
blockchain.
Audience
Any programming enthusiast who wants to keep in pace with the recent trend of
Blockchain development can gain from this tutorial.
If you are a learner interested to learn the basics of Blockchain Development, this tutorial
aptly suits your needs.
Prerequisites
This tutorial is written assuming that the learner has an idea on programming in Python
and a basic idea on Blockchain. If you are new to any of these concepts, we suggest you
to pick tutorials based on these concepts first before you plunge into this tutorial.
Copyright & Disclaimer
@Copyright 2019 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at
i
, Python Blockchain
`
Table of Contents
About the Tutorial ................................................................................................................................ i
Audience............................................................................................................................................... i
Prerequisites ......................................................................................................................................... i
Copyright & Disclaimer ......................................................................................................................... i
Table of Contents................................................................................................................................. ii
1. PYTHON BLOCK CHAIN – INTRODUCTION ......................................................................... 4
Components Involved in Blockchain Project Development .................................................................. 4
2. PYTHON BLOCK CHAIN – DEVELOPING CLIENT ................................................................. 6
3. PYTHON BLOCK CHAIN – CLIENT CLASS ............................................................................ 8
4. PYTHON BLOCK CHAIN – TRANSACTION CLASS............................................................... 10
5. PYTHON BLOCK CHAIN – CREATING MULTIPLE TRANSACTIONS ..................................... 13
Displaying Transaction ....................................................................................................................... 13
6. PYTHON BLOCK CHAIN – BLOCK CLASS ........................................................................... 19
7. PYTHON BLOCK CHAIN – CREATING GENESIS BLOCK ...................................................... 20
8. PYTHON BLOCKCHAIN – CREATING BLOCKCHAIN ........................................................... 21
9. PYTHON BLOCKCHAIN – ADDING GENESIS BLOCK .......................................................... 23
10. PYTHON BLOCKCHAIN – CREATING MINERS ................................................................... 24
Message Digest Function ................................................................................................................... 24
Mining Function ................................................................................................................................. 24
11. PYTHON BLOCKCHAIN – ADDING BLOCKS....................................................................... 27
Adding First Block .............................................................................................................................. 27
ii
, Python Blockchain
`
12. PYTHON BLOCKCHAIN – SCOPE AND CONCLUSION ........................................................ 34
iii
,About the Tutorial
Blockchain is the current buzz that is dominating the software development trends. The
development and designing of Blockchain involves three major components: client, miner
and blockchain.
This tutorial is aimed to give you a crisp understanding of the process of building your own
blockchain.
Audience
Any programming enthusiast who wants to keep in pace with the recent trend of
Blockchain development can gain from this tutorial.
If you are a learner interested to learn the basics of Blockchain Development, this tutorial
aptly suits your needs.
Prerequisites
This tutorial is written assuming that the learner has an idea on programming in Python
and a basic idea on Blockchain. If you are new to any of these concepts, we suggest you
to pick tutorials based on these concepts first before you plunge into this tutorial.
Copyright & Disclaimer
@Copyright 2019 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at
i
, Python Blockchain
`
Table of Contents
About the Tutorial ................................................................................................................................ i
Audience............................................................................................................................................... i
Prerequisites ......................................................................................................................................... i
Copyright & Disclaimer ......................................................................................................................... i
Table of Contents................................................................................................................................. ii
1. PYTHON BLOCK CHAIN – INTRODUCTION ......................................................................... 4
Components Involved in Blockchain Project Development .................................................................. 4
2. PYTHON BLOCK CHAIN – DEVELOPING CLIENT ................................................................. 6
3. PYTHON BLOCK CHAIN – CLIENT CLASS ............................................................................ 8
4. PYTHON BLOCK CHAIN – TRANSACTION CLASS............................................................... 10
5. PYTHON BLOCK CHAIN – CREATING MULTIPLE TRANSACTIONS ..................................... 13
Displaying Transaction ....................................................................................................................... 13
6. PYTHON BLOCK CHAIN – BLOCK CLASS ........................................................................... 19
7. PYTHON BLOCK CHAIN – CREATING GENESIS BLOCK ...................................................... 20
8. PYTHON BLOCKCHAIN – CREATING BLOCKCHAIN ........................................................... 21
9. PYTHON BLOCKCHAIN – ADDING GENESIS BLOCK .......................................................... 23
10. PYTHON BLOCKCHAIN – CREATING MINERS ................................................................... 24
Message Digest Function ................................................................................................................... 24
Mining Function ................................................................................................................................. 24
11. PYTHON BLOCKCHAIN – ADDING BLOCKS....................................................................... 27
Adding First Block .............................................................................................................................. 27
ii
, Python Blockchain
`
12. PYTHON BLOCKCHAIN – SCOPE AND CONCLUSION ........................................................ 34
iii