SlideShare a Scribd company logo
1 of 16
Download to read offline
☞ Blockchain.info
☞ Bitcoin blockchain1
info
☞ Popular Bitcoin wallet
☞ Offices in London & NYC
☞ Sjors Provoost
☞ Web Wallet Developer
☞ Commutes between
Utrecht and London
1
The Bitcoin blockchain still has the most hash power behind it.
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 1
Wallet in Browser
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 2
Wallet in NodeJS
Install
npm install blockchain/my-wallet-v3#v3.24.5
Load
Blockchain = require('blockchain-wallet-client')
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 3
Create a wallet
email = 'sjors+delft@blockchain.com'
pwd = 'very_weak'
Blockchain.MyWallet.createNewWallet(
email,
pwd,
'',
'EUR',
'en',
console.log, // Success
console.error // Error
)
// 1822bb00-5c33-46a9-bbcb-b75de17fca66
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 4
Login
user_id = '1822bb00-5c33-46a9-bbcb-b75de17fca66'
pwd = 'very_weak'
Blockchain.MyWallet.login(
user_id,
pwd,
{ twoFactor: null, sessionToken: null }, {}
).then(MyWallet.wallet.fetchAccountInfo)
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 5
Get funding address
account = MyWallet.wallet.hdwallet.accounts[0]
account.receiveAddress
// '1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2'
Show account balance
// Loads balance and recent transactions
MyWallet.wallet.getHistory()
account.balance
// 113702 (in Satoshi = €0,70)
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 6
About wallets
{
"user_id": "1822bb00-5c33-46a9-bbcb-b75de17fca66",
"options": {
"pbkdf2_iterations": 5000 // Password is hashed using PBKDF2
},
"seed_hex": "65b4cd78ba92d490466532a7939e5405",
// grant please funny inside coil else book play pole ostrich never arctic
"address_labels": [{
"index": 1, "label": "Zakgeld"
}
☞ encrypted in browser, stored on server
☞ we can't access your private keys, nor reset your password
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 7
Spend coins
p = new Blockchain.Payment()
p
.to('1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w')
.from(0)
.amount(50000) // In Satoshi = €0.35
.build()
.sign()
.publish()
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 8
Import private key
wallet = Blockchain.MyWallet.wallet
pk = 'L3qqTb8FD1wWhfZjjyJSiwQZyp3oLbycBNB9So45bj4uAYrP5YmS'
wallet.importLegacyAddress(pk, '')
addr = wallet.keys[0].address;
// 1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w
Show balance:
addr.getBalance()
// 50000 // In Satoshi = €0.35
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 9
Monitor address
op = MyWallet.ws.msgAddrSub(account.receiveAddress)
// '{"op":"addr_sub","addr":"1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2"}'
MyWallet.ws.send(op)
WebSockets
☞ "a computer communications protocol, providing full-duplex
communication channels over a single TCP connection." -
Wikipedia
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 10
{
"op": "utx",
"x": {
"hash": "f22525fd3fdbac441267b4f68f13fb8f1cabd6d0967a48844647b91e3f9ef8ea",
"inputs": [{
"prev_out": {
"spent": true,
"addr": "1Ea4SXJbd2z7NszrS23i5rAd4v7LjuuJCE", // Sender wallet
"value": 3040127, // 0.003 BTC
},
}],
"out": [{
"spent": false,
"addr": "1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2", // Our wallet
}, {
... // Change
}]
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 11
Process websocket message
MyWallet.getSocketOnMessage = (msg) => {
obj = JSON.parse(msg)
if (obj.op === 'utx') {
if (obj.x.out.filter(
(output) => output.addr === account.receiveAddress
).length) {
console.log('Coins received!')
}
}
}
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 12
Buy Bitcoin with NodeJS
☞ Partner company handles the purchase
coinify = MyWallet.wallet.external.addCoinify()
coinify.signup('NL','EUR').then(console.log)
// user: ....,
// offlineToken: 'AkwyQ...'
☞ Partner account details stored in wallet
☞ Bitcoin goes straight to your wallet
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 13
☞ Ask quote and buy:
coinify.getBuyQuote(10 * 100, 'EUR', 'BTC').then((quote) => {
console.log(quote.quoteAmount / 100000000, "BTC")
quote.buy('card').then((trade) =>
console.log(trade.address)
// Do some manual stuff with your creditcard
)
})
☞ Monitor purchase address (web socket):
coinify.monitorPayments()
coinify.trades[0].watchAddress().then(() => console.log('Bitcoin Received!'))
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 14
Sign a message
☞ Prove that you have the private key for an address:
addr = MyWallet.wallet.keys[0].address;
// 1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w
msg = 'Hallo Delft'
sig = MyWallet.wallet.keys[0].signMessage(msg)
// 'H2yfcyYDoSj+siL4rvMmnHIvKUDH4GThFHYGlQk28q79AhreibtQvmaH+5W6hRty+S1gQeFXbaKs04xjIsHRCOE='
☞ Verify the proof:
Blockchain.Helpers.verifyMessage('1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w', sig, msg )
// true
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 15
Thank You
Resources
☞ https://github.com/blockchain/my-wallet-v3
☞ https://www.blockchain.com/careers/
2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 16

More Related Content

What's hot

Even the LastPass Will be Stolen Deal with It!
Even the LastPass Will be Stolen Deal with It!Even the LastPass Will be Stolen Deal with It!
Even the LastPass Will be Stolen Deal with It!
Martin Vigo
 
Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)
Artur Skowroński
 
Windows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows AzureWindows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows Azure
Vitor Ciaramella
 

What's hot (20)

Intro into blockchain
Intro into blockchainIntro into blockchain
Intro into blockchain
 
CBGTBT - Part 5 - Blockchains 102
CBGTBT - Part 5 - Blockchains 102CBGTBT - Part 5 - Blockchains 102
CBGTBT - Part 5 - Blockchains 102
 
Intro to Blockchain - And, by the way, what the heck is proof-of-work?
Intro to Blockchain - And, by the way, what the heck is proof-of-work?Intro to Blockchain - And, by the way, what the heck is proof-of-work?
Intro to Blockchain - And, by the way, what the heck is proof-of-work?
 
Bitcoin & Ethereum Address
Bitcoin & Ethereum AddressBitcoin & Ethereum Address
Bitcoin & Ethereum Address
 
create your own cryptocurrency
create your own cryptocurrencycreate your own cryptocurrency
create your own cryptocurrency
 
Public Blockchain Scalability (April 2018)
Public Blockchain Scalability (April 2018)Public Blockchain Scalability (April 2018)
Public Blockchain Scalability (April 2018)
 
Bitcoin, Banking and the Blockchain
Bitcoin, Banking and the BlockchainBitcoin, Banking and the Blockchain
Bitcoin, Banking and the Blockchain
 
Intro to Blockchain Slides
Intro to Blockchain SlidesIntro to Blockchain Slides
Intro to Blockchain Slides
 
Even the LastPass Will be Stolen Deal with It!
Even the LastPass Will be Stolen Deal with It!Even the LastPass Will be Stolen Deal with It!
Even the LastPass Will be Stolen Deal with It!
 
Wallets and Transactions #1
Wallets and Transactions #1Wallets and Transactions #1
Wallets and Transactions #1
 
Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2
 
Introduction to Bitcoin for programmers
Introduction to Bitcoin for programmersIntroduction to Bitcoin for programmers
Introduction to Bitcoin for programmers
 
Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)
 
Bitcoin: introduction for programmers - Pecha Kucha
Bitcoin:   introduction for programmers - Pecha KuchaBitcoin:   introduction for programmers - Pecha Kucha
Bitcoin: introduction for programmers - Pecha Kucha
 
Build your own block chain
Build your own block chainBuild your own block chain
Build your own block chain
 
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
 
Start Carrier with blockchain and Ethereum [PW MINI - Fall '17]
Start Carrier with blockchain and Ethereum [PW MINI - Fall '17]Start Carrier with blockchain and Ethereum [PW MINI - Fall '17]
Start Carrier with blockchain and Ethereum [PW MINI - Fall '17]
 
Girl Develop It - Intro To Blockchain And Cryptocurrencies
Girl Develop It - Intro To Blockchain And CryptocurrenciesGirl Develop It - Intro To Blockchain And Cryptocurrencies
Girl Develop It - Intro To Blockchain And Cryptocurrencies
 
Windows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows AzureWindows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows Azure
 
gething started - ethereum & using the geth golang client
gething started - ethereum & using the geth golang clientgething started - ethereum & using the geth golang client
gething started - ethereum & using the geth golang client
 

Viewers also liked

SmartOrganization
SmartOrganizationSmartOrganization
SmartOrganization
pgorjup
 
Etherem ~ agvm
Etherem ~ agvmEtherem ~ agvm
Etherem ~ agvm
gha sshee
 

Viewers also liked (20)

SmartOrganization
SmartOrganizationSmartOrganization
SmartOrganization
 
Dapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen TechmeetupDapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen Techmeetup
 
Ethereum @ descon 2016
Ethereum @ descon 2016Ethereum @ descon 2016
Ethereum @ descon 2016
 
Etherem ~ agvm
Etherem ~ agvmEtherem ~ agvm
Etherem ~ agvm
 
日本のIT市場のトピックス
日本のIT市場のトピックス日本のIT市場のトピックス
日本のIT市場のトピックス
 
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter..."Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
 
Introduction to Idea
Introduction to IdeaIntroduction to Idea
Introduction to Idea
 
Vision for a health blockchain
Vision for a health blockchainVision for a health blockchain
Vision for a health blockchain
 
Etherisc Versicherung neu erfinden
Etherisc Versicherung neu erfindenEtherisc Versicherung neu erfinden
Etherisc Versicherung neu erfinden
 
Solidity intro
Solidity introSolidity intro
Solidity intro
 
The Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: MixThe Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: Mix
 
Learning Solidity
Learning SolidityLearning Solidity
Learning Solidity
 
Ingredients for creating dapps
Ingredients for creating dappsIngredients for creating dapps
Ingredients for creating dapps
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
The Ethereum Geth Client
The Ethereum Geth ClientThe Ethereum Geth Client
The Ethereum Geth Client
 
Build dapps 1:3 dev tools
Build dapps 1:3 dev toolsBuild dapps 1:3 dev tools
Build dapps 1:3 dev tools
 
The future of Blockchain
The future of BlockchainThe future of Blockchain
The future of Blockchain
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial EN
 
State of wifi_2016
State of wifi_2016State of wifi_2016
State of wifi_2016
 
How smart are those smart contract
How smart are those smart contractHow smart are those smart contract
How smart are those smart contract
 

Similar to NodeJS Blockchain.info Wallet

Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Svetlin Nakov
 
Nachos3 - Theoretical Part
Nachos3 - Theoretical PartNachos3 - Theoretical Part
Nachos3 - Theoretical Part
Eduardo Triana
 

Similar to NodeJS Blockchain.info Wallet (20)

Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
 
Eclipsecon Europe: Blockchain, Ethereum and Business Applications
Eclipsecon Europe: Blockchain, Ethereum and Business ApplicationsEclipsecon Europe: Blockchain, Ethereum and Business Applications
Eclipsecon Europe: Blockchain, Ethereum and Business Applications
 
Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...
Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...
Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
Building decentralised apps with js - Devoxx Morocco 2018
Building decentralised apps with js - Devoxx Morocco 2018Building decentralised apps with js - Devoxx Morocco 2018
Building decentralised apps with js - Devoxx Morocco 2018
 
Blockchain basics
Blockchain basicsBlockchain basics
Blockchain basics
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by Blockchain
 
Unchain Blockchain by Eva Rez
Unchain Blockchain by Eva RezUnchain Blockchain by Eva Rez
Unchain Blockchain by Eva Rez
 
Unchain Blockchain by Eva Rez
Unchain Blockchain by Eva RezUnchain Blockchain by Eva Rez
Unchain Blockchain by Eva Rez
 
Multi-Signature Crypto-Wallets: Nakov at Blockchain Berlin 2018
Multi-Signature Crypto-Wallets: Nakov at Blockchain Berlin 2018Multi-Signature Crypto-Wallets: Nakov at Blockchain Berlin 2018
Multi-Signature Crypto-Wallets: Nakov at Blockchain Berlin 2018
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing - Node.j...
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing - Node.j...Cracking JWT tokens: a tale of magic, Node.JS and parallel computing - Node.j...
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing - Node.j...
 
Blockchain introduction
Blockchain introductionBlockchain introduction
Blockchain introduction
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
Blockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationBlockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentation
 
Block 16 - Ethereum block transaction info via aggregated views API by Block 16
Block 16 - Ethereum block transaction info via aggregated views API by Block 16Block 16 - Ethereum block transaction info via aggregated views API by Block 16
Block 16 - Ethereum block transaction info via aggregated views API by Block 16
 
Build on Streakk Chain - Blockchain
Build on Streakk Chain - BlockchainBuild on Streakk Chain - Blockchain
Build on Streakk Chain - Blockchain
 
Multi-Signature Crypto-Wallets: Nakov at SoftUnit Conf 2018
Multi-Signature Crypto-Wallets: Nakov at SoftUnit Conf 2018Multi-Signature Crypto-Wallets: Nakov at SoftUnit Conf 2018
Multi-Signature Crypto-Wallets: Nakov at SoftUnit Conf 2018
 
Nachos3 - Theoretical Part
Nachos3 - Theoretical PartNachos3 - Theoretical Part
Nachos3 - Theoretical Part
 
A research-oriented introduction to the cryptographic currencies (starting wi...
A research-oriented introduction to the cryptographic currencies (starting wi...A research-oriented introduction to the cryptographic currencies (starting wi...
A research-oriented introduction to the cryptographic currencies (starting wi...
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid Environments
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
 
Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 

NodeJS Blockchain.info Wallet

  • 1. ☞ Blockchain.info ☞ Bitcoin blockchain1 info ☞ Popular Bitcoin wallet ☞ Offices in London & NYC ☞ Sjors Provoost ☞ Web Wallet Developer ☞ Commutes between Utrecht and London 1 The Bitcoin blockchain still has the most hash power behind it. 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 1
  • 2. Wallet in Browser 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 2
  • 3. Wallet in NodeJS Install npm install blockchain/my-wallet-v3#v3.24.5 Load Blockchain = require('blockchain-wallet-client') 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 3
  • 4. Create a wallet email = 'sjors+delft@blockchain.com' pwd = 'very_weak' Blockchain.MyWallet.createNewWallet( email, pwd, '', 'EUR', 'en', console.log, // Success console.error // Error ) // 1822bb00-5c33-46a9-bbcb-b75de17fca66 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 4
  • 5. Login user_id = '1822bb00-5c33-46a9-bbcb-b75de17fca66' pwd = 'very_weak' Blockchain.MyWallet.login( user_id, pwd, { twoFactor: null, sessionToken: null }, {} ).then(MyWallet.wallet.fetchAccountInfo) 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 5
  • 6. Get funding address account = MyWallet.wallet.hdwallet.accounts[0] account.receiveAddress // '1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2' Show account balance // Loads balance and recent transactions MyWallet.wallet.getHistory() account.balance // 113702 (in Satoshi = €0,70) 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 6
  • 7. About wallets { "user_id": "1822bb00-5c33-46a9-bbcb-b75de17fca66", "options": { "pbkdf2_iterations": 5000 // Password is hashed using PBKDF2 }, "seed_hex": "65b4cd78ba92d490466532a7939e5405", // grant please funny inside coil else book play pole ostrich never arctic "address_labels": [{ "index": 1, "label": "Zakgeld" } ☞ encrypted in browser, stored on server ☞ we can't access your private keys, nor reset your password 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 7
  • 8. Spend coins p = new Blockchain.Payment() p .to('1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w') .from(0) .amount(50000) // In Satoshi = €0.35 .build() .sign() .publish() 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 8
  • 9. Import private key wallet = Blockchain.MyWallet.wallet pk = 'L3qqTb8FD1wWhfZjjyJSiwQZyp3oLbycBNB9So45bj4uAYrP5YmS' wallet.importLegacyAddress(pk, '') addr = wallet.keys[0].address; // 1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w Show balance: addr.getBalance() // 50000 // In Satoshi = €0.35 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 9
  • 10. Monitor address op = MyWallet.ws.msgAddrSub(account.receiveAddress) // '{"op":"addr_sub","addr":"1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2"}' MyWallet.ws.send(op) WebSockets ☞ "a computer communications protocol, providing full-duplex communication channels over a single TCP connection." - Wikipedia 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 10
  • 11. { "op": "utx", "x": { "hash": "f22525fd3fdbac441267b4f68f13fb8f1cabd6d0967a48844647b91e3f9ef8ea", "inputs": [{ "prev_out": { "spent": true, "addr": "1Ea4SXJbd2z7NszrS23i5rAd4v7LjuuJCE", // Sender wallet "value": 3040127, // 0.003 BTC }, }], "out": [{ "spent": false, "addr": "1ALfF8Ps8bkZT1qyf2TVa1Lu3P74wUfog2", // Our wallet }, { ... // Change }] 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 11
  • 12. Process websocket message MyWallet.getSocketOnMessage = (msg) => { obj = JSON.parse(msg) if (obj.op === 'utx') { if (obj.x.out.filter( (output) => output.addr === account.receiveAddress ).length) { console.log('Coins received!') } } } 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 12
  • 13. Buy Bitcoin with NodeJS ☞ Partner company handles the purchase coinify = MyWallet.wallet.external.addCoinify() coinify.signup('NL','EUR').then(console.log) // user: ...., // offlineToken: 'AkwyQ...' ☞ Partner account details stored in wallet ☞ Bitcoin goes straight to your wallet 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 13
  • 14. ☞ Ask quote and buy: coinify.getBuyQuote(10 * 100, 'EUR', 'BTC').then((quote) => { console.log(quote.quoteAmount / 100000000, "BTC") quote.buy('card').then((trade) => console.log(trade.address) // Do some manual stuff with your creditcard ) }) ☞ Monitor purchase address (web socket): coinify.monitorPayments() coinify.trades[0].watchAddress().then(() => console.log('Bitcoin Received!')) 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 14
  • 15. Sign a message ☞ Prove that you have the private key for an address: addr = MyWallet.wallet.keys[0].address; // 1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w msg = 'Hallo Delft' sig = MyWallet.wallet.keys[0].signMessage(msg) // 'H2yfcyYDoSj+siL4rvMmnHIvKUDH4GThFHYGlQk28q79AhreibtQvmaH+5W6hRty+S1gQeFXbaKs04xjIsHRCOE=' ☞ Verify the proof: Blockchain.Helpers.verifyMessage('1AvPkgjx2RKFW6xeqKVoKjsmJMZWrqs17w', sig, msg ) // true 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 15
  • 16. Thank You Resources ☞ https://github.com/blockchain/my-wallet-v3 ☞ https://www.blockchain.com/careers/ 2016-12-07 - Dutch Blockchain Hackathon - Technology Deep Dive - sjors@blockchain.com 16