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.

Publisher resources

Download Example Code

Table of contents

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

Product information

  • Title: Learn Python by Building a Blockchain and Cryptocurrency
  • Author(s): Maximilian Schwarzmüller
  • Release date: August 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789610666