Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... ·...

33
Introduction of the problem Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications Weidong Shi joint work with Lin Chen, Lei Xu, Nolan Shah, Zhimin Gao, and Yang Lu University of Houston 1st Workshop on Trusted Smart Contract Malta, April, 2017 Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 1/25

Transcript of Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... ·...

Page 1: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Decentralized Execution of Smart Contracts:Agent Model Perspective and Its Implications

Weidong Shi

joint work with Lin Chen, Lei Xu, Nolan Shah, Zhimin Gao, andYang Lu

University of Houston

1st Workshop on Trusted Smart ContractMalta, April, 2017

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 1/25

Page 2: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

What is a blockchain?Shared, replicated, ledger.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 2/25

Page 3: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

A chain of blocks of transactions - examples including:BitcoinNXTEthereum...

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 3/25

Page 4: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Crypto ledgers (e.g., Ethereum, Hyperledger) aim at supporting“smart contracts”.

DefinitionA smart contract is a set of promises, specified in a digital form,including protocols within which the parties perform on thesepromises.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 4/25

Page 5: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Another definition:

DefinitionA smart contract is an event driven program, with state, which runs ona replicated, shared ledger and which can take custody over assetson that ledger [Swanson2015].

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 5/25

Page 6: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Abstract smart contract model:Shared public ledgerReplicated states (smart contracts)Using crypto-currency rewarding contract executionContracts involving financial gains or lossesEvent drivenConsensus based (smart contract execution)Participants are not trustedInter-dependent contracts

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 6/25

Page 7: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

A simple example of a smart contract.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 7/25

Page 8: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

A simple example of a smart contract.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 8/25

Page 9: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Shared Ledger

Smart Contract

Value State

Smart Contract

Value State

Smart Contract

Value State

Events Trasactions Events Trasactions Events Trasactions

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 9/25

Page 10: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Execution of a smart contract can be tricky:The amount of crypto-currency involved in a contract may be manytimes and significantly higher than the cost of running the contractitself.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 10/25

Page 11: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Execution of a smart contract can be tricky:The amount of crypto-currency involved in a contract may be manytimes and significantly higher than the cost of running the contractitself.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 11/25

Page 12: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Execution of a smart contract can be tricky:The amount of crypto-currency involved in a contract may be manytimes and significantly higher than the cost of running the contractitself.

If the random dice returns 1, Alice has the incentive of lying.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 12/25

Page 13: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Background

Execution of a smart contract can be tricky:The amount of crypto-currency involved in a contract may be manytimes and significantly higher than the cost of running the contractitself.If a significant portion of users in system are directly or indirectlyinvolved in a smart contract, then this smart contract might not getexecuted correctly.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 13/25

Page 14: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)

Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct state

Byzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 15: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct state

Byzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 16: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct state

Byzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 17: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct state

Byzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 18: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct stateByzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 19: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

A game theoretical model (smart contract participants andexecution nodes are agents):

N players (users in the system)Weight wj for user j (indicating the potential of manipulating theresult)

The computation power in a proof-of-work systemThe number of stakes in a proof-of-stake system...

Possible states Si

If Si occurs, the payoff of user j is z ij

Users “vote” to reach a consensus on the correct stateByzantine: broadcast a certain stateLongest chain: adding blocks after a specific chain...

A state receiving αW votes in weight wins

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 14/25

Page 20: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

The problem

Q: Can we prevent users from lying when they vote?

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 15/25

Page 21: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

In general, lying can not be prevented.

LemmaVoting for the state that a user prefers the most is his/her dominantstrategy.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 16/25

Page 22: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

In general, lying can not be prevented.

LemmaVoting for the state that a user prefers the most is his/her dominantstrategy.

Can we discourage users from lying by adding punishment?

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 17/25

Page 23: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

The system can impose a penalty on a user if his/her vote isdifferent from the accepted state.

TheoremIn the agent model with penalty, if j is superrational and knows that∑

k∈U wk ≥ αW, then no matter how high the penalty is, j will alwayslie.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 18/25

Page 24: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

The classical game theory seems to lead us nowhere...

But rationality or superrationality is questionable.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 19/25

Page 25: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

The classical game theory seems to lead us nowhere...

But rationality or superrationality is questionable.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 19/25

Page 26: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Irrational behaviors

Centipede game:

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 20/25

Page 27: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Irrational behaviors

Centipede game:

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 21/25

Page 28: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Irrational behaviors

Centipede gameThe game lasts for a fixed number of rounds, which is known toboth players.A rational player chooses to take the larger pile and the game endsimmediately. Only 15% players choose to do so in experiments.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 22/25

Page 29: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

In our problem, the situation changes when irrationality is takeninto consideration.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 23/25

Page 30: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Our contribution

In our problem, the situation changes when irrationality is takeninto consideration.

TheoremIn the agent model with penalty, if users do not fully believe in therationality of others, then a mechanism with penalty can be designedsuch that users do not lie in voting.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 24/25

Page 31: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Conclusion

We consider smart contract execution in a blockchain basedsystem and propose an agent model.

Truthfulness of users can not be achieved if rationality orsuperrationality is assumed, even if penalty is introduced.

Truthfulness of users can be achieved with a carefully designedpenalty, if irrationality is assumed.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 25/25

Page 32: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Conclusion

We consider smart contract execution in a blockchain basedsystem and propose an agent model.

Truthfulness of users can not be achieved if rationality orsuperrationality is assumed, even if penalty is introduced.

Truthfulness of users can be achieved with a carefully designedpenalty, if irrationality is assumed.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 25/25

Page 33: Decentralized Execution of Smart Contracts: Agent Model Perspective … execution of... · 2017-04-15 · Introduction of the problem Decentralized Execution of Smart Contracts: Agent

Introduction of the problem

Conclusion

We consider smart contract execution in a blockchain basedsystem and propose an agent model.

Truthfulness of users can not be achieved if rationality orsuperrationality is assumed, even if penalty is introduced.

Truthfulness of users can be achieved with a carefully designedpenalty, if irrationality is assumed.

Weidong Shi Decentralized Execution of Smart Contracts: Agent Model Perspective and Its Implications 25/25