Try   HackMD

#Session 2 如何使用 web3.js 跟區塊鏈智能合約互動與進行資安審計

歡迎來到 JSDC 2021 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

共筆入口:https://hackmd.io/@JSDC-tw/2021conference
手機版請點選上方 按鈕展開議程列表。

共筆協作,共享知識,打造開放社群。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Welcome to JSDC 2021 Collaborative Writing

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Collaborative Writing Workplace:https://hackmd.io/@JSDC-tw/2021conference
Using mobile please tap to unfold the agenda.

Build a community with open collaboration.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

從這開始
可以直接打字做共筆囉

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

李婷婷!
2017 加入區塊鏈,因為學校專題,名字有趣

Web3.js

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

成立公司 Z Institute

Eth + EOS 寫過智能合約

Solana (in Rust)
Evernew Capital

Interact with Smart Contract

2017 始接案開發,前後端不知道怎麼用 JS 開發

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

https://web3js.readthedocs.io/en/v1.5.2/

  • 帶 Live Demo
  • 改動資料要花錢!
  • 看交易,進行交易,收明細

Live Demo

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

index.js

  1. Kovan 測試網,進行交易測試
  2. 使用 web3 進行互動
  3. Infura -> Free to interact with Blockchain
  4. 創立帳號 -> Private Key 最高權限
  5. 印出地址確認正確 L17,18
  6. L11 private key 地址 .env
  7. L22
  8. L25 範例帳號,Code 有連結
  9. L32-51 Smart Contract
    • 部署到互動
  10. L37 部署互動
  11. L39-63 動作
  12. L63 Smart Contract
  13. L76-83
    • 寫入要交易手續費,要指定付款者
    • 讀取免費
    • L81-83 發動交易!
  14. L85-86
  15. L91 印出收據,有 Hash 值可到 Kovan 看到交易

新專案

jsdc

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

https://github.com/z-institute/Web3-Demo/blob/main/index.js

  1. .env
    • projectID - infura IO 免費節點
    • privateKey - 創立新帳號
      • Metamask 小狐狸插件
  2. L24 - 34 產生 Key
  3. L36 View ETH Balance
  4. Smart Contract
    5. 部署到新的 Contract
    6. Injective Axxd tree
    7. L36-63 ABI 被取代

資安審計

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 將 Library 收集並集中,改參數
  2. 自己寫測試,90% 即可,不可能 100% (講者:超過95%)
  3. 把沒用的 Code 清掉,可以節省費用,部署要錢!
  4. Coverage 看哪行沒有被測到
  5. 想想 Flash loan Attack
    6. 貸款要抵押品
    7. 可以在鏈上借錢與還錢 1000ETH
    8. 沒還錢就來付真錢

Project Showcase

MFT-conctract

  1. L34-35 test/ERC721Tech.js
  2. 產生 Converage

工商服務時間

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • JS + TS 基礎
  • 兩週入門,開發客製化專案

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →