An Analysis of Atomic Swaps on and between Ethereum Blockchains - - PowerPoint PPT Presentation

an analysis of atomic swaps on and between ethereum
SMART_READER_LITE
LIVE PREVIEW

An Analysis of Atomic Swaps on and between Ethereum Blockchains - - PowerPoint PPT Presentation

An Analysis of Atomic Swaps on and between Ethereum Blockchains Research Project I Master of System and Network Engineering Informatics Institute, University of Amsterdam Peter Bennink Lennart van Gijtenbeek Supervisors: Oskar van Deventer


slide-1
SLIDE 1

An Analysis of Atomic Swaps

  • n and between Ethereum Blockchains

Research Project I

Master of System and Network Engineering Informatics Institute, University of Amsterdam Peter Bennink Lennart van Gijtenbeek Supervisors: Oskar van Deventer Maarten Everts February 5, 2018

slide-2
SLIDE 2

Centralized cryptocurrency exchanges

  • Transactions via the exchange
  • Exchanges hold funds
  • SPOF (wallet database)
  • Hacks and disappearances
  • Untrustworthy trusted third party

2

slide-3
SLIDE 3

Atomic swaps

  • More decentralized process
  • Less dependence on

(centralized) third parties

  • Less chance of loss of funds

“A transaction between two parties that does not depend on a third party, for instance a centralized exchange, and either happens in full, or not at all.”

3

slide-4
SLIDE 4

Are there reliable methods for making atomic swaps on and between blockchains?

4

slide-5
SLIDE 5

Ethereum

  • TNO Techruption blockchain
  • Ethereum Classic (ETC) & Quorum
  • Mining process similar to Bitcoin (PoW)
  • Smart contracts

5

slide-6
SLIDE 6

Smart contracts

  • Programs stored on the blockchain
  • Solidity
  • Static and open-source code
  • Gas costs
  • Executed by miners to verify
  • Tokens are implemented using smart contracts

6

slide-7
SLIDE 7

ERC-20 Token Standard

  • Homogeneity
  • Smoother integration with crypto software.
  • Requires the implementation of the ERC-20 interface
  • Return total supply
  • Keep track of wallet balances
  • Transfer tokens
  • Allowances

7

slide-8
SLIDE 8

Types of atomic swaps

1. Single-chain token swaps 2. Single-chain coin/token swaps 3. Cross-chain coin swaps 4. Cross-chain token swaps 5. Cross-chain coin/token swaps

8

slide-9
SLIDE 9

1.5 EOS 1 OMG

  • 1. Single-chain token swap

Wallet

A

Wallet

B

Client Client

9

slide-10
SLIDE 10

100 EOS 1 ETH

  • 2. Single-chain token/coin swap

Wallet

A

Wallet

B

Client Client

10

slide-11
SLIDE 11
  • 3. Cross-chain coin swap

1 ETH

Wallet

A

Wallet

B

40 ETC

Wallet

A

Wallet

B

Client Client

11

slide-12
SLIDE 12
  • 4. Cross-chain token swap

1 VeChain

Wallet

A

Wallet

B

30 InPay

Wallet

A

Wallet

B

Client Client

12

slide-13
SLIDE 13
  • 5. Cross-chain token/coin swap

2.5 EOS

Wallet

A

Wallet

B

1 ETC

Wallet

A

Wallet

B

Client Client

13

slide-14
SLIDE 14

Types of atomic swaps

1. Single-chain token swaps 2. Single-chain coin/token swaps 3. Cross-chain coin swaps 4. Cross-chain token swaps 5. Cross-chain coin/token swaps 6. Single-chain coin swaps

14

slide-15
SLIDE 15

Design & implementation

  • Single usage swap contracts
  • Transaction via the contract
  • Rinkeby & Ropsten test networks
  • Hashed TimeLocked Contract (HTLC)
  • Compatible with all ERC-20 tokens

15

slide-16
SLIDE 16

Cross-chain coin swap

16

slide-17
SLIDE 17

Why is this atomic?

  • If client A does not claim their

funds, client B cannot either

  • If client A claims, they reveal the

secret to client B, who can then can also claim their funds

function claim(string _secret) public returns (bool) { if (hashed_secret == sha256(_secret) && now < timeOut){ selfdestruct(clientB); } else { return false; } }

17

slide-18
SLIDE 18

Single-chain token swap

18

slide-19
SLIDE 19

Why is this atomic?

  • When claim() is called the contract

is in full control of the funds

function claim() onlyParticipant public returns (bool) { uint token1_balance = token1_instance.balanceOf(this); uint token2_balance = token2_instance.balanceOf(this); if (token2_balance >= amountOf_token2 && token1_balance >= amountOf_token1 && now < timeOut) { token1_instance.transfer(clientB, token1_balance); token2_instance.transfer(clientA, token2_balance); selfdestruct(clientA); } else { return false; } }

19

slide-20
SLIDE 20

Reusable contracts

  • Indefinitely and concurrently
  • Scales better
  • No deployment costs

20

slide-21
SLIDE 21

Reusable single-chain token swap

21

slide-22
SLIDE 22

Future research

  • Reusability
  • Other blockchains
  • Off-chain
  • Decentralized exchanges (use

cases)

  • Investigate attack vectors

Conclusion

  • Reliable swaps are possible

Project git repository: github.com/clvang000/SNE_TNO_RP1

22

slide-23
SLIDE 23

Questions . . .

Project git repository: github.com/clvang000/SNE_TNO_RP1

23