Setup Account

DeFi Smart Account Setup

Every user needs to create a Smart Account to interact with DeFi protocols through Instadapp. These DeFi Smart Accounts (DSAs) allow developers to build extensible use-cases with maximum security and composability. It is also possible to create multiple DSAs for a single ethereum address.

The protocol provides three methods pertaining to setting up a DSA -

  • Create a Smart Account - build()
  • Fetch all Smart Accounts owned by an ethereum address - getAccounts()
  • Set a Smart Account to be used for function calls - setInstance()


Used to create a new DSA account. For an already created account, you can use the setInstance() method to activate the particular DSA to start casting spells.

// in async functionsawait;//;

For implementations on NodeJs, it is required to pass the otherwise optional gasPrice parameter as well. There are also some other optional parameters that can be passed to the method as shown below -{  gasPrice: gasPrice // estimated gas price  origin: origin,  authority: authority,  version: 2})

All the parameters that this method accepts are listed below -

gasPricestring/numberThe gas price in gwei. Mostly used in Node implementations to configure the transaction confirmation speed.
originaddressThe address to track the origin of the transaction. Used for analytics and affiliates.
authorityaddressThe address to be added as the DSA authority.
fromaddressThe account with which you want to create your DSA. This is helpful to create DSA for other addresses.
noncestring/numberNonce of your sender account. Mostly used in Node implementation to send transaction with a particular nonce either to override unconfirmed transaction or for other purposes.
versionnumberThe version of DSA to use (it is recommended to use version 2 which is latest)

The method returns the hash of the transaction and creates a uniquely numbered Smart Account which acts as a proxy to interact with verified DeFi protocols. Each DSA has a unique ethereum address.


Used to fetch all accounts owned by an ethereum address.

// in async functionsawait dsa.getAccounts(address);// ordsa.getAccounts(address).then(console.log);
addressaddressThe ethereum address for which the list of held DSA accounts is required.

The method returns an array of objects with all the DSA accounts which have the passed address as one of their authorities:

[  {      id: 52, // DSA ID      address: "0x...", // DSA Address      version: 2 // DSA protocol version  },  ...]


setInstance() method is used to configure global values and use the account having the dsaId equal to the passed Id for all subsequent operations.

dsa.setInstance(dsaId); // DSA ID
dsaIdnumberThe DSA Id to be used for casting spells.

If you still can't find something you're looking for or have any questions, ask them at our developers community on Discord or simply send an Email.

Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.