Smart Contracts 101

Smart Contracts 101

12fad6dce4099a21ed70cf4409fe2271?s=128

Alexandre Balmes

June 12, 2018
Tweet

Transcript

  1. SMART CONTRACTS
 101

  2. A SET OF PROMISES, SPECIFIED IN DIGITAL FORM, INCLUDING PROTOCOLS

    WITHIN WHICH THE PARTIES PERFORM ON THE OTHER PROMISES.
  3. MERCI

  4. LE PETIT BLOC BUILD A DECENTRALISED, TRUSTABLE AND RELIABLE WORLD

    ! SCIC PROJECT - HTTPS://LEPETITBLOC.NET!
  5. FACTS

  6. NICK SZABO 1993 - BITGOLD

  7. MISE EN OEUVRE 2002 - ASKEMOS - SCHEME

  8. ETHEREUM 2015 - VITALIK BUTERIN

  9. SC !== ACCORD CONTRACTUEL

  10. SC !== CONTRAT RICARDIENS

  11. SC !== ETHEREUM RSK, BIP65 MULTISIG, NEO, STRATIS, LSK, ARK,

    EOS, WAVES, CHAINLINK…
  12. UN SC C’EST BÊTE.
 ET MÉCHANT

  13. ORACLE

  14. UN SC A UN COUT EXEMPLE : LE GAS ETHEREUM

  15. COMMENT ÇA MARCHE ? C’EST PAS SORCIER

  16. 1- HIGH LEVEL LANGUAGES

  17. 2- LOW-LEVEL BYTECODE ETHEREUM VIRTUAL MACHINE

  18. COMMON STACK OPERATIONS POP //Pop item off the stack PUSH

    //Push item on the stack MLOAD //Load item into memory MSTORE //Store item in memory JUMP //Alter the location of program counter (PC) PC //Program counter MSIZE //Active memory size GAS //Amount of available gas for transaction DUP //Stack item duplication SWAP //Stack item exchange operation COMMON SYSTEM OPERATIONS CREATE //Create a new account CALL //Instruction for message passing between accounts RETURN //Execution halt REVERT //Execution halt, reverting state changes SELFDESTRUCT //Execution halt, and flag account for deletion ARITHMETIC OPERATIONS ADD //Add MUL //Multiplication SUB //Subtraction DIV //Integer division SDIV //Signed integer division MOD //Modulo (Remainder) operation SMOD //Signed modulo operation ADDMOD //Modulo addition MULMOD //Modulo multiplication EXP //Exponent operation STOP //Halt operation ENVIRONMENTAL OPCODES ADDRESS //Address of current execution account BALANCE //Account balance CALLVALUE //Transaction value for execution environment ORIGIN //Origin address of execution environment CALLER //Address of execution caller CODESIZE //Execution environment code size GASPRICE //Gas price state EXTCODESIZE //An account's code size RETURNDATACOPY //Copy of data output from previous memory call https://github.com/djrtwo/evm-opcode-gas-costs/blob/master/opcode-gas- costs_EIP-150_revision-1e18248_2017-04-12.csv
  19. 3- DEPLOY AND CRY.

  20. 4- SELFDESTRUCT INSERT A COIN.

  21. CODE

  22. COMPILER DIRECTIVE

  23. DATA TYPES BOOL, INT, UINT, FIXED, UFIXED, ADDRESS, DYNAMIC, ENUM,

    STRUCT, MAPPING
  24. MSG .SENDER, .VALUE, .GAS, .DATA, .SIG

  25. TX .GASPRICE, .ORIGIN

  26. BLOCK .BLOCKHASH, .COINBASE, .DIFFICULTY, .GASLIMIT, 
 .NUMBER, .TIMESTAMP

  27. ADDRESS .BALANCE, .TRANSFER, .SEND, .CALL, .DELEGATECALL

  28. BUILT-IN ADDMOD, MULMOD, KECCAK256, SHA256, SHA3, RIPEMD160

  29. DEFINITION INTERFACE, LIBRARY

  30. FUNCTIONS FUNCTION FUNCTIONNAME([PARAMETERS]) {PUBLIC| PRIVATE|INTERNAL|EXTERNAL} [PURE|CONSTANT|VIEW| PAYABLE] [MODIFIERS] [RETURNS (<RETURN

    TYPES>)]
  31. CONSTRUCTOR CONSTRUCTOR, SELFDESTRUCT

  32. MODIFIERS EXEMPLE : ONLYOWNER

  33. INHERITANCE CONTRACT CHILD IS PARENT1, PARENT2 {}

  34. ERROR HANDLING ASSERT, REQUIRE, REVERT

  35. EVENTS LOG ENTRIES

  36. BOITE A OUTILS (LA MIENNE)

  37. None
  38. None
  39. LIVE

  40. MERCI WE ❤ YOU