SlideShare a Scribd company logo
P2SH and Multi-Sig
Ending the Cold Storage Ice Age
Benedict Chan, BitGo
@bencxr benchan@bitgo.com
Agenda
● Pay to Script Hash
● Emerging multi-sig concepts and scenarios
● Implement a multi-sig wallet in 5 minutes
Pay to Script Hash (P2SH)
● Bitcoin address can require successful
execution of a script corresponding to a
hash
○ Past: “Claim if signed by xyz private key”
○ Now: “Claim only if xyz conditions were satisfied”
● 7.88% of BTC held in P2SH addresses
P2SH - Hash-Locked Contract
● Example: A and B want to trade BTC for DOGE
● A thinks of any x and hashes it to H(x)
● On Bitcoin chain:
○ A creates transaction TX0 to a P2SH script to
■ Pay BTC to B if x of H(x) is known and signed by B or
■ Pay BTC to A if signed by A and B
○ A creates refund transaction TX1 (with TX0 as input) valid at a
future date (3 days later) for B to sign
● On Dogecoin chain:
○ B does similar (refund not shown), sends to P2SH script “Pay
2,000,000 doge to A if x of H(x) is known and signed by A”
● When A claims DOGE by revealing x, B can claim BTC
P2SH - Multi-Signature Address
● Spend an input if only M of N signatures were
provided
○ Commonly 2 of 3 (up to 15)
○ M of N must be defined at address creation
time
● Signers cannot change outputs
Cold Storage on Multiple Machines
● Create and use keys on separate
online/offline devices
● Hacker must compromise multiple machines
● Redundancy
● Examples: Bitcoind (createmultisigaddress,
createrawtransaction), Armory Lock Boxes
Multi-Sig Hardware Wallets
● Additional signer
● Private key never leaves device
● Low malware risk
Joint Wallet with Multiple Parties
● Family expense wallet
● Group savings (birthday gift, holiday funds)
● All signers have equal importance
Multi-Sig Escrow
● 2-of-3: Buyer, Seller and Escrow
● Buyer sends purchase funds, seller (may) send collateral
● If buyer receives item in good order, create payment
transaction with seller.
● Otherwise escrow agent can mediate
● Escrow agent can never steal funds with only 1 key
Micro Payment Channel
● Customer creates TX0 for 1 BTC to shared 2-of-2 address
● Provider sends Nlocktime refund transaction for full amount
● Publish TX0
● Replace off-chain transactions
○ 0.99 to customer, 0.01 to provider
○ 0.98 to customer, 0.02 to provider
○ …
○ 0.55 to customer, 0.45 to provider
● Broadcast only last transaction to close channel
Instant Confirmations
● “Clearing house” creates a 2-of-2 address for the customer
to pre-fund
● Payments out of address guaranteed “instant
confirmations”
● Clearing house would never double-sign the same input
BitPay Impulse
Smart Co-Signer Service
● 2 keys held by customer, 1 key by
service
● User creates and half-signs transaction,
then sends to co-signer
● Co-signer executes security and logic
● Per-day limits / Per-transaction limits
● Destination bitcoin address whitelists
● Time of day restrictions
● Human approvals - User/password/2FA
● Red button (kill switch)
● Blacklisting, IP lockdown, ...
● External webhooks
BitGo Co-Signer Logic
Enterprise Treasury
● Multiple users on a wallet
○ Require 2FA and User Auth
● Accountant creates transactions up to a limited amount per
day
● CEO, CFO able to approve large withdrawals
● Can add/remove privileges of users at any time
● Example customers: SecondMarket, ChangeTip, BitFury..
ATM Provider
● Shared wallet with multiple machines
● One access token per machine
● IP lockdown for each token
● Tokens may be individually revoked
● Example customers: Lamassu ATMs
Exchange Hot Wallet Pool
● Exchange maintains single hot wallet for all deposits and
withdrawals
● Outgoing withdrawal amount limited per day
● Callback on each transaction to accounts database
● Examples: Bitstamp, BitSpark, BitQuick, MimeticMarkets, ...
Exchange-owned Segregated Wallet
● One wallet per exchange user
● Per-user-wallet policy granularity
● Withdrawals require user 2FA
● Transactions to house wallet whitelisted
● Every user owns their own private key
● Backup key held by arms-length custodian
● Buy orders can go directly to user wallet
● Sell orders can be confirmed by exchange instantly
● Great for places that allow you to just “buy
bitcoin”
User-owned Wallet Linked With Exchange
Exchange+User Joint Wallet
● User and exchange each own a private key
● Instant confirmation
● Withdrawals depend on
○ Webhook call to exchange to ensure user has
sufficient margin
Co-Signer Oracle Contracts
● HTTP callback enables external logic to be implemented
Shared
Multi-Sig
Wallet
UserA BTC Collateral (1BTC)
UserB BTC Collateral (1BTC)
Winner creates/signs tx
for 2BTC out
BitGo Co-
signer
Webhook oracle
gets BTC price at
contract date to
determine winner
cosign/transmit
Bitcoin
P2P Net
Open Source SDK
1. Create a wallet
2. Get new addresses
3. Fund the wallet
4. Get transactions and balances
5. Send coins
Implementing multi-sig in 5 minutes
Exchange integration demo
● First open-source multi-sig bitcoin exchange
● Uses bitgod (bitcoind adapter for Bitgo)
Thank you
visit: https://www.bitgo.com/platform
twitter: @bencxr
email: benchan@bitgo.com

More Related Content

PPTX
bitcoin
PDF
Sidechains Presentation
PDF
Blockchain
PPTX
BitCoin explained
PPTX
Intro to smart contract on blockchain en
PDF
Metadata in the Blockchain: The OP_RETURN Explosion
PPTX
Blockchain: use cases for the future
PDF
Blockchain, cryptography and tokens — NYC Bar presentation
bitcoin
Sidechains Presentation
Blockchain
BitCoin explained
Intro to smart contract on blockchain en
Metadata in the Blockchain: The OP_RETURN Explosion
Blockchain: use cases for the future
Blockchain, cryptography and tokens — NYC Bar presentation

What's hot (20)

PDF
create your own cryptocurrency
PDF
Blockchain, bitcoin
PDF
Sidechain talk
PPTX
Bitcoin, Blockchain and the Crypto Contracts - Part 2
PDF
Boolberry reduces blockchain bloat
PPTX
Bitcoin (Cryptocurrency)
PDF
Blockchain overview, use cases, implementations and challenges
PDF
Blockchain, Smart Contracts and DAOs in 10 minutes
PDF
Blockchain Deconstructed - by nexxworks
PPTX
Understanding Cryptocurrency
PDF
An analysis of attacks on blockchain consensus
PDF
PDF
Economías criptográficas
PPTX
Altcoins
PPTX
Bitcoin101
PPTX
Beginners guide for smart contract
PPTX
Introduction to Blockchain Technology
PDF
Cryptocurrency for Dummies
PPTX
Bitcoin powerpoint
PDF
Bitcoin, Banking and the Blockchain
create your own cryptocurrency
Blockchain, bitcoin
Sidechain talk
Bitcoin, Blockchain and the Crypto Contracts - Part 2
Boolberry reduces blockchain bloat
Bitcoin (Cryptocurrency)
Blockchain overview, use cases, implementations and challenges
Blockchain, Smart Contracts and DAOs in 10 minutes
Blockchain Deconstructed - by nexxworks
Understanding Cryptocurrency
An analysis of attacks on blockchain consensus
Economías criptográficas
Altcoins
Bitcoin101
Beginners guide for smart contract
Introduction to Blockchain Technology
Cryptocurrency for Dummies
Bitcoin powerpoint
Bitcoin, Banking and the Blockchain
Ad

Viewers also liked (8)

PPTX
David Moss - Hartree Centre
PDF
SPDY / W3C
PDF
From Fast To SPDY
PDF
SPDY and What to Consider for HTTP/2.0
PDF
SPDY @Zynga
PDF
SPDY, TCP, and the Single Connection Throttle
PDF
University of Delaware - Improving Web Protocols (early SPDY talk)
PDF
Multi-Signature Deep Dive
David Moss - Hartree Centre
SPDY / W3C
From Fast To SPDY
SPDY and What to Consider for HTTP/2.0
SPDY @Zynga
SPDY, TCP, and the Single Connection Throttle
University of Delaware - Improving Web Protocols (early SPDY talk)
Multi-Signature Deep Dive
Ad

