Principles and core techniques of shared public ledgers, with an emphasis on distributed consensus. Topics include Byzantine agreement, authenticated data structures, Bitcoin, Lightning networks, proof of stake, and new techniques to implement a shared public ledger.