# ETH TAIPEI 筆記 ## Project Submission We are DefiSansevieria team ![](https://i.imgur.com/XcDwb2v.png) We had selected ![](https://i.imgur.com/54EsuFi.png) After demo and update the project description ![](https://i.imgur.com/IejZ5kd.png) ## Project Schedule 4/22 下午 Video、PPT 4/23 上午 10點上課 4/23 上午 Source Code and Asset submission ## 社交恢復錢包 ### 研究文章 ERC-4337關於守護者(協助恢復者)的翻譯文章,內有原文連結 : [https://www.chaincatcher.com/article/2089488](https://www.chaincatcher.com/article/2089488) 原文中有提到是使用不常聯絡或是不認識的守護者 ![](https://i.imgur.com/ddXuqrQ.png) 關於守護者的狀態更新和資安 ![](https://i.imgur.com/FdnwtoL.png) 我的想法是使用社交恢復但需要多簽,例如提供6組社交恢復只需要3組同意就通過,通過可以是將原有資產轉至新的錢包。 **閱後問題:如果不認識那為什麼要幫助恢復,這需要有獎勵模式** ### 社交恢復錢包 Email恢復參考範例 Unipass Wallet : [https://docs.wallet.unipass.id/introduction/email-recovery](https://docs.wallet.unipass.id/introduction/email-recovery) ## 資料存儲 ### IPFS IPFS是去中心化存儲的方式,可以透過使用IPFS來達到不使用中心化存儲Server,只利用去中心化錢包Client連接IPFS,存取或刷新IPFS上的資料,Pinata的IPFS說明如下 [https://docs.pinata.cloud/what-can-i-learn-here/what-is-pinata/what-is-ipfs](https://docs.pinata.cloud/what-can-i-learn-here/what-is-pinata/what-is-ipfs) ![](https://i.imgur.com/qxjHtJK.png) 延伸思考,若每個AA錢包都需要這樣的驗證層可以想辦法透過IPFS存儲資料方式,提供一個每種錢包都可以利用的驗證層,IPFS儲存驗證者清單(例如包括郵件地址和狀態等)概念如下圖 作法一 提供驗證API讓錢包呼叫 ![](https://i.imgur.com/fktNnD8.png) 作法二 提供智能合約地址給其他合約呼叫 ![](https://i.imgur.com/CFYRcku.png) --- ## 恢復流程 - 社交恢復,通常會需要有通知功能,所以在APP的通知上會比Web好(we也可用ethers.js來監聽)。一旦有Guardian啟動恢復流程,需要在短時間內完成。(監聽鏈上的 event emit) - 目前完全`去中心化`的社交恢復,只能使用鏈上互動方式,目前建議直接使用 [sign data](https://docs.metamask.io/wallet/how-to/sign-data)。若不是純鏈上的互動,那麼會需要oracle的方式,會增加許多複雜性 - 目前假定設定的 Guardian 最少的為3個,最多為9個。每次 Guardian 提案門檻為 Guardian總數除以4的無條件進位整數,達到提案門檻時,就會發送個 event,可通知Guardian進行投票。同意恢復的門檻為皆有大於等於 2/3 的 Guardian 同意 -- Guardian 3個,提案門檻 1個,通過門檻 2個 -- Guardian 4個,提案門檻 1個,通過門檻 3個 -- Guardian 5個,提案門檻 1個,通過門檻 4個 -- Guardian 6個,提案門檻 1個,通過門檻 4個 -- Guardian 7個,提案門檻 1個,通過門檻 5個 -- Guardian 8個,提案門檻 2個,通過門檻 5個 -- Guardian 9個,提案門檻 2個,通過門檻 6個 - 該 Guardian 的設定,在沒有丟失私鑰的情況下,可以隨時一次性的創立與修改 - 社交恢復可以由其中一個 Guardian 啟動,當達到 N-of-M 再一定時間內簽章完成後,完成恢復。即把公鑰(signing pubkey)轉換成另外一個由 Guardian 所提出的新公鑰(如下圖) https://vitalik.ca/general/2021/01/11/recovery.html ![](https://i.imgur.com/5LFaibG.png) ## Solidity in-progress https://github.com/maxmilian/account-abstraction.git Guardians - Max: 0x9e61848030649199f14b9033dE671e120c7c9ec6 - Ryan: 0x7a4d6c296b28460cda81fb584234a15fc105e182 - Garrick2: 0x5424F2760a4b366eBe338777766864E7A95A831b - Garrick3: 0x0837AAd2103EE64F485AE9F3AD84D7aE56D61333 - Max3: 0x82a96C2E1DB313FF23Ac76fAC2B2d1dc8d2CfEa5 setGuardians: ["0x9e61848030649199f14b9033dE671e120c7c9ec6", "0x7a4d6c296b28460cda81fb584234a15fc105e182", "0x5424F2760a4b366eBe338777766864E7A95A831b"] owner - Garick: 0xB7Ef6435a61AAD311748AC5116C67e8d0888aD19 - Max2: 0x32E25a389a6267288eE578943CF660d0851C2a05 EntrypPoint: 0x0576a174D229E3cFA37253523E645A78A0C91B57 SimpleAccountFactory: 0x60f17A90aD97E229173579532a0a54B20079A212 SimpleAccount:0x05700E856428BFC7529D298a246Bd05e66605146 --- --- ## EIP 4337 compatible [以太坊基金會贊助的許願清單](https://efdn.notion.site/efdn/Ecosystem-Support-Program-Wishlist-ae88ec8d8fc34d01be96d35ddaff7d23) [EIP4337 Dune](https://dune.com/johnrising/erc-4337) Dune Analysis - Network: Ethereum Goerli - Bunlder: Stackup UniPass 4337 compatible PR https://github.com/UniPassID/Unipass-Wallet-Contract/pull/18/commits/a0a546d62cc10281c688c2b0bc590c4e18b70f37 --- ## EIP 4337 Components - Contract Account(CA):本次社交恢復的重點合約 - EntryPoint:Stackup有佈署到相應的網路,[參考文件](https://docs.stackup.sh/docs/introduction/entity-addresses)跟相應的[支援網路](https://blockscan.com/address/0x0576a174D229E3cFA37253523E645A78A0C91B57)。支援 Gnosis、Ethereum Mainnet、Ethereum Goerli - Bunlder:Stackup有佈署到相應的[支援網路](https://blockscan.com/address/0x9C98B1528C26Cf36E78527308c1b21d89baED700) - UserOperations:建議使用 [eth-infinitism client SDK](https://www.npmjs.com/package/@account-abstraction/sdk) - Paymaster:可有可無(先忽略) - Aggregators:可有可無(先忽略) --- ## 錢包開發 HD Wallet : [https://hackmd.io/wSBuYq_BTdygeBFtOlhOoQ](https://hackmd.io/wSBuYq_BTdygeBFtOlhOoQ) 現有功能簡述如下 1. 可以建立錢包並使用助記詞恢復或是切換錢包 2. 錢包建立後會記錄在Localstorage所以頁面刷新都會固定取得同一個錢包 3. 有Transfer功能可以轉幣到另一個錢包地址 4. 取得Transaction列表並顯示在頁面上 預計將社交恢復功能加成另一個恢復錢包的選項,二邊的恢復功能方便模擬比較,社交恢復功能處理中預計4/18(週二)出一版Demo 由於輸入錢包地址對一般人來說也不是件容易的事,所以社交恢復功能想要可以更簡便,和Ryan討論是否可以通過取得APP建立的錢包位址,自動幫要社交恢復用戶準備其他錢包地址,Ryan提出看能不能透過Factory Contract建立Wallet的方式透過Factory Contract找到建立過的錢包,經過研究AA Wallet確實可以透過Factory Contract建立Wallet,詳細內容請見Reference No.6 ![](https://i.imgur.com/gecvgju.png) 只是如果要達到上圖的功能就要部份實現AA Wallet, 至少做到使用Entry Point呼叫Factory Contract建立AA Wallet,並可以Validate OP Ethereumscan找到的EntryPoint : `0x0576a174D229E3cFA37253523E645A78A0C91B57` Gnosisscan找到的EntryPoint : `0x0576a174D229E3cFA37253523E645A78A0C91B57` 二個看起來是一樣的不確定是不是直接移植 Gnosisscan上新版的EntryPoint : `0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789` 參考Reference No.7測試AA Wallet… Gnosis testnet API key : `M6C21JD7XGQFF8CDWR8TVT4RBTTTGVJEZW` ``` 0x6174c9a712f37ab03ed796fe2b56606a39e19d97de45eca731acb4e4db206962 ``` https://blockscout.com/gnosis/chiado 0x7A4D6c296B28460cda81Fb584234A15Fc105e182 --- ## Network Gnosis Faucet (https://gnosisfaucet.com/) 測試網路Chiado https://rpc.chiado.gnosis.gateway.fm ![](https://i.imgur.com/RAnWlOY.png) --- Gnosis https://rpc.gnosis.gateway.fm ![](https://i.imgur.com/b4WgXEe.png) ## Source Code Contract : `git@gitlab.com:mouseslayer1/ethtaipeiwalletcontract.git` `https://gitlab.com/mouseslayer1/ethtaipeiwalletcontract.git` App : `git@gitlab.com:mouseslayer1/ethtaipeiwalletapp.git` `https://gitlab.com/mouseslayer1/ethtaipeiwalletapp.git` ## Reference(改為編號方便上面文章引用) 1. https://docs.stackup.sh/docs/introduction/account-abstraction 2. https://github.com/stackup-wallet/erc-4337-examples 3. https://www.soulwallet.io/ 4. https://blockcast.it/2023/01/14/how-erc-4337-account-abstraction-will-evolve-wallets/ 5. https://bit.ly/aawallet1 6. AA合約錢包的建立(描述從HD Wallet過渡到實現) : [https://www.alchemy.com/blog/account-abstraction-wallet-creation](https://www.alchemy.com/blog/account-abstraction-wallet-creation) 7. Openzeppelin EIP-4337 : [https://blog.openzeppelin.com/eip-4337-ethereum-account-abstraction-incremental-audit/](https://blog.openzeppelin.com/eip-4337-ethereum-account-abstraction-incremental-audit/) GitHub : [https://github.com/eth-infinitism/account-abstraction/tree/6dea6d8752f64914dd95d932f673ba0f9ff8e144](https://github.com/eth-infinitism/account-abstraction/tree/6dea6d8752f64914dd95d932f673ba0f9ff8e144) 8. 社交恢復錢包範例 : [https://github.com/candidelabs/CandideWalletContracts](https://github.com/candidelabs/CandideWalletContracts) 9. ETH Taipei Hackathon Info : [https://eth-taipei.notion.site/ETHTaipei-Reminder-df3335779211480486c9dcc4c0ff6fe4](https://eth-taipei.notion.site/ETHTaipei-Reminder-df3335779211480486c9dcc4c0ff6fe4) 10. ETH Taipei Hackathon Furucombo 2k : [https://dinngo.notion.site/ETHTaipei-Hackathon-Furucombo-f921fb3fd0ed4a0bb247b6306e738137](https://dinngo.notion.site/ETHTaipei-Hackathon-Furucombo-f921fb3fd0ed4a0bb247b6306e738137) 11. [分析EIP-4337:以太坊最强账户抽象提案](https://mirror.xyz/zhunianpan.eth/dzwYBD1MB-Noswz0DATjREtTRCkzCD0cwalZySxmxV4) 12. 獨立Typescript GitLab : `git@gitlab.com:mouseslayer1/ethtaipeiwallettsapp.git` ----------------------------------------------------- 0x0C7554Dff0B51729805504900e9DF72fF859Ef67 https://ethtaipeiwallet.vercel.app/ CA Wallet Address 0xFf19C9c583C5E5b9645De0B4a8FCeea95d2745D5 https://github.com/ryan19910912/ethtaipeiwallet 別組的範例 https://docs.google.com/presentation/d/1SAX40Ipi1DMTULP3o7EK-eC0OxqYcrx4EkNOSthF7g4/edit#slide=id.gf176778c9ad4c3f_0 ###### tags: `ETH Taipei Hackathon`