SlideShare a Scribd company logo
1 of 54
Download to read offline
Overview
Scripts in Bitcoin
Bitcoin Scripts using Node.JS
Kobi Gurkan
2016-06-11
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Outline
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Chief Scientist at Ownership - anti-counterfeiting, supply
chain and certification
Founded Shield128 - Blockchain security company
Founded EPOK
Math geek
Blockchain and security enthusiast
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Understand the Bitcoin scripting language
Review Bitcoin scripts, standard and non-standard
Learn to interpret, craft and test Bitcoin scripts using
Node.JS
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
What is Bitcoin?
Created in 2008 by Satoshi Nakamoto
Uses elliptic curves - asymmetric encryption,
public/private keys
P2P
Proof of work - solves Byzantine Generals Problem in
decentralized way!
For the first time, a decentralized system of money
Ledger of transactions
Everyone sees every transaction from the creation of the
network - end of 2008
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
What is Bitcoin?
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
What is Bitcoin?
What is a Bitcoin transaction? Transfer of value from A
to B. Or that’s what they want you to believe. . .
But first, let’s review some Bitcoin constructs.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Keys
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Keys
Bitcoin private key - random 256-bit number
Public key - derived from private key directly
Address
Version = 1 byte of 0 (zero); on the test network, this is
1 byte of 111
Key hash = Version concatenated with
RIPEMD-160(SHA-256(public key))
Checksum = 1st 4 bytes of SHA-256(SHA-256(Key
hash))
Bitcoin Address = Base58Encode(Key hash
concatenated with Checksum)
You prove ownership of an address by signing using your
private key - ECDSA
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Transactions
Source: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.htmlKobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Transactions
Every transaction has inputs and outputs
Output - credit 100 bitcoins to someone under conditions
- scriptPubKey
Input - spend 100 bitcoins from a previous output by
fulfilling the condition - scriptSig
That is, every input spends a previous output
Where are the initial Bitcoins to spend from? As we saw
in the diagram, mining
Because the ledger is public - i.e. you can see the move
of Bitcoins from the miner up to the moment you
received them
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Source: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
So in reality, you can do much more.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
117 Opcodes (some disabled, some placeholders)
1 byte
Simple language
No loops (=> no infinite loops)
Not turing-complete, intentionally
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Me
Goals
Bitcoin
Scripting language
Stack starts empty
scriptSig is evaluated
scriptPubKey is evaluated
If top of stack is non-zero then the transaction is valid
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 OP_SUB
2
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 2 OP_SUB
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 OP_SUB
2
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
3
This is actually valid, because the top of the stack is
non-zero.
We could also check the result to verify that we know
math.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 OP_SUB
2 3
OP_EQUAL
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 2 OP_SUB
3
OP_EQUAL
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
5 OP_SUB
2 3
OP_EQUAL
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
3 3
OP_EQUAL
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
3 OP_EQUAL
3
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Stack scriptSig scriptPubKey
1 (True)
Transaction valid too, and we indeed know to subtract!
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
This was easy, but might be hard to do by hand for more
complex scripts.
Luckily, BitPay did an awesome job by developing bitcore.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
> npm install bitcore
> node
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
var bitcore = require(’bitcore’);
var interpreter = bitcore.Script.Interpreter();
interpreter.set({script: ’OP_2 OP_1 OP_SUB’})
interpreter.evaluate()
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Let’s see an interactive step session!
https://asciinema.org/a/bkznx7286g09jleitqdu641xm
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
OK, but on to more honesty. The transaction was not
valid.
There are only a few standard scripts.
But don’t despair - arbitrary scripts are still allowed. I’ll
explain later.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
P2PK
scriptSig scriptPubKey
<sig> <pubkey>
OP_CHECKSIG
https:
//asciinema.org/a/82dplmciis241l3slxdee5h09
Not widely used anymore because public key is. . . public.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
P2PKH
scriptSig scriptPubKey
<sig> OP_DUP
<pubkey> OP_HASH160
OP_EQUALVERIFY
OP_CHECKSIG
Most used transaction - credit 100 Bitcoins to a hash of a
public key.
Prove you own the address by signing the entire
transaction - OP_CHECKSIG.
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Multisig
scriptSig scriptPubKey
OP_0 <m>
<A sig> <A pubkey>
[B sig] <B pubkey>
[C sig...] <C pubkey. . . >
<n>
OP_CHECKMULTISIG
Divide ownership of Bitcoins
Not widely used. Multisig is implemented as script
hash. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Null Data
scriptSig scriptPubKey
OP_RETURN
<0 to 80 bytes of data>
https:
//asciinema.org/a/0llb5rtakanx3to35lvcdul39
Can put arbitrary data on Blockchain!
https://twitter.com/op_return_ack/status/
705968000688455684
Open Assets (colored coins) - https:
//github.com/OpenAssets/open-assets-protocol/
blob/master/specification.mediawiki
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
P2SH
scriptSig scriptPubKey
<additional opcodes. . . > OP_HASH160
<redeemScript> <Hash160(redeemScript)>
OP_EQUAL
Supports arbitrary scripts!
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
P2SH-based 2-of-3 Multisig
scriptSig redeemScript scriptPubKey
OP_0 <OP_2> OP_HASH160
<A sig> <A pubkey> <PubKeyHash>
[C sig] <B pubkey> <Hash160(redeemScript)>
<redeemScript> <C pubkey. . . > OP_EQUAL
<OP_3>
OP_CHECKMULTISIG
Widely used form of Multisig
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Topic
1 Overview
Me
Goals
Bitcoin
Scripting language
2 Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Transaction Puzzle
scriptSig scriptPubKey
<data> OP_SHA256
<given_hash>
OP_EQUAL
https://live.blockcypher.com/btc/tx/
9969603dca74d14d29d1d5f56b94c7872551607f8c2d6837ab9715c60721
https://asciinema.org/a/aj92zdz3m61kjkqfg0nghxiq7
Or as P2SH:
https://asciinema.org/a/5sumtxdthpgza5f8z8s1t8jzb
But this is insecure because anyone can see the solution, since
everything is public. . .
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Secure Transaction Puzzle
scriptSig scriptPubKey
<sig> OP_SHA256
<pubkey> <given_hash>
<data> OP_EQUALVERIFY
OP_DUP
OP_HASH160
<pubkeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
This is non-standard, of course. But, we can put this script as a
P2SH script.
https://asciinema.org/a/bvk8nockh7dq715qp8avhiw8h
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Zero Knowledge Contingent Payment
scriptSig scriptPubKey
OP_SHA256
<Y>
OP_EQUAL
OP_IF
<Seller pubkey>
OP_ELSE
<block_height + 100>
OP_CHECKLOCKTIMEVERIFY
OP_DROP
<Buyer pubkey>
OP_ENDIF
OP_CHECKSIG
https://bitcoincore.org/en/2016/02/26/zero-knowledge-contingent-payments-announcement/
Deposit - https://live.blockcypher.com/btc/tx/
8e5df5f792ac4e98cca87f10aba7947337684a5a0a7333ab897fb9c9d616ba9e
Spend - https://live.blockcypher.com/btc/tx/
200554139d1e3fe6e499f6ffb0b6e01e706eb8c897293a7f6a26d25e39623fae/
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
OP_CHECKLOCKTIMEVERIFY
scriptSig scriptPubKey
OP_IF
<now + 3 months>
OP_CHECKLOCKTIMEVERIFY
OP_DROP
<Lenny’s pubkey>
OP_CHECKSIGVERIFY
1
OP_ELSE
2
OP_ENDIF
<Alice’s pubkey>
<Bob’s pubkey>
2
OP_CHECKMULTISIG
Allows to lock Bitcoins until a specific date!
https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
At any time:
scriptSig scriptPubKey
0
<Alice’s signature>
<Bob’s signature>
0
After 3 months:
scriptSig scriptPubKey
0
<Alice/Bob’s signature>
<Lenny’s signature>
1
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Puzzle time!
var bitcore = require(’bitcore’);
var request = require(’request’);
var utxo = {
’txId’ : ’0c5d827a24b0822abbff73f1adbfd2be7efaf4e368b4baac7e280865eb13f497’,
’outputIndex’ : 1,
’script’ : ’a91431f2ae5b333c56a4f01df6209382ec8f892e4f3687’,
’satoshis’ : 1000000
};
//you can see it here:
//https://live.blockcypher.com/btc/tx/0c5d827a24b0822abbff73f1adbfd2be7efaf4e368b4baac7e280865eb13f497
var address = ’YOUR_ADDRESS’;
var tx = new bitcore.Transaction().from(utxo).to(address, 900000);
var redeemScript = bitcore.Script.fromASM(’
OP_SHA256 
1bc273366856a5fb0bfd0611f57b7d4ae8e709dbe30fa207729f74716fd4e877
OP_EQUAL’);
//this is your task! what is the total number of Bitcoins that will
//ever be created, in hex format (don’t forget the leading zero!)?
var solutionScript = ’’;
var scriptSig = bitcore.Script.fromASM(solutionScript + ’ ’ + redeemScript);
tx.inputs[0].setScript(scriptSig);
var rawTx = tx.toString(’hex’);
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
var pushTx = {
tx: rawTx
};
//for simplicity, we’ll use the awesome BlockCypher API.
//You could also submit this raw transaction using Bitcoin Core.
request({
url: ’https://api.blockcypher.com/v1/btc/main/txs/push’,
method: ’POST’,
json: true,
body: pushTx
}, function (err, response, body) {
if (err) {
return console.log(’Error: ’, err);
}
console.log(body);
});
Kobi Gurkan Bitcoin Scripts using Node.JS
Overview
Scripts in Bitcoin
Simple example
Standard Scripts
Special. . .
Questions?
kobigurk@gmail.com
kobigurk.com
@kobigurk
We are hiring!
Kobi Gurkan Bitcoin Scripts using Node.JS

More Related Content

Viewers also liked

Microcontroladores 3 – conversor A/D; DSP
Microcontroladores 3 – conversor A/D; DSPMicrocontroladores 3 – conversor A/D; DSP
Microcontroladores 3 – conversor A/D; DSPPablo Gindel
 
Usando el Attiny85
Usando el Attiny85Usando el Attiny85
Usando el Attiny85Pablo Gindel
 
Electrónica 3 – componentes activos y semiconductores
Electrónica 3 – componentes activos y semiconductoresElectrónica 3 – componentes activos y semiconductores
Electrónica 3 – componentes activos y semiconductoresPablo Gindel
 
Microcontroladores 6 – interrupciones
Microcontroladores 6 – interrupcionesMicrocontroladores 6 – interrupciones
Microcontroladores 6 – interrupcionesPablo Gindel
 
Microcontroladores 1 – arquitectura
Microcontroladores 1 – arquitecturaMicrocontroladores 1 – arquitectura
Microcontroladores 1 – arquitecturaPablo Gindel
 
Óhmetro con Arduino
Óhmetro con Arduino  Óhmetro con Arduino
Óhmetro con Arduino Pablo Gindel
 
Dimmer de 230V AC con Arduino
Dimmer de 230V AC con ArduinoDimmer de 230V AC con Arduino
Dimmer de 230V AC con ArduinoPablo Gindel
 
