
Some clarification in response to student feedback
Learn how to define Python classes with member data and functions, create distinct instances with dot notation and self, and use constructors to initialize per-instance data.
Explore inheritance in Python within the blockchain programming course, building a child class that extends a parent class, accessing inherited functionality, and using __repr__ and string conversion.
We'll discuss asymmetric encryption. At the end of this lecture, you'll be able to explain asymmetric encryption and how it enables secure internet communication.
In which the connection between asymmetric encryption and digital signatures is explored. At the end of this lecture, you'll know the connection between asymmetric encryption and digital signatures. You'll know why digital signatures cannot be mimicked.
The connection between digital signatures and cryptocurrency becomes clear. At the end of this lecture, you'll be able to explain why digital signatures are essential for cryptocurrency.
A brief note on coding assignments for this course. At the end of this lecture, you'll be able to explain test-drive development and you'll know how we'll set up assignment for the course.
A reminder about Python version 3 (not 2.7!) and instructions on installing and using pip. Skip this section if already you have Python 3.x and the cryptography Python module.
Here are instructions for installing the cryptograpy module, in case you learn better by reading it. https://cryptography.io/en/latest/installation/
Your first assignment. At the end of this lecture, you'll be able tell whether your functions for digitally signing and verifying statements is correct. Pause at the end of this lecture to work on your first assignment.
Remember, documentation for RSA digitial signatures, including useful code examples for key generation, signing and verifying, can be found here:
https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/
The solution to your assignment in which we learn that instructors make mistakes, too. Don't start this lecture until you've made a good attempt at completing the assignment yourself.
At the end of this lecture, you'll be generating public-private key pairs and signing and verifying digital signatures with your own python code.
Master private and public key generation, signing messages, and verifying signatures for blockchain programming, including detecting tampering and importing InvalidSignature from cryptography.exceptions.
Our final lecture on digital signatures. You'll about the Python "bytes" type. You'll be able to convert between bytes and strings in Python and you Signatures module will be able to handle either bytes or ordinary text strings.
Hash functions and what makes them useful. At the end of this lecture, you'll be able to list and describe the characteristics of a good cryptographic hash function
Hashing with Python. At the end of this lecture, you'll be able to compute the SHA-256 hash of a string using Python
Blockchain basics. At the end of this lecture, you'll be able to describe a blockchain, how it is secured by a hash function, and why it's hard to change history recorded on a blockchain.
Explore blockchain programming by hashing data with the previous block to prevent tampering and ensure chain integrity, while handling bytes correctly and preparing for a decentralized ledger and transaction class.
Develop and test a transaction class Tx with inputs, outputs, signatures, and required signatures; implement add input, add output, sign with private keys, and validate transactions, including escrow scenarios.
test invalid transactions by signing with the wrong key, design an escrow with required signatures, and probe inputs, outputs, and negative values, using Signatures.sign and Signatures.verify to validate results.
Demonstrate building a transaction with inputs and outputs as tuples, signing the gathered message with a private key, and validating each input's signature in any order using __gather.
Identify and fix transaction validation flaws in blockchain programming, detecting invalid signatures, escrow mismatches, negative values, and outputs that exceed inputs, while adding robust checks.
Review and assemble the tamper-proof transaction ledger by integrating the signatures module with the transaction module. Secure the blockchain by hashing blocks and linking them to the previous block.
Build a tx blockchain by adding a TX block class, test key generation, sign a transaction, and explore saving and loading with pickle, including challenges with private/public keys.
Demonstrates debugging a blockchain transaction serialization issue by replacing unpickleable public key objects with serialized PEM public keys, enabling sign, verify, and dump and load of transactions.
Explore how decentralization fuels cryptocurrency excitement and the risks of branching and double spend attacks. Learn how competing blocks sharing a parent enable attackers to replace transactions and steal coins.
Explore how proof-of-work secures a decentralized blockchain and approaches the Byzantine Generals problem. Add blocks to the longest valid chain, deterring attacks with verifiable, variable-cost computation and no pre-computation.
Learn how nonces drive Bitcoin mining by producing blockchain blocks with hashes that have leading zeros, using proof of work, and balancing emission rate through adjustable difficulty.
Relax transaction validation to let miners enforce input and output balance and block rewards, implement a private totals function, and fix floating point errors with an epsilon.
Examine how varying leading zeros in nonces changes the mining time for new blocks, using test-driven checks for nonce validity, timing, and block integrity.
Explore Python tricks to streamline code, including inline lists, hexadecimal handling, and joining strings. Learn ASCII conversions, and why system random is preferred over random for cryptographic use.
Explore how to compute hashes with previous hash and nonce, adjust difficulty with leading zeros, and implement a simple mining loop for a blockchain assignment.
Some sign-posting to let you know where we are and where we're headed next.
Learn internet basics for blockchain programming, including DNS to IP resolution, gateways and routers, and TCP/IP packet delivery through ports.
Learn to pickle data for communication by sending and receiving between client and server, handling chunked data, avoiding truncation, and correctly loading the complete object.
Learn how to set up a client-server workflow using sockets, handling local versus remote IP addresses and localhost, and manage new connections to receive blocks and transactions.
Manage coins with private keys, send transactions, and coordinate with miners who collect transactions, validate signatures, assemble blocks, and broadcast them to wallets that store the blockchain.
Learn to process transactions, assemble them into blocks, and mine rewards on a localhost blockchain, while configuring ports, wallets, and network endpoints.
Explore Python threading by creating and launching threads with the threading module, passing a target function and arguments, using join and time.sleep to show concurrent execution across cores.
Demonstrate how the wallet client and server interact to send transactions, query balances, and sign with private and public keys, with a threading-based test case.
Avoid global variables, keep module imports minimal, and gate testing utilities behind conditionals, using verbose debugging selectively to manage miners, blocks, and transactions effectively.
Learn how to load and save private and public keys, sign and verify messages, and test key serialization (PEM) for RSA using cryptography.io in blockchain programming.
Learn to load and save private and public keys in binary format using Python, serialize RSA keys, and manage wallet and block data through file input and output.
Learn how to save and load blockchain blocks and transactions using pickle, serialize and restore block chains, handle parent references, and maintain wallet state.
Walks through implementing block validation and transaction handling in a blockchain wallet and miner, including size checks, removing invalid blocks, using a placeholder reward, and prioritizing high-fee transactions.
Validate blockchain transactions by checking each account balance before spending, simulate mining transactions to fund wallets, and detect overspend errors to ensure legal transactions within a block.
Demonstrate assignment 3 techniques for validating the longest blockchain, checking balances, processing transactions, preventing overspends, and handling block reorgs through debugging.
Learn to merge sister blocks into the correct chain during forks. Ensure wallet tracks the longest blockchain by using genesis blocks.
Explore replay attacks on blockchain by simulating duplicate transactions, analyze how miners and wallets handle them, and note how private keys help prevent theft.
Learn to implement transaction indices in blockchain inputs, updating them to include public key, amount, and index, and enforce order, prevent duplicates, and detect tampering.
Explore the utxo model with unspent transaction outputs and why spending must consume whole outputs. Compare utxo ordering to the account balance method and its privacy implications.
NOTE: Udemy does not allow a .dat extension. Please download Genesis.txt and change the extension to .dat. Alternatively, change Miner.py and Wallet.py to read Genesis.txt in place of Genesis.dat.
Adjust hardness to regulate block emission rate by balancing mining power and target rate. Use leading zeros and next character max to estimate hashes per block and update hardness.
Examine the supply-side dynamics of mined cryptocurrencies with a fixed emission rate, showing how price, mining incentives, and a fixed coin quantity interact through adjustable hardness to reach equilibrium.
Finishing with a short discussion of the demand-side of the market for cryptocoins and how to estimate the long-term value of cryptocurrency.
You'll learn the ins and outs of blockchain like only a blockchain programmer knows. Using only a few Python libraries, we'll build a cryptocurrency from the ground up. Even if you have very little programming experience we can help you through it!
You'll learn about digital signatures, hashing and proof-of-work mining. We'll design and build a scheme for decentralized consensus including communicating over TCP/IP sockets. Bring your basic knowledge of Python, and you'll emerge on the other side with a grasp of cryptocurrencies better than 99% of your peers and with a working prototype you can build on.
You'll make smarter cryptocurrency investment decisions, launch a career in blockchain programming or just be the smartest crypto-junkie in the room. Clear your weekend, click the enroll button and let's go!