SlideShare a Scribd company logo
O C T O B E R 2 7 , 2 0 1 7
C O N F I D E N T I A L
Node.js and Blockchain
Building the Web 3.0 with Node.js
October 27, 2017
Julián Duque
Developer and Educator / Community Organizer / Engineer
@julian_duque
October 27, 2017
Julián Duque
Not a Crypto Expert / Not here for Crypto Currencies (or ICOs)
@julian_duque
© 2017 NodeSource C O N F I D E N T I A L
What is Blockchain?
📦⛓
4
© 2017 NodeSource C O N F I D E N T I A L5
Hashes
hash(‘😀’) = 2a02ea…7b6
hash(‘😃’) = e36f86…028
hash(‘Hola’) = f688ae…22e
hash(‘Hola!’) = 0676dc…06f
© 2017 NodeSource C O N F I D E N T I A L6
Merkle Trees
binary hash tree
Image credit: Wikipedia
© 2017 NodeSource C O N F I D E N T I A L7
Blockchains
• Continuously growing, append only, list of records
(blocks)
• Distributed Ledger Technology (DLT)
• Linked and secured using cryptography
© 2017 NodeSource C O N F I D E N T I A L8
Blockchains
Image credit: Wikipedia
© 2017 NodeSource C O N F I D E N T I A L9
Blockchain Immutability
Image credit: edX - Hyperledger Course
© 2017 NodeSource C O N F I D E N T I A L10
Reaching Consensus
Proof of Work
• Blocks are added to the ledger gradually
• People (nodes) take turns to add blocks
• Root checksum must start with a number of zeroes (difficulty, conditions)
• Block includes a nonsense (nonce) that can be changed to create new
checksums
• Difficulty is adjusted to target desired time between blocks (control)
© 2017 NodeSource C O N F I D E N T I A L11
Reaching Consensus
Incentives
• Miner (node) who find a new block gets a reward
• Reward is used as currency and to pay transaction fees
• Miners also get transaction fees along with the reward
• Encourage miners to process blocks with transactions (Game theory)
• Encourage users to pay transaction fees depending on urgency
© 2017 NodeSource C O N F I D E N T I A L
Public vs Private
12
C O N F I D E N T I A L© 2017 NodeSource13
© 2017 NodeSource C O N F I D E N T I A L14
Bitcoin
• Crypto Currency (BTC)
• Transfer value from address to address (wallet
to wallet)
• Scripting Language - Turing-Incomplete
• Consensus Algorithm: Proof of Work
C O N F I D E N T I A L© 2017 NodeSource15
© 2017 NodeSource C O N F I D E N T I A L16
Ethereum
• Virtual Machine (EVM)
• Usage is metered by transaction fees (gas)
• Crypto Currency (ether - ETH)
• Transactions manipulate state
• EVM is Turing-Complete
• Consensus Algorithm: Proof of Work, moving to Proof
of Stake
C O N F I D E N T I A L© 2017 NodeSource17
C O N F I D E N T I A L© 2017 NodeSource18
Hyperledger
• Umbrella of Open Source projects
• Focused on Business / Permissioned Blockchains
• No crypto currency
• Consensus algorithms: Depending of Project (PoET,
PFBT)
• Some projects are EVM compatible, others have they
own VM
© 2017 NodeSource C O N F I D E N T I A L
Why Node.js?
19
© 2017 NodeSource C O N F I D E N T I A L20
Why Node.js?
• JavaScript: Language of the web
• Great for building tools
• Great as API / Frontend layer
© 2017 NodeSource C O N F I D E N T I A L
Develop Blockchain Applications
21
© 2017 NodeSource C O N F I D E N T I A L
BitcoinJS
22
© 2017 NodeSource C O N F I D E N T I A L23
BitcoinJS
https://bitcoinjs.org
• Create / Interact with Bitcoin wallets
• Transactions
• Crypto operations
© 2017 NodeSource C O N F I D E N T I A L
EthereumJS
24
© 2017 NodeSource C O N F I D E N T I A L25
EthereumJS
https://ethereumjs.github.io
• Collection of libraries and utilities for
Ethereum
• Always looking for contributors
© 2017 NodeSource C O N F I D E N T I A L
Smart Contracts
26
© 2017 NodeSource C O N F I D E N T I A L27
Smart Contracts
• Applications that can be deployed to the
Blockchain (Ethereum / Hyperledger)
• Takes care of State in Blockchain
• Defines and enforces the rules and
penalties around an agreement
© 2017 NodeSource C O N F I D E N T I A L
Solidity
28
© 2017 NodeSource C O N F I D E N T I A L29
Solidity
• High level language to build Smart
Contracts for Ethereum
• Typed Language
• Based on JavaScript
• Compiled to EVM
© 2017 NodeSource C O N F I D E N T I A L30
Solidity
pragma solidity ^0.4.11;
contract HelloWorld {
uint public balance;
address public owner;
function HelloWorld() public {
owner = msg.sender;
balance = 0;
}
function update() public payable isOwner() {
balance = msg.value;
}
modifier isOwner() {
require(msg.sender == owner);
_;
}
}
© 2017 NodeSource C O N F I D E N T I A L31
Solidity
$ npm install -g solc
© 2017 NodeSource C O N F I D E N T I A L32
© 2017 NodeSource C O N F I D E N T I A L33
Truffle
• Framework to build, test and deploy
Smart Contracts
• Test Smart Contracts with JavaScript
• Project generators for ĐApps
© 2017 NodeSource C O N F I D E N T I A L34
Truffle
$ npm install -g truffle
© 2017 NodeSource C O N F I D E N T I A L
ĐApps
35
© 2017 NodeSource C O N F I D E N T I A L36
ĐApps
https://www.stateofthedapps.com
• Web 3.0 - Decentralized Applications
• Interact with Smart Contracts using backend-
less JavaScript Applications
• Bitcoin: The first ĐApp
© 2017 NodeSource C O N F I D E N T I A L
MetaMask
37
© 2017 NodeSource C O N F I D E N T I A L38
MetaMask
https://www.metamask.io
• Brings Ethereum to your Browser
• Perfect for running ĐApps
• No need to have a full node running
© 2017 NodeSource C O N F I D E N T I A L
Hyperledger Composer
39
© 2017 NodeSource C O N F I D E N T I A L40
Hyperledger Composer
https://hyperledger.github.io/composer/
• Build private Blockchain Applications and Business Networks
• Build Smart Contracts with a model language
• Generate REST APIs
• Node.js modules (composer-client) to interact with your network
© 2017 NodeSource C O N F I D E N T I A L41
© 2017 NodeSource C O N F I D E N T I A L42
Blockstack
https://blockstack.org
• Build decentralized applications with JavaScript (BlockstackJS)
• Virtualchain: An existing Blockchain extension
© 2017 NodeSource C O N F I D E N T I A L
Demo
https://julianduque.github.io/simple-vote/
43
C O N F I D E N T I A L
Thank you!
Julián Duque
julian@nodesource.com
@julian_duque

More Related Content

PDF
Building Passion Driven Communities
PDF
International Coastal Atlas Network and Web 3.0
PDF
Blockchain and smart contracts, what they are and why you should really care ...
ODP
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
PPTX
Blockchain
PDF
Introduction to Blockchain Development
PPTX
Block chain
PPTX
Node.js Blockchain Implementation
Building Passion Driven Communities
International Coastal Atlas Network and Web 3.0
Blockchain and smart contracts, what they are and why you should really care ...
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Blockchain
Introduction to Blockchain Development
Block chain
Node.js Blockchain Implementation

Similar to Node.js and Blockchain (20)

PDF
Click Ventures Blockchain Ecosystem Report 2018
PDF
Introduction to Blockchain and Smart Contracts
PDF
Blockchain_Certification_2018_V5.pdf
PDF
Ethereum in a nutshell
PDF
How to Enterprise Node
PDF
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
PPTX
Blockchain Future & Investments 2018 - Women in Product
PDF
How to contribute to Node.js (and OpenSource)
PPTX
Introduction to Blockchain
PPTX
Hyperledger Project Overview - January 2018.pptx
PDF
Javascript toolset for Ethereum Smart Contract development
PDF
The JavaScript toolset for development on Ethereum
PDF
Blockchain for Business
PPTX
Blockchain Ecosystem and Cryptocurrency Regulations
PPTX
Fullsize Smart Contracts That Learn
PDF
Introduction to Ethereum Blockchain & Smart Contract
PDF
Azure blockchain service
PDF
Blockchain Educational Framework - Course Overview
PDF
Blockchain for Business on Hyperledger
PDF
Keynote: Blockchain Technology: a Sustainable Concept for the Future?
Click Ventures Blockchain Ecosystem Report 2018
Introduction to Blockchain and Smart Contracts
Blockchain_Certification_2018_V5.pdf
Ethereum in a nutshell
How to Enterprise Node
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Blockchain Future & Investments 2018 - Women in Product
How to contribute to Node.js (and OpenSource)
Introduction to Blockchain
Hyperledger Project Overview - January 2018.pptx
Javascript toolset for Ethereum Smart Contract development
The JavaScript toolset for development on Ethereum
Blockchain for Business
Blockchain Ecosystem and Cryptocurrency Regulations
Fullsize Smart Contracts That Learn
Introduction to Ethereum Blockchain & Smart Contract
Azure blockchain service
Blockchain Educational Framework - Course Overview
Blockchain for Business on Hyperledger
Keynote: Blockchain Technology: a Sustainable Concept for the Future?
Ad

Recently uploaded (20)

PPTX
Patient Appointment Booking in Odoo with online payment
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Nekopoi APK 2025 free lastest update
PPTX
assetexplorer- product-overview - presentation
PPTX
history of c programming in notes for students .pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Patient Appointment Booking in Odoo with online payment
wealthsignaloriginal-com-DS-text-... (1).pdf
Complete Guide to Website Development in Malaysia for SMEs
Salesforce Agentforce AI Implementation.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Nekopoi APK 2025 free lastest update
assetexplorer- product-overview - presentation
history of c programming in notes for students .pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Reimagine Home Health with the Power of Agentic AI​
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Why Generative AI is the Future of Content, Code & Creativity?
AutoCAD Professional Crack 2025 With License Key
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Digital Systems & Binary Numbers (comprehensive )
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Designing Intelligence for the Shop Floor.pdf
Odoo Companies in India – Driving Business Transformation.pdf
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Ad

Node.js and Blockchain

  • 1. O C T O B E R 2 7 , 2 0 1 7 C O N F I D E N T I A L Node.js and Blockchain Building the Web 3.0 with Node.js
  • 2. October 27, 2017 Julián Duque Developer and Educator / Community Organizer / Engineer @julian_duque
  • 3. October 27, 2017 Julián Duque Not a Crypto Expert / Not here for Crypto Currencies (or ICOs) @julian_duque
  • 4. © 2017 NodeSource C O N F I D E N T I A L What is Blockchain? 📦⛓ 4
  • 5. © 2017 NodeSource C O N F I D E N T I A L5 Hashes hash(‘😀’) = 2a02ea…7b6 hash(‘😃’) = e36f86…028 hash(‘Hola’) = f688ae…22e hash(‘Hola!’) = 0676dc…06f
  • 6. © 2017 NodeSource C O N F I D E N T I A L6 Merkle Trees binary hash tree Image credit: Wikipedia
  • 7. © 2017 NodeSource C O N F I D E N T I A L7 Blockchains • Continuously growing, append only, list of records (blocks) • Distributed Ledger Technology (DLT) • Linked and secured using cryptography
  • 8. © 2017 NodeSource C O N F I D E N T I A L8 Blockchains Image credit: Wikipedia
  • 9. © 2017 NodeSource C O N F I D E N T I A L9 Blockchain Immutability Image credit: edX - Hyperledger Course
  • 10. © 2017 NodeSource C O N F I D E N T I A L10 Reaching Consensus Proof of Work • Blocks are added to the ledger gradually • People (nodes) take turns to add blocks • Root checksum must start with a number of zeroes (difficulty, conditions) • Block includes a nonsense (nonce) that can be changed to create new checksums • Difficulty is adjusted to target desired time between blocks (control)
  • 11. © 2017 NodeSource C O N F I D E N T I A L11 Reaching Consensus Incentives • Miner (node) who find a new block gets a reward • Reward is used as currency and to pay transaction fees • Miners also get transaction fees along with the reward • Encourage miners to process blocks with transactions (Game theory) • Encourage users to pay transaction fees depending on urgency
  • 12. © 2017 NodeSource C O N F I D E N T I A L Public vs Private 12
  • 13. C O N F I D E N T I A L© 2017 NodeSource13
  • 14. © 2017 NodeSource C O N F I D E N T I A L14 Bitcoin • Crypto Currency (BTC) • Transfer value from address to address (wallet to wallet) • Scripting Language - Turing-Incomplete • Consensus Algorithm: Proof of Work
  • 15. C O N F I D E N T I A L© 2017 NodeSource15
  • 16. © 2017 NodeSource C O N F I D E N T I A L16 Ethereum • Virtual Machine (EVM) • Usage is metered by transaction fees (gas) • Crypto Currency (ether - ETH) • Transactions manipulate state • EVM is Turing-Complete • Consensus Algorithm: Proof of Work, moving to Proof of Stake
  • 17. C O N F I D E N T I A L© 2017 NodeSource17
  • 18. C O N F I D E N T I A L© 2017 NodeSource18 Hyperledger • Umbrella of Open Source projects • Focused on Business / Permissioned Blockchains • No crypto currency • Consensus algorithms: Depending of Project (PoET, PFBT) • Some projects are EVM compatible, others have they own VM
  • 19. © 2017 NodeSource C O N F I D E N T I A L Why Node.js? 19
  • 20. © 2017 NodeSource C O N F I D E N T I A L20 Why Node.js? • JavaScript: Language of the web • Great for building tools • Great as API / Frontend layer
  • 21. © 2017 NodeSource C O N F I D E N T I A L Develop Blockchain Applications 21
  • 22. © 2017 NodeSource C O N F I D E N T I A L BitcoinJS 22
  • 23. © 2017 NodeSource C O N F I D E N T I A L23 BitcoinJS https://bitcoinjs.org • Create / Interact with Bitcoin wallets • Transactions • Crypto operations
  • 24. © 2017 NodeSource C O N F I D E N T I A L EthereumJS 24
  • 25. © 2017 NodeSource C O N F I D E N T I A L25 EthereumJS https://ethereumjs.github.io • Collection of libraries and utilities for Ethereum • Always looking for contributors
  • 26. © 2017 NodeSource C O N F I D E N T I A L Smart Contracts 26
  • 27. © 2017 NodeSource C O N F I D E N T I A L27 Smart Contracts • Applications that can be deployed to the Blockchain (Ethereum / Hyperledger) • Takes care of State in Blockchain • Defines and enforces the rules and penalties around an agreement
  • 28. © 2017 NodeSource C O N F I D E N T I A L Solidity 28
  • 29. © 2017 NodeSource C O N F I D E N T I A L29 Solidity • High level language to build Smart Contracts for Ethereum • Typed Language • Based on JavaScript • Compiled to EVM
  • 30. © 2017 NodeSource C O N F I D E N T I A L30 Solidity pragma solidity ^0.4.11; contract HelloWorld { uint public balance; address public owner; function HelloWorld() public { owner = msg.sender; balance = 0; } function update() public payable isOwner() { balance = msg.value; } modifier isOwner() { require(msg.sender == owner); _; } }
  • 31. © 2017 NodeSource C O N F I D E N T I A L31 Solidity $ npm install -g solc
  • 32. © 2017 NodeSource C O N F I D E N T I A L32
  • 33. © 2017 NodeSource C O N F I D E N T I A L33 Truffle • Framework to build, test and deploy Smart Contracts • Test Smart Contracts with JavaScript • Project generators for ĐApps
  • 34. © 2017 NodeSource C O N F I D E N T I A L34 Truffle $ npm install -g truffle
  • 35. © 2017 NodeSource C O N F I D E N T I A L ĐApps 35
  • 36. © 2017 NodeSource C O N F I D E N T I A L36 ĐApps https://www.stateofthedapps.com • Web 3.0 - Decentralized Applications • Interact with Smart Contracts using backend- less JavaScript Applications • Bitcoin: The first ĐApp
  • 37. © 2017 NodeSource C O N F I D E N T I A L MetaMask 37
  • 38. © 2017 NodeSource C O N F I D E N T I A L38 MetaMask https://www.metamask.io • Brings Ethereum to your Browser • Perfect for running ĐApps • No need to have a full node running
  • 39. © 2017 NodeSource C O N F I D E N T I A L Hyperledger Composer 39
  • 40. © 2017 NodeSource C O N F I D E N T I A L40 Hyperledger Composer https://hyperledger.github.io/composer/ • Build private Blockchain Applications and Business Networks • Build Smart Contracts with a model language • Generate REST APIs • Node.js modules (composer-client) to interact with your network
  • 41. © 2017 NodeSource C O N F I D E N T I A L41
  • 42. © 2017 NodeSource C O N F I D E N T I A L42 Blockstack https://blockstack.org • Build decentralized applications with JavaScript (BlockstackJS) • Virtualchain: An existing Blockchain extension
  • 43. © 2017 NodeSource C O N F I D E N T I A L Demo https://julianduque.github.io/simple-vote/ 43
  • 44. C O N F I D E N T I A L Thank you! Julián Duque julian@nodesource.com @julian_duque