Electrónica 4 – fuentes y baterías
Electrónica 4 – fuentes y bateríasElectrónica 4 – fuentes y baterías
Electrónica 4 – fuentes y bateríasPablo Gindel
 
Fuente conmutada con Arduino
Fuente conmutada con ArduinoFuente conmutada con Arduino
Fuente conmutada con ArduinoPablo Gindel
 
Microcontroladores 5 – comunicación (SPI & I2C)
Microcontroladores 5 – comunicación (SPI & I2C)Microcontroladores 5 – comunicación (SPI & I2C)
Microcontroladores 5 – comunicación (SPI & I2C)Pablo Gindel
 
Microcontroladores 2 – GPIO y PWM
Microcontroladores 2 – GPIO y PWMMicrocontroladores 2 – GPIO y PWM
Microcontroladores 2 – GPIO y PWMPablo Gindel
 
Microcontroladores 4 – comunicación (uart)
Microcontroladores 4 – comunicación (uart)Microcontroladores 4 – comunicación (uart)
Microcontroladores 4 – comunicación (uart)Pablo Gindel
 
Electrónica 2 – fundamentos 2; componentes pasivos
Electrónica 2 – fundamentos 2; componentes pasivosElectrónica 2 – fundamentos 2; componentes pasivos
Electrónica 2 – fundamentos 2; componentes pasivosPablo Gindel
 

Viewers also liked (15)

Microcontroladores 3 – conversor A/D; DSP
Microcontroladores 3 – conversor A/D; DSPMicrocontroladores 3 – conversor A/D; DSP
Microcontroladores 3 – conversor A/D; DSP
 
Usando el Attiny85
Usando el Attiny85Usando el Attiny85
Usando el Attiny85
 
Electrónica 3 – componentes activos y semiconductores
Electrónica 3 – componentes activos y semiconductoresElectrónica 3 – componentes activos y semiconductores
Electrónica 3 – componentes activos y semiconductores
 
Audio con Arduino
Audio con ArduinoAudio con Arduino
Audio con Arduino
 
Microcontroladores 6 – interrupciones
Microcontroladores 6 – interrupcionesMicrocontroladores 6 – interrupciones
Microcontroladores 6 – interrupciones
 
Microcontroladores 1 – arquitectura
Microcontroladores 1 – arquitecturaMicrocontroladores 1 – arquitectura
Microcontroladores 1 – arquitectura
 
Óhmetro con Arduino
Óhmetro con Arduino  Óhmetro con Arduino
Óhmetro con Arduino
 
Dimmer de 230V AC con Arduino
Dimmer de 230V AC con ArduinoDimmer de 230V AC con Arduino
Dimmer de 230V AC con Arduino
 
Electrónica 4 – fuentes y baterías
Electrónica 4 – fuentes y bateríasElectrónica 4 – fuentes y baterías
Electrónica 4 – fuentes y baterías
 
Fuente conmutada con Arduino
Fuente conmutada con ArduinoFuente conmutada con Arduino
Fuente conmutada con Arduino
 
