#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
- Kovan 測試網,進行交易測試
- 使用 web3 進行互動
- Infura -> Free to interact with Blockchain
- 創立帳號 -> Private Key 最高權限
- 印出地址確認正確 L17,18
- L11 private key 地址
.env
- L22
- L25 範例帳號,Code 有連結
- L32-51 Smart Contract
- L37 部署互動
- L39-63 動作
- L63 Smart Contract
- L76-83
- 寫入要交易手續費,要指定付款者
- 讀取免費
- L81-83 發動交易!
- L85-86
- 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
- .env
- projectID - infura IO 免費節點
- privateKey - 創立新帳號
- L24 - 34 產生 Key
- L36 View ETH Balance
- 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 →
- 將 Library 收集並集中,改參數
- 自己寫測試,90% 即可,不可能 100% (講者:超過95%)
- 把沒用的 Code 清掉,可以節省費用,部署要錢!
- Coverage 看哪行沒有被測到
- 想想 Flash loan Attack
6. 貸款要抵押品
7. 可以在鏈上借錢與還錢 1000ETH
8. 沒還錢就來付真錢
Project Showcase
MFT-conctract
- L34-35 test/ERC721Tech.js
- 產生 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 →
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 →