Skip to main content

EVM Integration

Transfer ETH and interact with EVM chains using web3dart and Silent Shard SDK

Complete github repository example can be found here

Workflow

  1. Provided a PersistentStorageClient to store and manage the keyshares.
  2. Spin up the server, this example uses a local server for testing.
  3. Create a Cloud Client to connect to the server.
  4. Created a ecdsa session using the createDuoEcdsaSession function. This uses cloud client and storage client to create a session.
  5. Create a new Keyshare if not found in the storage client, otherwise read it from the storage client. This is done using the keygen function of the session.
  6. Calculate the address from the public key.
  7. Create Web3Client using web3dart.
  8. Fund the wallet using the sendSepoliaEthToAddress function. 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 the sendSepoliaEthToAddress function.) The response is decoded using the classes FaucetSuccessResponse and FaucetErrorResponse.
  9. To wait for the transaction to be confirmed, we use the waitForTransactionConfirmation function.
  10. We create a transaction object using the Transaction class of web3dart.
  11. Sign the transaction hash using the sign function of the session.
  12. Compute the r and s bytes and v value from the signature.
  13. To avoid the default signer of web3dart, we create a custom signature credentials object using the CustomWeb3SignatureCredentials class. This class overrides the signToEcSignature method to return the mpc signature.
  14. Wait for the transaction to be confirmed and print the balance of the wallet and the recipient address.