Microcontroladores 5 – comunicación (SPI & I2C)
Microcontroladores 5 – comunicación (SPI & I2C)Microcontroladores 5 – comunicación (SPI & I2C)
Microcontroladores 5 – comunicación (SPI & I2C)
 
Microcontroladores 2 – GPIO y PWM
Microcontroladores 2 – GPIO y PWMMicrocontroladores 2 – GPIO y PWM
Microcontroladores 2 – GPIO y PWM
 
Microcontroladores 4 – comunicación (uart)
Microcontroladores 4 – comunicación (uart)Microcontroladores 4 – comunicación (uart)
Microcontroladores 4 – comunicación (uart)
 
Electrónica 2 – fundamentos 2; componentes pasivos
Electrónica 2 – fundamentos 2; componentes pasivosElectrónica 2 – fundamentos 2; componentes pasivos
Electrónica 2 – fundamentos 2; componentes pasivos
 
Capitulo 1 Ciencia y Tecnologia. 4o Congreso Internacional Multidisciplinario...
Capitulo 1 Ciencia y Tecnologia. 4o Congreso Internacional Multidisciplinario...Capitulo 1 Ciencia y Tecnologia. 4o Congreso Internacional Multidisciplinario...
Capitulo 1 Ciencia y Tecnologia. 4o Congreso Internacional Multidisciplinario...
 

Similar to Bitcoin Scripts using Node.JS, Kobi Gurkan

Libbitcoin slides
Libbitcoin slidesLibbitcoin slides
Libbitcoin slidesswansontec
 
localbitcoins-clone-script.pdf
localbitcoins-clone-script.pdflocalbitcoins-clone-script.pdf
localbitcoins-clone-script.pdfjemespetrick
 
Bitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceBitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceAll Things Open
 
2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite 2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite Hu Kenneth
 
Lbc clone faq
Lbc clone   faqLbc clone   faq
Lbc clone faqzaarahary
 
Bitclamp - A Permanent and Anonymous Publishing Platform Over Bitcoin
Bitclamp - A Permanent and Anonymous Publishing Platform Over BitcoinBitclamp - A Permanent and Anonymous Publishing Platform Over Bitcoin
Bitclamp - A Permanent and Anonymous Publishing Platform Over BitcoinBSidesROC
 
Cryptokitties clone script
Cryptokitties clone scriptCryptokitties clone script
Cryptokitties clone scriptzaarahary
 
Introduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting LanguageIntroduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting LanguageJeff Flowers
 
Bitcoin Wallet &amp Keys
Bitcoin Wallet &amp KeysBitcoin Wallet &amp Keys
Bitcoin Wallet &amp KeysShun Shiku
 
Bitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodBitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodGalin Dinkov
 
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxorlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxBill Wilder
 
Automating your releases with shell scripts - WordCamp Netherlands 2014
Automating your releases with shell scripts - WordCamp Netherlands 2014Automating your releases with shell scripts - WordCamp Netherlands 2014
Automating your releases with shell scripts - WordCamp Netherlands 2014Barry Kooij
 
Denker - Pharo: Present and Future - 2009-07-14
Denker - Pharo: Present and Future - 2009-07-14Denker - Pharo: Present and Future - 2009-07-14
Denker - Pharo: Present and Future - 2009-07-14CHOOSE
 
J.burke HackMiami6
J.burke HackMiami6J.burke HackMiami6
J.burke HackMiami6Jesse Burke
 

Similar to Bitcoin Scripts using Node.JS, Kobi Gurkan (20)

Libbitcoin slides
Libbitcoin slidesLibbitcoin slides
Libbitcoin slides
 
localbitcoins-clone-script.pdf
localbitcoins-clone-script.pdflocalbitcoins-clone-script.pdf
localbitcoins-clone-script.pdf
 
Bitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceBitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open Source
 
2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite 2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite
 
Tmc mastering bitcoins ppt
Tmc mastering bitcoins pptTmc mastering bitcoins ppt
Tmc mastering bitcoins ppt
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Lbc clone faq
Lbc clone   faqLbc clone   faq
Lbc clone faq
 
Bitclamp - A Permanent and Anonymous Publishing Platform Over Bitcoin
Bitclamp - A Permanent and Anonymous Publishing Platform Over BitcoinBitclamp - A Permanent and Anonymous Publishing Platform Over Bitcoin
Bitclamp - A Permanent and Anonymous Publishing Platform Over Bitcoin
 
Cryptokitties clone script
Cryptokitties clone scriptCryptokitties clone script
Cryptokitties clone script
 
Introduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting LanguageIntroduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting Language
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Bitcoin Wallet &amp Keys
Bitcoin Wallet &amp KeysBitcoin Wallet &amp Keys
Bitcoin Wallet &amp Keys
 
BPjs for IoT class
BPjs for IoT classBPjs for IoT class
BPjs for IoT class
 
Intro to blockchain
Intro to blockchainIntro to blockchain
Intro to blockchain
 
Bitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodBitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the Hood
 
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxorlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
 
Automating your releases with shell scripts - WordCamp Netherlands 2014
Automating your releases with shell scripts - WordCamp Netherlands 2014Automating your releases with shell scripts - WordCamp Netherlands 2014
Automating your releases with shell scripts - WordCamp Netherlands 2014
 
Denker - Pharo: Present and Future - 2009-07-14
Denker - Pharo: Present and Future - 2009-07-14Denker - Pharo: Present and Future - 2009-07-14
Denker - Pharo: Present and Future - 2009-07-14
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
J.burke HackMiami6
J.burke HackMiami6J.burke HackMiami6
J.burke HackMiami6
 

More from WithTheBest

Riccardo Vittoria
Riccardo VittoriaRiccardo Vittoria
Riccardo VittoriaWithTheBest
 
Recreating history in virtual reality
Recreating history in virtual realityRecreating history in virtual reality
Recreating history in virtual realityWithTheBest
 
Engaging and sharing your VR experience
Engaging and sharing your VR experienceEngaging and sharing your VR experience
Engaging and sharing your VR experienceWithTheBest
 
How to survive the early days of VR as an Indie Studio
How to survive the early days of VR as an Indie StudioHow to survive the early days of VR as an Indie Studio
How to survive the early days of VR as an Indie StudioWithTheBest
 
Mixed reality 101
Mixed reality 101 Mixed reality 101
Mixed reality 101 WithTheBest
 
Unlocking Human Potential with Immersive Technology
Unlocking Human Potential with Immersive TechnologyUnlocking Human Potential with Immersive Technology
Unlocking Human Potential with Immersive TechnologyWithTheBest
 
Building your own video devices
Building your own video devicesBuilding your own video devices
Building your own video devicesWithTheBest
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityWithTheBest
 
Haptics & amp; null space vr
Haptics & amp; null space vrHaptics & amp; null space vr
Haptics & amp; null space vrWithTheBest
 
How we use vr to break the laws of physics
How we use vr to break the laws of physicsHow we use vr to break the laws of physics
How we use vr to break the laws of physicsWithTheBest
 
The Virtual Self
The Virtual Self The Virtual Self
The Virtual Self WithTheBest
 
You dont have to be mad to do VR and AR ... but it helps
You dont have to be mad to do VR and AR ... but it helpsYou dont have to be mad to do VR and AR ... but it helps
You dont have to be mad to do VR and AR ... but it helpsWithTheBest
 
Omnivirt overview
Omnivirt overviewOmnivirt overview
Omnivirt overviewWithTheBest
 
VR Interactions - Jason Jerald
VR Interactions - Jason JeraldVR Interactions - Jason Jerald
VR Interactions - Jason JeraldWithTheBest
 
Japheth Funding your startup - dating the devil
Japheth  Funding your startup - dating the devilJapheth  Funding your startup - dating the devil
Japheth Funding your startup - dating the devilWithTheBest
 
Transported vr the virtual reality platform for real estate
Transported vr the virtual reality platform for real estateTransported vr the virtual reality platform for real estate
Transported vr the virtual reality platform for real estateWithTheBest
 
Measuring Behavior in VR - Rob Merki Cognitive VR
Measuring Behavior in VR - Rob Merki Cognitive VRMeasuring Behavior in VR - Rob Merki Cognitive VR
Measuring Behavior in VR - Rob Merki Cognitive VRWithTheBest
 
Global demand for Mixed Realty (VR/AR) content is about to explode.
Global demand for Mixed Realty (VR/AR) content is about to explode. Global demand for Mixed Realty (VR/AR) content is about to explode.
Global demand for Mixed Realty (VR/AR) content is about to explode. WithTheBest
 
VR, a new technology over 40,000 years old
VR, a new technology over 40,000 years oldVR, a new technology over 40,000 years old
VR, a new technology over 40,000 years oldWithTheBest
 

More from WithTheBest (20)

Riccardo Vittoria
Riccardo VittoriaRiccardo Vittoria
Riccardo Vittoria
 
Recreating history in virtual reality
Recreating history in virtual realityRecreating history in virtual reality
Recreating history in virtual reality
 
Engaging and sharing your VR experience
Engaging and sharing your VR experienceEngaging and sharing your VR experience
Engaging and sharing your VR experience
 
How to survive the early days of VR as an Indie Studio
How to survive the early days of VR as an Indie StudioHow to survive the early days of VR as an Indie Studio
How to survive the early days of VR as an Indie Studio
 
Mixed reality 101
Mixed reality 101 Mixed reality 101
Mixed reality 101
 
Unlocking Human Potential with Immersive Technology
Unlocking Human Potential with Immersive TechnologyUnlocking Human Potential with Immersive Technology
Unlocking Human Potential with Immersive Technology
 
Building your own video devices
Building your own video devicesBuilding your own video devices
Building your own video devices
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unity
 
Wizdish rovr
Wizdish rovrWizdish rovr
Wizdish rovr
 
Haptics & amp; null space vr
Haptics & amp; null space vrHaptics & amp; null space vr
Haptics & amp; null space vr
 
How we use vr to break the laws of physics
How we use vr to break the laws of physicsHow we use vr to break the laws of physics
How we use vr to break the laws of physics
 
The Virtual Self
The Virtual Self The Virtual Self
The Virtual Self
 
You dont have to be mad to do VR and AR ... but it helps
You dont have to be mad to do VR and AR ... but it helpsYou dont have to be mad to do VR and AR ... but it helps
You dont have to be mad to do VR and AR ... but it helps
 
Omnivirt overview
Omnivirt overviewOmnivirt overview
Omnivirt overview
 
VR Interactions - Jason Jerald
VR Interactions - Jason JeraldVR Interactions - Jason Jerald
VR Interactions - Jason Jerald
 
Japheth Funding your startup - dating the devil
Japheth  Funding your startup - dating the devilJapheth  Funding your startup - dating the devil
Japheth Funding your startup - dating the devil
 
Transported vr the virtual reality platform for real estate
Transported vr the virtual reality platform for real estateTransported vr the virtual reality platform for real estate
Transported vr the virtual reality platform for real estate
 
Measuring Behavior in VR - Rob Merki Cognitive VR
Measuring Behavior in VR - Rob Merki Cognitive VRMeasuring Behavior in VR - Rob Merki Cognitive VR
Measuring Behavior in VR - Rob Merki Cognitive VR
 
Global demand for Mixed Realty (VR/AR) content is about to explode.
Global demand for Mixed Realty (VR/AR) content is about to explode. Global demand for Mixed Realty (VR/AR) content is about to explode.
Global demand for Mixed Realty (VR/AR) content is about to explode.
 
