EVM Integration
Transfer ETH and interact with EVM chains using web3dart and Silent Shard SDK
Complete github repository example can be found here
Workflow
- Provided a
PersistentStorageClientto store and manage the keyshares. - Spin up the server, this example uses a local server for testing.
- Create a Cloud Client to connect to the server.
- Created a ecdsa session using the
createDuoEcdsaSessionfunction. This uses cloud client and storage client to create a session. - Create a new Keyshare if not found in the storage client, otherwise read it from the storage client. This is done using the
keygenfunction of the session. - Calculate the address from the public key.
- Create Web3Client using web3dart.
- Fund the wallet using the
sendSepoliaEthToAddressfunction. The example uses the Sepolia faucet server to fund the wallet provided by the Silence Laboratories for hassle free testing. (The api has a rate limit if query exceeds the limit, you can use your own faucet server by changing thesendSepoliaEthToAddressfunction.) The response is decoded using the classesFaucetSuccessResponseandFaucetErrorResponse. - To wait for the transaction to be confirmed, we use the
waitForTransactionConfirmationfunction. - We create a transaction object using the
Transactionclass of web3dart. - Sign the transaction hash using the
signfunction of the session. - Compute the r and s bytes and v value from the signature.
- To avoid the default signer of web3dart, we create a custom signature credentials object using the
CustomWeb3SignatureCredentialsclass. This class overrides thesignToEcSignaturemethod to return the mpc signature. - Wait for the transaction to be confirmed and print the balance of the wallet and the recipient address.