Similar to P2SH and MultiSig: Concepts and Models to End the Cold Storage Ice Age (20)

PDF
Introduction to Bitcoin for programmers
PDF
Blockchain External.pdf
PPTX
Blockchain 101
PPTX
Blockchain, bitcoin, ethereum and ICOs
PDF
Bitcoin p2p money
PPTX
Blockchain (and Bitcoin)
PDF
Bitcoins: Application of blockchain technology
PPTX
Crypto & Crpyocurrencies Intro
PDF
Ethereum overview
PPTX
Blockchain and Bitcoin
PDF
Blockchain and Bitcoin
PDF
Bitcoin 101 - Certified Bitcoin Professional Training Session
PDF
Meteor and Bitcoin (Lightning Talk)
PPTX
Blockchain.pptx
PDF
Blockchain introduction
ODP
Bitcoin Talk at Rainbow
PDF
"How Blockchains and Bitcoins work" by Ricardo Águas @ Pizza Talks Lisbon 201...
PDF
Bitcoin for programmers - part 1 version 2
PDF
Intro to Blockchain Slides
PDF
Introduction to Bitcoin for programmers
Blockchain External.pdf
Blockchain 101
Blockchain, bitcoin, ethereum and ICOs
Bitcoin p2p money
Blockchain (and Bitcoin)
Bitcoins: Application of blockchain technology
Crypto & Crpyocurrencies Intro
Ethereum overview
Blockchain and Bitcoin
Blockchain and Bitcoin
Bitcoin 101 - Certified Bitcoin Professional Training Session
Meteor and Bitcoin (Lightning Talk)
Blockchain.pptx
Blockchain introduction
Bitcoin Talk at Rainbow
"How Blockchains and Bitcoins work" by Ricardo Águas @ Pizza Talks Lisbon 201...
Bitcoin for programmers - part 1 version 2
Intro to Blockchain Slides

Recently uploaded (20)

PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPTX
introduction to high performance computing
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
737-MAX_SRG.pdf student reference guides
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
communication and presentation skills 01
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
Visual Aids for Exploratory Data Analysis.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Soil Improvement Techniques Note - Rabbi
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
introduction to high performance computing
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
737-MAX_SRG.pdf student reference guides
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Nature of X-rays, X- Ray Equipment, Fluoroscopy
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
communication and presentation skills 01
"Array and Linked List in Data Structures with Types, Operations, Implementat...
Module 8- Technological and Communication Skills.pptx
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
Visual Aids for Exploratory Data Analysis.pdf
Safety Seminar civil to be ensured for safe working.
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Soil Improvement Techniques Note - Rabbi

