Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Crypto Lesson

Crypto Lesson

Aletheia

April 12, 2022
Tweet

More Decks by Aletheia

Other Decks in Programming

Transcript

  1. Who am I? Luca Bianchi, PhD CTO @ Neosperience CTO

    @ WizKey AWS Hero, passionate about serverless and machine learning github.com/aletheia https://it.linkedin.com/in/lucabianchipavia https://speakerdeck.com/aletheia www.ai4devs.io @bianchiluca
  2. What is an ERC-20 It’s a standard version of a

    smart contract • An ERC-20 token is a smart contract that has an established data structure. • ERC20 de f ines balanceOf , totalSupply , transfer , transferFrom , approve , and allowance and also name, symbol, and the number of decimals. • Any one token is exactly equal to any other token; no tokens have special rights or behavior associated with them. • ERC20 tokens are useful for things like a medium of exchange currency, voting rights, staking,
  3. What is an ERC-20 It’s a standard version of a

    smart contract • An ERC-20 token is a smart contract that has an established data structure. • ERC20 de f ines balanceOf , totalSupply , transfer , transferFrom , approve , and allowance and also name, symbol, and the number of decimals.
  4. What is an ERC-721 A standard interface for non-fungible tokens,

    also known as deeds. • Used in situations like real estate, voting rights, or collectibles, where some items are valued more than others, due to their usefulness, rarity, etc. • ERC721 is a standard for representing ownership of non-fungible tokens, that is, where each token is unique. • ERC721 is a more complex standard than ERC20, with multiple optional extensions, and is split across a number of contracts. • https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
  5. What is an ERC-721 A standard interface for non-fungible tokens,

    also known as deeds. • An ERC-721 provides basic functionality to track and transfer NFTs. • NFTs can represent ownership over digital or physical assets
  6. How to create an ERC-20 Using Solidity language, a smart

    contract can be created (and deployed) in many ways https://tru ff lesuite.com/ https://remix.ethereum.org/
  7. What do we need to develop Smart Contracts? Aiming to

    write Smart Contracts for production use cases, we need more tools • Use your own IDE • Linting • Programmable deployment toolchain • Local blockchain for inspection • Testing support
  8. Introducting Hardhat Using Solidity language, a smart contract can be

    created (and deployed) in many ways https://hardhat.org/
  9. How to deploy our smart contract npx hardhat init npx

    hardhat node npx hardhat run —network localhost scripts/sample-script.js npx hardhat run —network rinkeby scripts/sample-script.js # NOT CONFIGURED!!
  10. Application Binary Interface A middle man to communicate with your

    contract • The Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this speci f ication. • EVM (Ethereum Virtual Machine) is the core component of the Ethereum network, and smart contract is pieces of code stored on the Ethereum blockchain which are executed on EVM. Smart contracts written in high-level languages like Solidity or Vyper need to be compiled in EVM executable bytecode. • Languages that compile for the EVM maintain strict conventions about these conversions, but in order to perform them, one must know the precise names and types associated with the operations. • The ABI documents these names and types precisely, easily parseable format, doing translations between human-intended method calls and smart-contract operations discoverable and reliable. • ABI de f ines the methods and structures used to interact with the binary contract, just like API does but on a lower-level.
  11. Work f low Metamask APIs • Metamask o ff ers

    standard layer of APIs to connect to a wallet • private keys are never shared, but transactions are routed through the wallet • metamask injects a window.ethereum variable • we need a frontend library to handle Metamask and Smart Contract APIs
  12. ether.js Work f low • ethers returns a provider •

    can use speci f ic providers (i.e. Alchemy or a standard Web3 provider) • returns a signer to sign transactions • returns a contract interface to call contract functions
  13. WizKey DeFiNe A NFT platform to handle receivables on the

    blockchain • Upload the documentation, 
 De f ine your portfolio and sell it in a global market. • Improved portfolio management • Improved negotiation and transfer of credits • Access to a global market • Guaranteed security on transactions • High level of con f identiality www.wizkey.io/en
  14. Foundry A blazing fast, portable and modular toolkit for Ethereum

    application development • it is not developer friendly, but powerful • Forge: Ethereum testing framework (like Tru ff le, Hardhat and Dapptools). • Blockchain Forking • Write Tests in Solidity • Support for Fuzz testing • Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. https://github.com/gakonst/foundry https://book.getfoundry.sh/
  15. DappTools A suite of Ethereum focused CLI tools following the

    Unix design philosophy • it is not developer friendly, but powerful • dapp - All you need Ethereum development tool. Build, test, fuzz, formally verify, debug & deploy solidity contracts. • seth - Ethereum CLI. Query contracts, send transactions, follow logs, slice & dice data. • hevm - Testing oriented EVM implementation. Debug, fuzz, or symbolically execute code against local or mainnet state. • ethsign - Sign Ethereum transactions from a local keystore or hardware wallet. https://github.com/dapphub/dapptools http://dapp.tools