On this page we’ll run through the easiest way to get up and running with the SDK from scratch.

The first step with using the SDK is instantiating it with a key based wallet so act as the owner.

Let’s clone an example dapp we have built.

git clone https://github.com/etherspot/etherspot-prime-getting-started.git

Next let’s install the packages.

cd etherspot-prime-getting-started
npm i

Then let’s run the dapp.

npm start

And that’s it! We have a dapp up and running which shows the intialisation flow. An Etherspot smart account is created and now you’re ready to tailor it however you want to your use case.

In this example we simply create a key based wallet with ethers.js like so:

const randomWallet = ethers.Wallet.createRandom();
setEoaPrivateKey(randomWallet.privateKey);

Then we use this key based wallet to instantiate the SDK on Mumbai and get the wallet address.

const primeSdk = new PrimeSdk({ privateKey: eoaPrivateKey}, { chainId: 80001, bundlerProvider: new EtherspotBundler(80001, bundlerApiKey)  })
const address: string = await primeSdk.getCounterFactualAddress();

For next steps you can look at functions or examples.

Keep in mind this is a fresh wallet so you will have to get testnet funds via a faucet to send any transactions from it.