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

Ethereum for Ruby

Yuta Kurotaki
September 10, 2022

Ethereum for Ruby

RubyKaigi 2022
Mie Center for the Arts, Mie, Japan

Ethereum for Ruby
https://rubykaigi.org/2022/presentations/kurotaky.html#day3

Yuta Kurotaki

September 10, 2022
Tweet

More Decks by Yuta Kurotaki

Other Decks in Technology

Transcript

  1. Yuta Kurotaki @kurotaky RubyKaigi Speaker 2018 RailsGirls Coach 4,7~10,12,13th Yokohama.rb,

    K-Ruby Kagoshima RubyKaigi 01 Organizer Goods Sponsor (SUZURI, GMO Pepabo, Inc.) eth.rb Maintainer
  2. Contents • What is Ethereum? • Ethereum Keys and Addresses

    • Ethereum Signatures • Ethereum Transaction • Interact with Smart Contract
  3. Ethereum Blockchain • It is the Ethereum Blockchain invented by

    Vitalik in 2013 • Trustless on the blockchain • It's called a world computer
  4. eth.rb • Let's take a look into the world of

    blockchain with eth.rb! • https://github.com/q9f/eth.rb
  5. Blockchain Wallet • When users create a wallet such as

    MetaMask, an address of 0xabc.... is created. • This address is required on Ethereum https://metamask.io/
  6. Eth::Key • The library can create private/public key pairs •

    This can also show the required address on ethereum
  7. Address • Calculate hash value of public key with Keccak256

    • Public key = K, last 20bytes of Keccak256(K) • Returns with 0x; 42 characters (40 without 0x)
  8. EIP-55 • If the checksum is 8 or higher, the

    corresponding address letter is uppercase to prevent input errors. • EIP(Ethereum Improvement Proposals)
  9. EIP-55 • Addresses are not case sensitive • Can be

    veri fi ed if the checksum is used
  10. Ethereum Signatures • ECDSA (Eliptic Curve Digital Signature Algorithm) •

    This is used for three purposes 1. proof of authorization to make ETH payments or execute smart contracts 2. proof that the signature is non-repudiation 3. proof that no one has modi fi ed the transaction data since it was signed https://ethereum.org/en/developers/docs/transactions/
  11. Go Ethereum(geth) • Of fi cial Go implementation of the

    Ethereum protocol • geth --dev --http --ipcpath /tmp/geth.ipc https://geth.ethereum.org/
  12. Use Cases • DeFi (Decentralized Finance) • Identity (sign in

    with an ethereum account) • Cryptoeconomics • Stickers/badges • etc.
  13. Solidity Compiler dummy.sol Solidity Compiler (solc) byte code 6080604052..... EVM

    (Ethereum Virtual Machine) ABI (Application Binary Interface) EVM opcode PUSH1 0x80 PUSH1 0x40 MSTORE
  14. Let's try it! • This is a Rails application for

    creating Non Fungible Tokens • Please try it out !
  15. Conclusion • Ethereum Blockchain Overview • How Ethereum Addresses Work

    and EIP • Overview of ethereum signatures • About executing smart contracts using eth.rb
  16. Future of eth.rb • Language diversity is important so that

    Ruby can also connect with the Ethereum world! • More examples of creating DApps with Ruby and Rails • Make it easy to connect to existing Rails applications
  17. Acknowledgements • @ethmarek • He brought me into the world

    of Ethereum.rb • @q9f • He promotes and maintains the eth.rb project with us • GMO Pepabo Web3 Development Team • RubyKaigi staff, organizers, committers and attendees