blockchain smart contract best practices

17
Blockchain Smart Contract Best Practices David Paluy @dpaluy September 2017

Upload: david-paluy

Post on 22-Jan-2018

352 views

Category:

Engineering


5 download

TRANSCRIPT

Page 1: Blockchain Smart Contract Best Practices

Blockchain Smart Contract Best PracticesDavid Paluy@dpaluy

September 2017

Page 2: Blockchain Smart Contract Best Practices

Prepare for Failure

Page 3: Blockchain Smart Contract Best Practices

Failure Preparation Checklist

Keep it Simple

Pausable Contract

Manage the amount limit

Define upgrade path

Stay up to date

Page 4: Blockchain Smart Contract Best Practices

Keep it Simple

Simple Logic

Clarity over Performance

Modularize code

Page 5: Blockchain Smart Contract Best Practices

Pausable Contract

Page 6: Blockchain Smart Contract Best Practices

Manage the Amount limit

Page 7: Blockchain Smart Contract Best Practices

Can I upgrade the Contract?

Page 8: Blockchain Smart Contract Best Practices

NO, but...

Page 9: Blockchain Smart Contract Best Practices

Upgrade path

1. Contract is eternal, unless destroyed2. Make a workaround

Page 10: Blockchain Smart Contract Best Practices

Centralized?

Page 11: Blockchain Smart Contract Best Practices

DELEGATECALL

Read Solidity docs

a contract can dynamically load code from a different address at runtime...

Page 12: Blockchain Smart Contract Best Practices
Page 13: Blockchain Smart Contract Best Practices

Use latest stable libraries

Page 14: Blockchain Smart Contract Best Practices

Lock pragmas to specific compiler version

Page 15: Blockchain Smart Contract Best Practices

Explicitly mark visibility

Page 17: Blockchain Smart Contract Best Practices

Safe and Secure Coding!@dpaluy