P2SH and MultiSig: Concepts and Models to End the Cold Storage Ice Age

  • 1. P2SH and Multi-Sig Ending the Cold Storage Ice Age Benedict Chan, BitGo @bencxr benchan@bitgo.com
  • 2. Agenda ● Pay to Script Hash ● Emerging multi-sig concepts and scenarios ● Implement a multi-sig wallet in 5 minutes
  • 3. Pay to Script Hash (P2SH) ● Bitcoin address can require successful execution of a script corresponding to a hash ○ Past: “Claim if signed by xyz private key” ○ Now: “Claim only if xyz conditions were satisfied” ● 7.88% of BTC held in P2SH addresses
  • 4. P2SH - Hash-Locked Contract ● Example: A and B want to trade BTC for DOGE ● A thinks of any x and hashes it to H(x) ● On Bitcoin chain: ○ A creates transaction TX0 to a P2SH script to ■ Pay BTC to B if x of H(x) is known and signed by B or ■ Pay BTC to A if signed by A and B ○ A creates refund transaction TX1 (with TX0 as input) valid at a future date (3 days later) for B to sign ● On Dogecoin chain: ○ B does similar (refund not shown), sends to P2SH script “Pay 2,000,000 doge to A if x of H(x) is known and signed by A” ● When A claims DOGE by revealing x, B can claim BTC
  • 5. P2SH - Multi-Signature Address ● Spend an input if only M of N signatures were provided ○ Commonly 2 of 3 (up to 15) ○ M of N must be defined at address creation time ● Signers cannot change outputs
  • 6. Cold Storage on Multiple Machines ● Create and use keys on separate online/offline devices ● Hacker must compromise multiple machines ● Redundancy ● Examples: Bitcoind (createmultisigaddress, createrawtransaction), Armory Lock Boxes
  • 7. Multi-Sig Hardware Wallets ● Additional signer ● Private key never leaves device ● Low malware risk
  • 8. Joint Wallet with Multiple Parties ● Family expense wallet ● Group savings (birthday gift, holiday funds) ● All signers have equal importance
  • 9. Multi-Sig Escrow ● 2-of-3: Buyer, Seller and Escrow ● Buyer sends purchase funds, seller (may) send collateral ● If buyer receives item in good order, create payment transaction with seller. ● Otherwise escrow agent can mediate ● Escrow agent can never steal funds with only 1 key
  • 10. Micro Payment Channel ● Customer creates TX0 for 1 BTC to shared 2-of-2 address ● Provider sends Nlocktime refund transaction for full amount ● Publish TX0 ● Replace off-chain transactions ○ 0.99 to customer, 0.01 to provider ○ 0.98 to customer, 0.02 to provider ○ … ○ 0.55 to customer, 0.45 to provider ● Broadcast only last transaction to close channel
  • 11. Instant Confirmations ● “Clearing house” creates a 2-of-2 address for the customer to pre-fund ● Payments out of address guaranteed “instant confirmations” ● Clearing house would never double-sign the same input BitPay Impulse
  • 12. Smart Co-Signer Service ● 2 keys held by customer, 1 key by service ● User creates and half-signs transaction, then sends to co-signer ● Co-signer executes security and logic
  • 13. ● Per-day limits / Per-transaction limits ● Destination bitcoin address whitelists ● Time of day restrictions ● Human approvals - User/password/2FA ● Red button (kill switch) ● Blacklisting, IP lockdown, ... ● External webhooks BitGo Co-Signer Logic
  • 14. Enterprise Treasury ● Multiple users on a wallet ○ Require 2FA and User Auth ● Accountant creates transactions up to a limited amount per day ● CEO, CFO able to approve large withdrawals ● Can add/remove privileges of users at any time ● Example customers: SecondMarket, ChangeTip, BitFury..
  • 15. ATM Provider ● Shared wallet with multiple machines ● One access token per machine ● IP lockdown for each token ● Tokens may be individually revoked ● Example customers: Lamassu ATMs
  • 16. Exchange Hot Wallet Pool ● Exchange maintains single hot wallet for all deposits and withdrawals ● Outgoing withdrawal amount limited per day ● Callback on each transaction to accounts database ● Examples: Bitstamp, BitSpark, BitQuick, MimeticMarkets, ...
  • 17. Exchange-owned Segregated Wallet ● One wallet per exchange user ● Per-user-wallet policy granularity ● Withdrawals require user 2FA ● Transactions to house wallet whitelisted
  • 18. ● Every user owns their own private key ● Backup key held by arms-length custodian ● Buy orders can go directly to user wallet ● Sell orders can be confirmed by exchange instantly ● Great for places that allow you to just “buy bitcoin” User-owned Wallet Linked With Exchange
  • 19. Exchange+User Joint Wallet ● User and exchange each own a private key ● Instant confirmation ● Withdrawals depend on ○ Webhook call to exchange to ensure user has sufficient margin
  • 20. Co-Signer Oracle Contracts ● HTTP callback enables external logic to be implemented Shared Multi-Sig Wallet UserA BTC Collateral (1BTC) UserB BTC Collateral (1BTC) Winner creates/signs tx for 2BTC out BitGo Co- signer Webhook oracle gets BTC price at contract date to determine winner cosign/transmit Bitcoin P2P Net
  • 21. Open Source SDK 1. Create a wallet 2. Get new addresses 3. Fund the wallet 4. Get transactions and balances 5. Send coins Implementing multi-sig in 5 minutes
  • 22. Exchange integration demo ● First open-source multi-sig bitcoin exchange ● Uses bitgod (bitcoind adapter for Bitgo)