Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Noding a Blockchain

Noding a Blockchain

Blockchains and cryptocurrency are all the hot rage these days. But if you're like me, it all seems like a bunch of voodoo magic math and super complicated algorithms.

So I decided the best way to de-mystify and learn it was to build my own blockchain and cryptocurrency. And of course, I started with Node! I'm going to walk you through some of my code and show a few bits of intermediate-to-advanced Node that I had to tackle to build my blockchain.

Topics covered will include: efficient asynchronous logic, SHA256 hashing and RSA cryptography, mesh communications via UDP and TCP messages, streams, offloading work to child processes, and persisting data in Git.

Kyle Simpson

April 19, 2018
Tweet

More Decks by Kyle Simpson

Other Decks in Programming

Transcript

  1. • Read/write access is private • Data is (usually) mutated

    • Sharing and backups:
 replication • All stakeholders are trusted
  2. • Private/sensitive data • "Single" point of failure (SPOF) •

    Target for hacking • Load balancing, eventual
 consistency
  3. • Public data • Trust based on math • Essentially

    zero failure • "50% + 1" weakness • Never consistent, consensus
 complications
  4. { index: 1, prevHash: "B22D1D8...89E2B87", data: ... , timestamp: 1524029051480,

    } data: [ { hash: "C37AF10...0040A18", data: ... , timestamp: ... , ... }, { hash: "B9DC4FC...91F59BD", data: ... , timestamp: ... , ... }, ... , ], { index: 1, prevHash: "B22D1D8...89E2B87", timestamp: 1524029051480, }
  5. Private Key Public
 Key "some secret text" Encrypt Decrypt "some

    secret text" "jn4ra...bBH3/sKn" What I always thought...
  6. Private Key Public
 Key "some secret text" Encrypt Decrypt "some

    secret text" "jn4ra...bBH3/sKn" How it actually works...