In this course, students will learn Rust programming language by implementing concepts used in bitcoin and interacting with bitcoin software and related crates(libraries) in rust.
Rust is a static strongly typed Systems programming language giving programmers control of computer resources like CPU, memory, threads etc., directly in a safe way. It achieves safety with the help of an expressive type system using Generics and traits and borrow checking.
It is a widely accepted belief in the bitcoin community that bitcoin and related software should be efficient and consume less computing resources so that it can be run on relatively cheap hardware.
C, C++ etc., gives the ability to write efficient, less resource-intensive code but does not guard the programmers from introducing memory vulnerabilities. This is why Rust is now the go-to choice for implementing bitcoin-related software.
This course expects the students to have prior programming knowledge and understanding of basic concepts like variables, loops, functions, user defined types etc., Reading of Chapters 1 to 4 of Rust book, it's not required have thorough understanding, but get your setup up and ready for coding in rust. Understanding of concepts like stack and heap memory, how malloc, every programming language relies on some version of malloc to do memory allocation. Chapter 4 of rust book also discusses about this topic.
Introduction to variables, loops, arrays, integers, functions and pointers.
Assignment: Ceasar Cypher
Method Syntax, Traits, BigUint using elliptic curve cryptography. Demonstration of a naive hashing algorithm using xor.
Assignment: Implement your own hashing algorithm
Enums and pattern matching with Option and Result. Implementing Linked List with the help of Box.
Assignment: Build your own bitcoin
Introduction to bitcoincorerpc
and bitcoin
crates.
Assignment: Interacting with bitcoin node and getting used to working with Result and Option
Demonstration of crates like sha256d
, secp256k1
, bitcoin
and serde
by creating a signed
transaction, parsing transaction data from text files and verifying their signatures.
Assignment: Given a list of transactions mine a new block.
Memory allocation in depth by building a graph data structure using Rust.
Assignment: Bitcoin blockchain privacy analysis by linking transactions using graph data structures.
Introduction to parallel programming in Rust.
Assignment: TODO
Introduction to asynchronous programming using tokio
.
Assignment: Communicate with bitcoin nodes by sending valid messages, might include bip324 here.
This course is sponsored by Chaincode to get more programmers into Rust Bitcoin FOSS. So we expect you to be a self-learner and come up with your own ideas. Every assignment is open ended and can be extended as you wish. If you submit the assignment within the deadline your implementation will be reviewed and you'll get timely feedback.
Three students from the first run of this course have successfully contributed to rust-coinselection repository so far.
During regular sessions groups will be formed. Each group will be provided a set of questions related to rust and bitcoin. Each student will be allocated a question and their job is to explain the concepts to others. Moderators will be provided.
The initial 20 minutes introduction will be conducted by the instructor, followed by 20 minutes of group discussion and the last 20 minutes will be reserved for clarifying open questions and issues.
This is a time specifically to address questions related to rust and bitcoin. A form will be posted where you can add your questions in advance so that the instructor can be prepared.
What Every Programmer should know about memory - Ulrich Drepper.