SlideShare una empresa de Scribd logo
1 de 55
Descargar para leer sin conexión
Smart contracts:
Approach with caution
Jake Craige
Crypto Payments Engineering
Ethereum Devcon4, 2018
Who should care?
Who should care?
! Exchanges
! Wallets
! Explorers
Who should care?
! Exchanges
! Wallets
! Explorers
! Anyone building on Ethereum
Why?
Transaction
Why?
Transaction Credit Alice 1 ETH
Why?
Transaction Credit Alice 1 ETH
Why?
Invalid Data
Why?
Invalid Data
Lost Funds
Why?
Why?
Ethereum account balance manipulation
ETH contract handling errors
So, what can go wrong?
How does ether move?
How does ether move?
! Account Transfers
How does ether move?
! Account Transfers
! Contract Transfers
Transfer Types
Account Transfer
Transfer Types
Contract Transfer
Contract Transfer
Transaction Trace
[
{
"action": {
"callType": "call",
"from": "0x2dc772d3d7ae59f80e6bf1f69234cdc477cd2517",
"gas": "0x2b39",
"input": "0xd018db3e00000000000000000000000028eefc16be1156146d0c4d15f890faa01306af49",
"to": "0xf171d6dee1176af9ff3358cebc55b0b1a9ad1de1",
"value": "0x38d7ea4c68000"
},
"blockHash": "0x03a812fd4867abf603d91594e0cb4a17b60b190793376555c19b01a0ae6136d9",
"blockNumber": 3034561,
"result": {
"gasUsed": "0x22b5",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 2,
"traceAddress": [],
"transactionHash": "0xd5bd8fd17998c2393ab565e58f4afdf7696d82e9c85b377cce73de2d435ddd14",
"transactionPosition": 28,
"type": "call"
},
{
"action": {
"callType": "delegatecall",
"from": "0xf171d6dee1176af9ff3358cebc55b0b1a9ad1de1",
"gas": "0x2726",
"input": "0x",
"to": "0x28eefc16be1156146d0c4d15f890faa01306af49",
"value": "0x38d7ea4c68000"
},
"blockHash": "0x03a812fd4867abf603d91594e0cb4a17b60b190793376555c19b01a0ae6136d9",
"blockNumber": 3034561,
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [
0
],
"transactionHash": "0xd5bd8fd17998c2393ab565e58f4afdf7696d82e9c85b377cce73de2d435ddd14",
"transactionPosition": 28,
"type": "call"
},
{
"action": {
"callType": "call",
"from": "0xf171d6dee1176af9ff3358cebc55b0b1a9ad1de1",
"gas": "0x8fc",
"input": "0x",
"to": "0x2dc772d3d7ae59f80e6bf1f69234cdc477cd2517",
"value": "0x38d7ea4c68000"
},
"blockHash": "0x03a812fd4867abf603d91594e0cb4a17b60b190793376555c19b01a0ae6136d9",
"blockNumber": 3034561,
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [
1
],
"transactionHash": "0xd5bd8fd17998c2393ab565e58f4afdf7696d82e9c85b377cce73de2d435ddd14",
"transactionPosition": 28,
"type": "call"
}
]
Contract Transfer
Transaction Trace
"action": {
"callType": "call",
"from": "0x2dc772d3d7ae59f80e6bf1f69234cdc477cd2517",
"gas": "0x2b39",
"input": “0xd018db3e00000000000000000…”,
"to": "0xf171d6dee1176af9ff3358cebc55b0b1a9ad1de1",
"value": "0x38d7ea4c68000"
},
"blockHash": “0x03a812fd4867abf603d91594e0cb4…”,
"blockNumber": 3034561,
"result": {
"gasUsed": "0x22b5",
"output": “0x00000000000000000000000000000000000…”
},
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Example #1
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Example #1
Credit Alice 1 ETH
Credit Bob 1 ETH
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Example #1
Credit Alice 1 ETH
Credit Bob 1 ETH
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Example #1
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Transaction status: Failure
Example #1
Send Bob 1 ETH
Call
Call
Send Alice 1 ETH
Call
Transaction status: Failure
Example #1
Send Bob 1 ETH
Call
Send Alice 1 ETH
Call
Example #2
Call (Fail)
Send Bob 1 ETH
Call
Send Alice 1 ETH
Call
Transaction status: Success
Example #2
Call (Fail)
Send Bob 1 ETH
Call
Send Alice 1 ETH
Call
Transaction status: Success
Credit Alice 1 ETH
Credit Bob 1 ETH
Example #2
Call (Fail)
Send Bob 1 ETH
Call
Send Alice 1 ETH
Call
Transaction status: Success
Credit Alice 1 ETH
Credit Bob 1 ETH
Example #2
Call (Fail)
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Example #2
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Example #2
Credit Alice 1 ETH
Transaction status: Success
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Credit Alice 1 ETH
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Credit Alice 1 ETH
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call
Transaction status: Success
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call DELEGATE CALL
Transaction status: Success
Example #3
Send Bob 1 ETH
Call (Fail)
Call
Send Alice 1 ETH
Call DELEGATE CALL
Minimizing Risk
Detection & Response
Detection & Response
! Don’t assume you know everything
Detection & Response
! Don’t assume you know everything
! Cross-check your data with other sources
Detection & Response
! Don’t assume you know everything
! Cross-check your data with other sources
! If something is off, fail securely
Four Takeaways
Takeaway #1
Always check the transaction
receipt status
Takeaway #2
Takeaway #2
Parse the trace as a tree
Takeaway #2
Parse the trace as a tree
Takeaway #2
Parse the trace as a tree
Fail errored subtrees
Takeaway #3
Takeaway #3
Reject delegate and callcode calls
Takeaway #3
Reject delegate and callcode calls
Select call, create, selfdestruct
and rewards calls
Takeaway #4
Takeaway #4
Don’t trust, until verified
Takeaway #4
Don’t trust, until verified
Stay safe out there.
Jake Craige // @jakecraige
We’re hiring! coinbase.com/careers

Más contenido relacionado

Similar a Devcon4 - Smart Contracts Approach with Caution by Jake Craige

Build your own block chain
Build your own block chainBuild your own block chain
Build your own block chainBohdan Szymanik
 
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contracts
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contractsITCamp 2018 - David Wong - A deal with the devil: breaking smart contracts
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contractsITCamp
 
Bitcoin & blockchain for ordinary people
Bitcoin & blockchain for ordinary peopleBitcoin & blockchain for ordinary people
Bitcoin & blockchain for ordinary peopleKent Tong
 
Ethereum: From there to here, and ownards yonder
Ethereum: From there to here, and ownards yonderEthereum: From there to here, and ownards yonder
Ethereum: From there to here, and ownards yondergavofyork
 
Price and ethereum
Price and ethereumPrice and ethereum
Price and ethereumDan Antonov
 
Vreath meetup in January, 2019
Vreath meetup in January, 2019Vreath meetup in January, 2019
Vreath meetup in January, 2019SoraSuegami
 
Digital Token Liquidity Issues
Digital Token Liquidity IssuesDigital Token Liquidity Issues
Digital Token Liquidity IssuesInvestingTips
 
Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Jun Furuse
 
8 June 2017 - interledger at tu delft
8 June 2017 - interledger at tu delft8 June 2017 - interledger at tu delft
8 June 2017 - interledger at tu delftMichiel de Jong
 

Similar a Devcon4 - Smart Contracts Approach with Caution by Jake Craige (10)

Build your own block chain
Build your own block chainBuild your own block chain
Build your own block chain
 
Bitcoin
Bitcoin Bitcoin
Bitcoin
 
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contracts
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contractsITCamp 2018 - David Wong - A deal with the devil: breaking smart contracts
ITCamp 2018 - David Wong - A deal with the devil: breaking smart contracts
 
Bitcoin & blockchain for ordinary people
Bitcoin & blockchain for ordinary peopleBitcoin & blockchain for ordinary people
Bitcoin & blockchain for ordinary people
 
Ethereum: From there to here, and ownards yonder
Ethereum: From there to here, and ownards yonderEthereum: From there to here, and ownards yonder
Ethereum: From there to here, and ownards yonder
 
Price and ethereum
Price and ethereumPrice and ethereum
Price and ethereum
 
Vreath meetup in January, 2019
Vreath meetup in January, 2019Vreath meetup in January, 2019
Vreath meetup in January, 2019
 
Digital Token Liquidity Issues
Digital Token Liquidity IssuesDigital Token Liquidity Issues
Digital Token Liquidity Issues
 
Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Blockchain and Formal verification (English)
Blockchain and Formal verification (English)
 
8 June 2017 - interledger at tu delft
8 June 2017 - interledger at tu delft8 June 2017 - interledger at tu delft
8 June 2017 - interledger at tu delft
 

Último

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 

Último (20)

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 

Devcon4 - Smart Contracts Approach with Caution by Jake Craige