VR, a new technology over 40,000 years old
VR, a new technology over 40,000 years oldVR, a new technology over 40,000 years old
VR, a new technology over 40,000 years old
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Bitcoin Scripts using Node.JS, Kobi Gurkan

  • 1. Overview Scripts in Bitcoin Bitcoin Scripts using Node.JS Kobi Gurkan 2016-06-11 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 2. Overview Scripts in Bitcoin Outline 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 3. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 4. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Chief Scientist at Ownership - anti-counterfeiting, supply chain and certification Founded Shield128 - Blockchain security company Founded EPOK Math geek Blockchain and security enthusiast Kobi Gurkan Bitcoin Scripts using Node.JS
  • 5. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Kobi Gurkan Bitcoin Scripts using Node.JS
  • 6. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 7. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Understand the Bitcoin scripting language Review Bitcoin scripts, standard and non-standard Learn to interpret, craft and test Bitcoin scripts using Node.JS Kobi Gurkan Bitcoin Scripts using Node.JS
  • 8. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 9. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Kobi Gurkan Bitcoin Scripts using Node.JS
  • 10. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language What is Bitcoin? Created in 2008 by Satoshi Nakamoto Uses elliptic curves - asymmetric encryption, public/private keys P2P Proof of work - solves Byzantine Generals Problem in decentralized way! For the first time, a decentralized system of money Ledger of transactions Everyone sees every transaction from the creation of the network - end of 2008 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 11. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language What is Bitcoin? Kobi Gurkan Bitcoin Scripts using Node.JS
  • 12. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language What is Bitcoin? What is a Bitcoin transaction? Transfer of value from A to B. Or that’s what they want you to believe. . . But first, let’s review some Bitcoin constructs. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 13. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Keys Kobi Gurkan Bitcoin Scripts using Node.JS
  • 14. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Keys Bitcoin private key - random 256-bit number Public key - derived from private key directly Address Version = 1 byte of 0 (zero); on the test network, this is 1 byte of 111 Key hash = Version concatenated with RIPEMD-160(SHA-256(public key)) Checksum = 1st 4 bytes of SHA-256(SHA-256(Key hash)) Bitcoin Address = Base58Encode(Key hash concatenated with Checksum) You prove ownership of an address by signing using your private key - ECDSA Kobi Gurkan Bitcoin Scripts using Node.JS
  • 15. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Transactions Source: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.htmlKobi Gurkan Bitcoin Scripts using Node.JS
  • 16. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Transactions Every transaction has inputs and outputs Output - credit 100 bitcoins to someone under conditions - scriptPubKey Input - spend 100 bitcoins from a previous output by fulfilling the condition - scriptSig That is, every input spends a previous output Where are the initial Bitcoins to spend from? As we saw in the diagram, mining Because the ledger is public - i.e. you can see the move of Bitcoins from the miner up to the moment you received them Kobi Gurkan Bitcoin Scripts using Node.JS
  • 17. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Source: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html Kobi Gurkan Bitcoin Scripts using Node.JS
  • 18. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Kobi Gurkan Bitcoin Scripts using Node.JS
  • 19. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 20. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language So in reality, you can do much more. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 21. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language 117 Opcodes (some disabled, some placeholders) 1 byte Simple language No loops (=> no infinite loops) Not turing-complete, intentionally Kobi Gurkan Bitcoin Scripts using Node.JS
  • 22. Overview Scripts in Bitcoin Me Goals Bitcoin Scripting language Stack starts empty scriptSig is evaluated scriptPubKey is evaluated If top of stack is non-zero then the transaction is valid Kobi Gurkan Bitcoin Scripts using Node.JS
  • 23. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 24. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 OP_SUB 2 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 25. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 2 OP_SUB Kobi Gurkan Bitcoin Scripts using Node.JS
  • 26. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 OP_SUB 2 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 27. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 3 This is actually valid, because the top of the stack is non-zero. We could also check the result to verify that we know math. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 28. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 OP_SUB 2 3 OP_EQUAL Kobi Gurkan Bitcoin Scripts using Node.JS
  • 29. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 2 OP_SUB 3 OP_EQUAL Kobi Gurkan Bitcoin Scripts using Node.JS
  • 30. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 5 OP_SUB 2 3 OP_EQUAL Kobi Gurkan Bitcoin Scripts using Node.JS
  • 31. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 3 3 OP_EQUAL Kobi Gurkan Bitcoin Scripts using Node.JS
  • 32. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 3 OP_EQUAL 3 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 33. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Stack scriptSig scriptPubKey 1 (True) Transaction valid too, and we indeed know to subtract! Kobi Gurkan Bitcoin Scripts using Node.JS
  • 34. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . This was easy, but might be hard to do by hand for more complex scripts. Luckily, BitPay did an awesome job by developing bitcore. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 35. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . > npm install bitcore > node Kobi Gurkan Bitcoin Scripts using Node.JS
  • 36. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . var bitcore = require(’bitcore’); var interpreter = bitcore.Script.Interpreter(); interpreter.set({script: ’OP_2 OP_1 OP_SUB’}) interpreter.evaluate() Kobi Gurkan Bitcoin Scripts using Node.JS
  • 37. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Let’s see an interactive step session! https://asciinema.org/a/bkznx7286g09jleitqdu641xm Kobi Gurkan Bitcoin Scripts using Node.JS
  • 38. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . OK, but on to more honesty. The transaction was not valid. There are only a few standard scripts. But don’t despair - arbitrary scripts are still allowed. I’ll explain later. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 39. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 40. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . P2PK scriptSig scriptPubKey <sig> <pubkey> OP_CHECKSIG https: //asciinema.org/a/82dplmciis241l3slxdee5h09 Not widely used anymore because public key is. . . public. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 41. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . P2PKH scriptSig scriptPubKey <sig> OP_DUP <pubkey> OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG Most used transaction - credit 100 Bitcoins to a hash of a public key. Prove you own the address by signing the entire transaction - OP_CHECKSIG. Kobi Gurkan Bitcoin Scripts using Node.JS
  • 42. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Multisig scriptSig scriptPubKey OP_0 <m> <A sig> <A pubkey> [B sig] <B pubkey> [C sig...] <C pubkey. . . > <n> OP_CHECKMULTISIG Divide ownership of Bitcoins Not widely used. Multisig is implemented as script hash. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 43. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Null Data scriptSig scriptPubKey OP_RETURN <0 to 80 bytes of data> https: //asciinema.org/a/0llb5rtakanx3to35lvcdul39 Can put arbitrary data on Blockchain! https://twitter.com/op_return_ack/status/ 705968000688455684 Open Assets (colored coins) - https: //github.com/OpenAssets/open-assets-protocol/ blob/master/specification.mediawiki Kobi Gurkan Bitcoin Scripts using Node.JS
  • 44. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . P2SH scriptSig scriptPubKey <additional opcodes. . . > OP_HASH160 <redeemScript> <Hash160(redeemScript)> OP_EQUAL Supports arbitrary scripts! Kobi Gurkan Bitcoin Scripts using Node.JS
  • 45. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . P2SH-based 2-of-3 Multisig scriptSig redeemScript scriptPubKey OP_0 <OP_2> OP_HASH160 <A sig> <A pubkey> <PubKeyHash> [C sig] <B pubkey> <Hash160(redeemScript)> <redeemScript> <C pubkey. . . > OP_EQUAL <OP_3> OP_CHECKMULTISIG Widely used form of Multisig Kobi Gurkan Bitcoin Scripts using Node.JS
  • 46. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Topic 1 Overview Me Goals Bitcoin Scripting language 2 Scripts in Bitcoin Simple example Standard Scripts Special. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 47. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Transaction Puzzle scriptSig scriptPubKey <data> OP_SHA256 <given_hash> OP_EQUAL https://live.blockcypher.com/btc/tx/ 9969603dca74d14d29d1d5f56b94c7872551607f8c2d6837ab9715c60721 https://asciinema.org/a/aj92zdz3m61kjkqfg0nghxiq7 Or as P2SH: https://asciinema.org/a/5sumtxdthpgza5f8z8s1t8jzb But this is insecure because anyone can see the solution, since everything is public. . . Kobi Gurkan Bitcoin Scripts using Node.JS
  • 48. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Secure Transaction Puzzle scriptSig scriptPubKey <sig> OP_SHA256 <pubkey> <given_hash> <data> OP_EQUALVERIFY OP_DUP OP_HASH160 <pubkeyHash> OP_EQUALVERIFY OP_CHECKSIG This is non-standard, of course. But, we can put this script as a P2SH script. https://asciinema.org/a/bvk8nockh7dq715qp8avhiw8h Kobi Gurkan Bitcoin Scripts using Node.JS
  • 49. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Zero Knowledge Contingent Payment scriptSig scriptPubKey OP_SHA256 <Y> OP_EQUAL OP_IF <Seller pubkey> OP_ELSE <block_height + 100> OP_CHECKLOCKTIMEVERIFY OP_DROP <Buyer pubkey> OP_ENDIF OP_CHECKSIG https://bitcoincore.org/en/2016/02/26/zero-knowledge-contingent-payments-announcement/ Deposit - https://live.blockcypher.com/btc/tx/ 8e5df5f792ac4e98cca87f10aba7947337684a5a0a7333ab897fb9c9d616ba9e Spend - https://live.blockcypher.com/btc/tx/ 200554139d1e3fe6e499f6ffb0b6e01e706eb8c897293a7f6a26d25e39623fae/ Kobi Gurkan Bitcoin Scripts using Node.JS
  • 50. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . OP_CHECKLOCKTIMEVERIFY scriptSig scriptPubKey OP_IF <now + 3 months> OP_CHECKLOCKTIMEVERIFY OP_DROP <Lenny’s pubkey> OP_CHECKSIGVERIFY 1 OP_ELSE 2 OP_ENDIF <Alice’s pubkey> <Bob’s pubkey> 2 OP_CHECKMULTISIG Allows to lock Bitcoins until a specific date! https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki Kobi Gurkan Bitcoin Scripts using Node.JS
  • 51. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . At any time: scriptSig scriptPubKey 0 <Alice’s signature> <Bob’s signature> 0 After 3 months: scriptSig scriptPubKey 0 <Alice/Bob’s signature> <Lenny’s signature> 1 Kobi Gurkan Bitcoin Scripts using Node.JS
  • 52. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Puzzle time! var bitcore = require(’bitcore’); var request = require(’request’); var utxo = { ’txId’ : ’0c5d827a24b0822abbff73f1adbfd2be7efaf4e368b4baac7e280865eb13f497’, ’outputIndex’ : 1, ’script’ : ’a91431f2ae5b333c56a4f01df6209382ec8f892e4f3687’, ’satoshis’ : 1000000 }; //you can see it here: //https://live.blockcypher.com/btc/tx/0c5d827a24b0822abbff73f1adbfd2be7efaf4e368b4baac7e280865eb13f497 var address = ’YOUR_ADDRESS’; var tx = new bitcore.Transaction().from(utxo).to(address, 900000); var redeemScript = bitcore.Script.fromASM(’ OP_SHA256 1bc273366856a5fb0bfd0611f57b7d4ae8e709dbe30fa207729f74716fd4e877 OP_EQUAL’); //this is your task! what is the total number of Bitcoins that will //ever be created, in hex format (don’t forget the leading zero!)? var solutionScript = ’’; var scriptSig = bitcore.Script.fromASM(solutionScript + ’ ’ + redeemScript); tx.inputs[0].setScript(scriptSig); var rawTx = tx.toString(’hex’); Kobi Gurkan Bitcoin Scripts using Node.JS
  • 53. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . var pushTx = { tx: rawTx }; //for simplicity, we’ll use the awesome BlockCypher API. //You could also submit this raw transaction using Bitcoin Core. request({ url: ’https://api.blockcypher.com/v1/btc/main/txs/push’, method: ’POST’, json: true, body: pushTx }, function (err, response, body) { if (err) { return console.log(’Error: ’, err); } console.log(body); }); Kobi Gurkan Bitcoin Scripts using Node.JS
  • 54. Overview Scripts in Bitcoin Simple example Standard Scripts Special. . . Questions? kobigurk@gmail.com kobigurk.com @kobigurk We are hiring! Kobi Gurkan Bitcoin Scripts using Node.JS