How to run the blockchain.info Bitcoin wallet in NodeJS (experimental).
Dutch Blockchain Hackathon - Tech Deep Dive - 2016-12-07 in Delft
Presentation made with Deckset, source:
https://gist.github.com/Sjors/b39f1e4135c05e8dfe2cf337608ec7a8
Instructions:
https://github.com/blockchain/My-Wallet-V3/wiki/NodeJS
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
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
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