Gentle Introduction to Blockchain with Lisp
Free!
Minimum price
$11.95
Suggested price

Gentle Introduction to Blockchain with Lisp

About the Book

Blockchain is a powerful concept that allows us to effectively distribute data among users. We will learn about Lisp, and then write a simple blockchain implementation with it.

This book aims to be accessible to novices that have no prior experience in programming. Thus, this book is designed to be self-contained.

One of the reasons for writing this book is that I could not find a single book that explained how to implement blockchain from scratch, covering all the details. I had to do a lot of research on the Internet to come up with a complete picture of what blockchain is, how one can implement it, and what it is good for.

The recommended approach for the book is to follow along and write the code as it's being explained instead of reading passively. This way you will get the most of it. All of the source code is available for download.

Contributions to the book are welcome on GitHub.

About the Author

Boro Sitnikovski
Boro Sitnikovski

Boro Sitnikovski has over 10 years of experience working professionally as a Software Engineer. He started programming with the Assembly programming language on an Intel x86 at the age of 10. While in high school, he has won several prizes on competitive programming, varying from 4th, 3rd, and 1st place.

He is an Informatics graduate - his Bachelor's thesis was titled "Programming in Haskell using algebraic data structures", and his Master's thesis was titled "Formal verification of Instruction Sets in Virtual Machines". He has also published a few papers on software verification. Other research interests of his include programming languages, mathematics, logic, algorithms, and writing correct software.

He is a strong believer in the open-source philosophy and contributes to various open-source projects.

In his spare time, he enjoys some time off with his family.

Table of Contents

  • Preface and acknowledgments
  • 1. Introduction to Blockchain
    • 1.1. Motivation and basic definitions
    • 1.2. Encryption
      • 1.2.1. Functions
      • 1.2.2. Symmetric-key algorithm
      • 1.2.3. Asymmetric-key algorithm
    • 1.3. Hashing
    • 1.4. Smart contracts
    • 1.5. Bitcoin
    • 1.6. Example workflows
    • Summary
  • 2. Racket programming language
    • 2.1. Introduction to Lisp
      • 2.1.1. Data structures and recursion
      • 2.1.2. Languages and syntax
    • 2.2. Configuration and installation
    • 2.3. Introduction to Racket
      • 2.3.1. Primitive types
      • 2.3.2. Lists, evaluation, quotes
      • 2.3.3. Pairs
      • 2.3.4. Adding definitions
      • 2.3.5. Procedures and functions
      • 2.3.6. Conditional procedures
      • 2.3.7. Recursive procedures
      • 2.3.8. Procedures that return procedures
      • 2.3.9. General higher-order procedures
      • 2.3.10. Packages
      • 2.3.11. Scope
      • 2.3.12. Mutation
      • 2.3.13. Structures
      • 2.3.14. Threads
    • 2.4. Creating an executable
    • Summary
  • 3. Blockchain implementation
    • 3.1. wallet.rkt
    • 3.2. block.rkt
      • 3.2.1. Construction
      • 3.2.2. Hashing and verification
      • 3.2.3. Hashcash algorithm
    • 3.3. utils.rkt
    • 3.4. Transactions
      • 3.4.1. transaction-io.rkt
      • 3.4.2. transaction.rkt
      • 3.4.3. Digital signatures
      • 3.4.4. Processing transactions
    • 3.5. blockchain.rkt
      • 3.5.1. Initialization
      • 3.5.2. Rewards
      • 3.5.3. Inserting a transaction
      • 3.5.4. Verification
    • 3.6. Integrating components
      • 3.6.1. main-helper.rkt
      • 3.6.2. main.rkt
    • Summary
  • 4. Extending the blockchain
    • 4.1. Smart contracts implementation
      • 4.1.1. smart-contracts.rkt
      • 4.1.2. Updating existing code
    • 4.2. Peer-to-peer implementation
      • 4.2.1. peer-to-peer.rkt
      • 4.2.2. Updating existing code
      • 4.2.3. main-p2p.rkt
    • 4.3. Putting everything together
    • Summary
  • Conclusion
  • Further reading
  • Appendices
    • Appendix A: Cryptojacking
    • Appendix B: Macros
      • Hygienic macros
  • About the author
  • Notes

Authors have earned$9,675,609writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub