2020/11/19 walletconnect
#flada #walletconnect
https://walletconnect.org/
ウォレットとアプリケーション(主に Web ページで)をつなぐ標準化された仕様
対応してるウォレット
たくさん https://walletconnect.org/wallets/
MetaMask
Gnosis Safe
Argent
対応してるアプリケーション
たくさん https://walletconnect.org/apps
MakerDAO
Uniswap
1inch Exchange
web3.js の provider(Ethereum との接続方法を抽象化したレイヤー) 実装
https://www.npmjs.com/package/@walletconnect/web3-provider
簡単に使えるっぽい
web3modal
https://github.com/Web3Modal/web3modal
WalletConnect のほか、MetaMask などの provider も使えるようにしつつ、いい感じのモーダルで表示するやつ
仕組み
https://walletconnect.readthedocs.io/en/latest/technical-specification/
dapp と wallet の間に relay する websocket サーバ(Bridge と呼ぶ)がいる
secret を QR コードで共有したら、Bridge を介して session を構築
dapp から tx 投げるときは暗号化して bridge に、bridge から wallet へ Push 通知して暗号化された tx を取得、事前に共有した secret で複合して tx をえる
最終的に用意されてる JSON-RPC コールができるようになる https://docs.walletconnect.org/json-rpc-api-methods/ethereum
https://walletconnect.readthedocs.io/en/latest/images/walletconnect-accounts-diagram.png
https://walletconnect.readthedocs.io/en/latest/images/walletconnect-transaction-diagram.png