Overview for developing your first TokenScript

Code-together part 1: Setup

AlphaWallet Setup (for development)

  • Install AlphaWallet on mobile
  • Enable Ropsten network
    • [Settings] -> Enabled Networks -> Ropsten (Test) -> Confirm
  • Android: Enable XML overrides
    • [Settings] -> ... (once done, option disappears)

Required tools

"Receive" Ropsten ETH and Ropsten WETH

  • Have wallet address ready (James will send during workshop)
  • Wait for confirmations, then WETH balance will appear
    • Optionally add manually: [Wallet] -> “+” -> scan from qr code (eg using etherscan)
  • Can click on token and view default ERC20 actions (Send/Receive)

Code-together part 2: Workshop

Building WETH tokenscript

  • Checkout TokenScript repository
  • Modify WETH.xml to include Ropsten contract address in “ts:contract”
    • <ts:address network="3">0x0a180A76e4466bF68A7F86fB029BEd3cCcFaAac5</ts:address>
  • Canonicalise xml: eg for examples/erc20/WETH/WETH.xml
    • “make WETH.canonicalized.xml”
  • Copy canonicalized xml file to device
    • iOS - AirDrop, then open with AlphaWallet
    • Android
      • copy via cable (or shared app eg Telegram, or FEEM)
      • move to: /Internal storage/AlphaWallet
      • re-open AlphaWallet
  • Check for additional buttons in token (Wrap/UnWrap)
    • due to WETH xml now including ropsten address

Make a change

  • Rename action button(s)
  • Perform same steps above
  • Check action buttons renamed

Learning

  • Explain how to use attribute-types - Quick demo with WETH.xml
  • See specific examples
    • ERC20 - read allowance, approve functionality
    • Nft (EntryToken) - languages, off-chain functionality (challenge)
  • Images
    • Base64 in shtml (React)
  • Signing with Shong Wang keystore.p12
  • Discuss example/future applications:
    • ERC20 approve functionality
    • ERC20 token with tokenscript to communicate donation intent
    • ERC20 token donate to Author
    • NFT metadata comparison (already showing FIFA XML)
      • JB - crypto-kitties breeding example (future release)
3 Likes