O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learn Python by Building a Blockchain and Cryptocurrency

Video Description

Learn Python from the ground up and use Python to build your own basic Blockchain and Cryptocurrency (Coin)!

About This Video

  • Use Python to build your own basic Blockchain and Cryptocurrency (Coin)!
  • Dive into web development and data science with Python

In Detail

Python is easy-to-use and extremely versatile and powerful, making it one of the most popular programming languages. Python offers both object-oriented and structural programming features. The Blockchain technology is an exciting trend that’s here to stay.

This course will take you on a journey where you’ll learn Python by building a Blockchain and Cryptocurrency. It's very popular because it's easy to learn and use, runs on all operating systems, and allows you to build a broad variety of programs, be it web applications, desktop applications, utility scripts, or for data science and machine learning.

In this course, you'll learn a lot about the core concepts of the Blockchain and see how Python can be used for the many aspects that make up a Blockchain and Cryptocurrency. As a nice side-effect, you’ll see how a Blockchain works. This course will show you how to use Python to build your own basic Blockchain and Cryptocurrency (Coin). We’ll dive into the basics of Python and you’ll understand the complex data structures.

Table of Contents

  1. Chapter 1 : Getting Started
    1. Introduction 00:01:51
    2. What is Python? 00:05:08
    3. Setting Up Python? 00:03:11
    4. Writing our First Python Code 00:05:06
    5. What is the Blockchain? 00:06:48
    6. Course Outline 00:04:42
    7. Python Alternatives 00:03:58
    8. Understanding the Python Versions 00:02:22
    9. How to Get the Most Out of This Course 00:02:30
  2. Chapter 2 : Diving Into the Basics of Python
    1. Module Introduction 00:02:16
    2. Understanding the REPL and Data Types 00:04:25
    3. Working with Variables 00:04:47
    4. Working with Numbers 00:05:36
    5. Using Operators 00:03:49
    6. Understanding a "Special" Behavior when Working with Numbers 00:03:35
    7. Working with Strings 00:02:18
    8. Working with Lists 00:05:09
    9. Adding & Removing List Items 00:03:03
    10. Preparing the Blockchain - The Theory 00:02:03
    11. Installing our IDE 00:05:17
    12. Using Functions to Add List Items 00:06:45
    13. Accessing the Last List Item 00:03:25
    14. Adding Arguments to Functions 00:02:37
    15. Understanding the "return" Keyword 00:03:57
    16. Using Default Arguments 00:04:06
    17. Working with Keyword Arguments 00:03:00
    18. Using the "input" Function 00:03:01
    19. Avoiding Repetitive Code Execution 00:02:07
    20. Understanding the Variable Scope 00:06:50
    21. Exploring the Official Documentation 00:02:26
    22. Adding Comments and Doc Strings 00:04:21
    23. Structuring Multi Line Code in Python 00:01:56
    24. Wrap Up 00:03:28
  3. Chapter 3 : Working with Loops & Conditionals
    1. Module Introduction 00:01:38
    2. Understanding Loops - Theory 00:02:55
    3. Creating a "for" Loop 00:03:02
    4. Creating a "while" Loop 00:03:34
    5. Understanding Conditionals - Theory 00:02:02
    6. Adding "if-else" to our Blockchain 00:07:46
    7. Working with "elif" 00:03:44
    8. Understanding "break" & "continue" 00:03:32
    9. Improving our Code with Loops & Conditionals 00:06:39
    10. Understanding Boolean Operators - "is" & "in" 00:03:37
    11. The "not" Keyword 00:01:18
    12. Understanding "and" and "or" 00:02:26
    13. Grouping Conditionals 00:03:22
    14. What About "switch" in Python? 00:00:42
    15. Verifying our Blockchain 00:13:11
    16. Using Conditions inside the "while" Loop 00:01:57
    17. Using "else" in Loops 00:02:08
    18. Adding the "range" Function 00:07:09
    19. Wrap Up 00:02:32
  4. Chapter 4 : Understanding Complex Data Structures
    1. Module Introduction 00:02:50
    2. Understanding the Required Data Structure for our Blockchain 00:07:04
    3. Working with Iterables 00:05:02
    4. Choosing the Right Datastructure 00:02:56
    5. Transactions with Dictionaries & Tuples 00:07:47
    6. Unpacking the Tuple 00:03:21
    7. Mining Blocks 00:06:16
    8. Hashing Previous Blocks 00:06:24
    9. Understanding List Comprehensions 00:05:49
    10. And What are Dict Comprehensions? 00:01:40
    11. Combining List Comprehensions & "if" 00:02:54
    12. Improving the Blockchain Validation Logic 00:08:20
    13. Managing a List of Participants in the Blockchain 00:03:34
    14. Calculating Balances 00:07:47
    15. Rewarding the Miners of our Blockchain 00:03:24
    16. Verifying Transactions 00:05:46
    17. Understanding Reference vs Value Copying. 00:07:07
    18. Working with the Range Selector 00:05:42
    19. Understanding Shallow vs Deep Copies 00:02:43
    20. Comparing "is" & "==" 00:01:37
    21. Diving Deeper Into Iterable Methods 00:07:27
    22. Understanding the "all" & "any" Functions 00:07:36
    23. Comparing Iterables 00:06:46
    24. Wrap Up 00:03:18
  5. Chapter 5 : Working with Functions & Strings
    1. Module Introduction 00:01:31
    2. Comparing Strings & Lists 00:03:57
    3. Understanding the "format" Method 00:08:11
    4. Escaping Characters 00:01:47
    5. Formatting Strings Conveniently with "f" 00:01:28
    6. Adding String Formatting to our Project 00:02:01
    7. Understanding the "map" Function 00:02:53
    8. Working with Lambda Functions 00:02:13
    9. Reducing Lists 00:07:40
    10. Unpacking Function Arguments 00:06:33
    11. Fixing a Bug 00:04:13
    12. Wrap Up 00:01:31
  6. Chapter 6 : Working the Python Standard Library
    1. Module Introduction 00:01:43
    2. Exploring the Python Standard Library 00:02:12
    3. Importing Packages - Theory 00:04:19
    4. Importing "hashlib" to create a Unique Hash 00:07:14
    5. Using Other Import Syntaxes 00:01:47
    6. The "Proof of Work" 00:06:53
    7. Adding the Proof of Work to our Blockchain 00:05:48
    8. Including the Proof of Work in our Mining Function 00:07:49
    9. Fixing a Hash Order Fault 00:06:23
    10. Splitting Up our Code 00:04:33
    11. Wrap Up 00:02:03
  7. Chapter 7 : Working with Files
    1. Module Introduction 00:01:44
    2. Handling File Access 00:05:45
    3. Reading Data from a File 00:02:34
    4. Reading Multi-Line Content 00:05:52
    5. Using the "with" Block Statement 00:02:58
    6. Adding File Access to our Blockchain 00:08:39
    7. Converting Strings into Python Objects 00:16:01
    8. Storing Data with Pickle 00:06:05
    9. Comparing Pickle & JSON 00:01:05
    10. Changing the Project Back to JSON 00:02:30
    11. Why we need Proper Error Handling 00:00:47
    12. Wrap Up 00:01:17
  8. Chapter 8 : Handling Errors & Debugging
    1. Module Introduction 00:00:58
    2. Finding Logical Errors with the Debugger 00:05:54
    3. Finding Syntax Errors 00:01:41
    4. Using "try" to Find Runtime Errors 00:04:34
    5. Which Errors Should you Handle? 00:03:01
    6. Adding Error Handlers to our Blockchain 00:02:32
    7. Wrap Up 00:01:50
  9. Chapter 9 : Object Oriented Programming
    1. Module Introduction 00:01:13
    2. What is Object Oriented Programming? 00:02:13
    3. Understanding Classes 00:01:24
    4. Creating a Class 00:05:10
    5. Comparing Classes, Instances & Dictionaries 00:02:45
    6. Understanding Class Attributes 00:03:37
    7. Constructor & Instance Attributes 00:04:21
    8. Printing Classes with Special Methods 00:06:05
    9. Private & Public Attributes 00:04:39
    10. Understanding Inheritance 00:08:47
    11. Planning Blockchain Classes 00:01:32
    12. Adding a "Block" Class to the Blockchain 00:11:07
    13. Saving Custom Class Objects via .json 00:04:50
    14. Adding a "Transaction" Class 00:17:46
    15. Inheritance in Action 00:05:43
    16. Adding a "Verification" Helper Class 00:10:03
    17. Initialising the "Node" Class 00:04:51
    18. Turning the Blockchain into a Class 00:07:31
    19. Adding a "Node" Class 00:11:12
    20. Understanding "Instance" vs "Class" vs "Static Methods" & "Attributes" 00:03:39
    21. Using "Static" & "Class" Methods on the "Verification" Class 00:03:45
    22. Using Private Attributes in the Blockchain 00:03:44
    23. Properties vs Attributes 00:05:21
    24. Wrap Up 00:02:16
  10. Chapter 10 : Modules
    1. Module Introduction 00:01:42
    2. Creating Packages - Module Bundles 00:04:41
    3. The "pycache" Folder 00:00:44
    4. Module Docstrings 00:00:51
    5. Controlling Exports 00:05:37
    6. Understanding Execution Context & "__name__" 00:04:12
    7. Why we need a Private & Public Key Transaction Protection 00:04:25
    8. Using Anaconda to Install Third Party Packages 00:06:24
    9. Generating Keys with a Third Party Package 00:06:22
    10. Connecting the Node & the Wallet 00:06:16
    11. Generating Keys on the Node 00:04:07
    12. Saving & Loading Keys to Files 00:08:25
    13. Creating Transaction Signatures 00:06:24
    14. Adding a Signature to our Transactions 00:02:42
    15. Verifying Signatures 00:06:50
    16. Improving the Verification Logic 00:05:42
    17. Wrap Up 00:01:21
  11. Chapter 11 : Adding HTTP with Flask
    1. Module Introduction 00:02:04
    2. HTTP Requests - The Basics 00:05:41
    3. Understanding API-Endpoints/ URLs 00:03:32
    4. Data Formats 00:03:18
    5. Planning our API 00:02:05
    6. Setting Up our Environment with Flask 00:10:09
    7. Adding our First Route 00:10:09
    8. Installing Postman 00:02:21
    9. Adding a POST Request 00:07:21
    10. Setting Up Routes to Manage our Wallet 00:08:23
    11. Returning Funds 00:05:43
    12. Adding Transactions 00:11:27
    13. Fetching Open Transactions 00:03:15
    14. Testing the Public Key 00:01:46
    15. Adding a User Interface 00:02:42
    16. Optional: Configuring our UI - Creating a Wallet 00:13:18
    17. Optional: Configuring our UI - Loading a Wallet and Adding Mining & Transactions 00:11:59
    18. Exploring our UI 00:02:45
    19. Wrap Up 00:01:53
  12. Chapter 12 : The Node Network
    1. Module Introduction 00:01:43
    2. Adding Node Management Methods to the Blockchain 00:07:18
    3. Setting Up Routes to Add Nodes 00:07:40
    4. Adding a Remove Node Route 00:05:18
    5. Adding "get_Nodes" to get all Nodes 00:01:19
    6. Attaching a Node User Interface 00:11:07
    7. Running Multiple Nodes 00:11:19
    8. Sending Requests from within Python 00:10:37
    9. Broadcasting Transactions - Adding the Function & Route 00:12:06
    10. Broadcasting Transactions - Testing & Fixing Errors 00:05:51
    11. Broadcasting New Blocks: Adding the Function & Route 00:11:13
    12. Broadcasting New Blocks: Informing the Peer Nodes 00:09:54
    13. Broadcasting Transactions: Testing 00:03:29
    14. Solving Conflicts 00:05:33
    15. Understanding Consensus 00:03:28
    16. Finding Conflicts 00:09:35
    17. Implementing a Consensus Algorithm 00:17:20
    18. Testing Consensus 00:05:49
    19. Wrap Up 00:01:01
  13. Chapter 13 : Next Steps and Course Roundup
    1. Module Introduction 00:00:47
    2. Don't Forget PEP 8 00:02:47
    3. Using PEP 8 00:08:29
    4. Using Comments 00:01:02
    5. Diving Deeper Into Python 00:05:07
    6. Improving the Blockchain 00:10:02
    7. Congratulations 00:00:58