GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage...

17
GasToken: A Journey Through Blockchain Resource Arbitrage MIT Bitcoin Expo 18 March 2018 Florian Tramèr Stanford University

Transcript of GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage...

Page 1: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

GasToken: A Journey Through Blockchain Resource Arbitrage

MIT Bitcoin Expo

18 March 2018

Florian Tramèr Stanford University

Page 2: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Imagine if…

18March2018 MITBitcoinExpo 2

Monday: It’s $4 for the cappuccino… and the transaction fee is $0.10.

Friday: It’s $4 for the cappuccino… and the transaction fee is $6.25.

Page 3: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Transaction fees / Ethereum gas prices are super volatile

18March2018 MITBitcoinExpo 3

Page 4: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Same in Bitcoin…

18March2018 MITBitcoinExpo 4

source: bitinfocharts.com

Page 5: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

How do ordinary businesses handle volatility?

18March2018 MITBitcoinExpo 5

•  Stock up when prices are low! – Or buy financial

instruments…

•  How do you “speculate on” or stockpile transaction fees?

Page 6: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

GasToken: Stockpiling and trading Ethereum gas

Phil Daian, Lorenz Breidenbach, FT + Ari Juels

18March2018 MITBitcoinExpo 6

https://gastoken.io

Page 7: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

GasToken in a nutshell

•  To encourage state cleanup, Ethereum offers a gas refund for: –  Released contract storage – Destroyed contracts

•  Write to state when gas price is low – Trade state slots as an ERC20 token

•  Release state when gas price is high – Refund pays up to half of transaction fee

18March2018 MITBitcoinExpo 7

Page 8: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

An example

18March2018 MITBitcoinExpo 8

Regular 0 0 1 GWei

Regular 0 4 0 GWei

Total Gas: 250,000 Price: $9

Free 10 words & Breed kitties

Store 10 words

Total Gas: 200,000 Price: $0.20

Page 9: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

An example

18March2018 MITBitcoinExpo 9

Regular 0 0 1 GWei

Regular 0 4 0 GWei

Total Gas: 250,000 – 100,000

Free 10 words & breed kitties

Store 10 words

Total Gas: 200,000 Price: $0.20

refund

Price: $9 $5

Page 10: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Nifty details

•  Two variants of GasToken: – GST1: uses storage, SSTORE(1), SSTORE(0) – GST2: uses contracts, CREATE, SELFDESTRUCT

•  GST2 more complex but also more efficient – SSTORE: 20,000 to stock, for 10,000 refund – CREATE: 32,000 to stock, for ~17,000 refund

•  Refund is interesting when gas volatility is >2x

18March2018 MITBitcoinExpo 10

Page 11: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Nifty details

•  Two variants of GasToken: – GST1: uses storage, SSTORE(1), SSTORE(0) – GST2: uses contracts, CREATE, SELFDESTRUCT

•  Refund is interesting when gas volatility is >2x

•  GST2 more complex but also more efficient – SSTORE: 20,000 to stock, for 10,000 refund – CREATE: 32,000 to stock, for ~17,000 refund

18March2018 MITBitcoinExpo 11

Page 12: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

FAQ

•  Who “pays” for the refund? –  Technically, the miner by only being paid for half the transaction cost

•  Why wouldn’t miners blacklist GasToken then? –  Ethereum is naturally “censorship resistant” –  GasToken can increase transaction demand when gas prices are low

•  Is GST1/2 an investment vehicle / security / financial product? –  No! We make absolutely no promises of any returns, profit…

GasToken is not based on any currency, asset, or other financial product… We encourage users to expect zero further effort from its developers… it is likely that the developers of GasToken will advocate for changes to the network that render GasToken unusable. 

18March2018 MITBitcoinExpo 12

Page 13: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

The issue with storage pricing

•  Blockchain state is (a priori) permanent –  Smart contract storage, UTXO set, etc.

•  One time transaction fee ⇒ recurring & indefinite costs to network

•  Writing to state must be expensive to deter DOS attacks

•  Yet incentivize users to clean up… –  E.g., many transactions in Bitcoin’s UTXO

have no positive incentive to be spent

18March2018 MITBitcoinExpo 13

Why 20,000 gas for

SSTORE?

Page 14: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Storage Rent

•  EIP 35/87: Charge “rent” for contract storage –  If rent unpaid, storage is removed from chain – Refund scheme could be removed entirely

•  Great idea but tricky execution – Developers must guard against storage loss – Entire contracts could disappear if unpaid

•  Doesn’t work for UTXO set…

18March2018 MITBitcoinExpo 14

Page 15: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

The big picture: Cryptocommodities

•  Blockchain transactions require a number of “raw” resources or commodities – Memory: block space, UTXO set, etc. – Computation: e.g., gas in Ethereum

•  How do we accurately price and freely trade these commodities (and their derivatives)?

18March2018 MITBitcoinExpo 15

Page 16: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

Project Chicago: beyond GasToken

•  More efficient transaction-fee derivatives

18March2018 MITBitcoinExpo 16

Bob will pay Alice’s transaction on April 1st

Alice: Run this 1,000,000 gas transaction Avg. gas price is 5 gWei

Transfer funds from Bob to Alice

•  Other cryptocommodities?

•  In-protocol futures – Could stable & efficient cryptocommodity markets

be supported at the consensus level?

Page 17: GasToken: A Journey Through Blockchain Resource ArbitrageGasToken in a nutshell • To encourage state cleanup, Ethereum offers a gas refund for: – Released contract storage –

18March2018 MITBitcoinExpo 17

Learn More https://projectchicago.io https://gastoken.io