Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Blockchain Smart Contract
Best Practices
David Paluy
@dpaluy
September 2017
Prepare for Failure
Failure Preparation Checklist
Keep it Simple
Pausable Contract
Manage the amount limit
Define upgrade path
Stay up to date
Keep it Simple
Simple Logic
Clarity over Performance
Modularize code
Pausable Contract
Manage the Amount limit
Can I upgrade the Contract?
NO, but...
Upgrade path
1. Contract is eternal, unless destroyed
2. Make a workaround
Centralized?
DELEGATECALL
Read Solidity docs
a contract can dynamically load code from a different address at runtime...
Use latest stable libraries
Lock pragmas to specific compiler version
Explicitly mark visibility
References
Read the Manual
Solidity STD
Smart Contract Best Practices by ConsenSys
Safe and Secure Coding!
@dpaluy
Blockchain Smart Contract Best Practices
Upcoming SlideShare
Loading in …5
×

Blockchain Smart Contract Best Practices

739 views

Published on

Smart contract programming requires a different engineering mindset than you may be used to. The cost of failure can be high, and change can be difficult, making it in some ways more similar to hardware programming or financial services programming than web or mobile development. It is therefore not enough to defend against known vulnerabilities. Instead, you will need to learn a new philosophy of the development.

Published in: Engineering
  • Great presentation, only thing to change is slide 14. The best practice is actually the opposite. As explained here: https://solidity.readthedocs.io/en/develop/layout-of-source-files.html#version-pragma you should use ^ in order to prevent it from running on version including massive update (e.g. 0.4.0 to 0.5.0).
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Blockchain Smart Contract Best Practices

  1. 1. Blockchain Smart Contract Best Practices David Paluy @dpaluy September 2017
  2. 2. Prepare for Failure
  3. 3. Failure Preparation Checklist Keep it Simple Pausable Contract Manage the amount limit Define upgrade path Stay up to date
  4. 4. Keep it Simple Simple Logic Clarity over Performance Modularize code
  5. 5. Pausable Contract
  6. 6. Manage the Amount limit
  7. 7. Can I upgrade the Contract?
  8. 8. NO, but...
  9. 9. Upgrade path 1. Contract is eternal, unless destroyed 2. Make a workaround
  10. 10. Centralized?
  11. 11. DELEGATECALL Read Solidity docs a contract can dynamically load code from a different address at runtime...
  12. 12. Use latest stable libraries
  13. 13. Lock pragmas to specific compiler version
  14. 14. Explicitly mark visibility
  15. 15. References Read the Manual Solidity STD Smart Contract Best Practices by ConsenSys
  16. 16. Safe and Secure Coding! @dpaluy

×