Deposit Addresses: Introduction

Introduction

Deposit addresses in crypto are used to receive digital assets from your own users, and are meant to be unique to each of your user, similar to virtual account numbers offered by payment acceptance providers in TradFi.

In this article, we will go through the nuances of how deposit addresses work and how you can manage them within Levain.

Ethereum and EVM-compatible blockchains

Levain creates deposit addresses for Ethereum and EVM-compatible blockchains using EIP-1014 CREATE2 and EIP-1167 Minimal Proxy Contract, so that your deposit addresses can be derived even before you deploy the contracts on-chain, to save on network fees.

When you first create a deposit address, Levain calculates the address internally using a random salt, unless you specify a salt yourself.

By default, deposit addresses do not get automatically deployed unless you create them programmatically via createWalletDepositAddress with the toAutoDeploy flag set to true. For deposit addresses with toAutoDeploy is set to true, we will deploy the contract on-chain using your gas tank, when we detect that the deposit address has received an incoming deposit, of a token supported by Levain.

The behavior differs depending on the token type, as well as whether you have deployed the deposit address.

  • PENDING_DEPLOYMENT: The deposit address has been created, but not yet deployed with the contract. You can still issue the deposit addresses to your users, but you will not be able to forward funds out of the deposit address until it is in ACTIVE state.
  • DEPLOYING: The deposit address is currently being deployed on-chain, with network fees paid from your gas tank.
  • ACTIVE: The deposit address has been deployed. You can forward funds out of the deposit address to the main wallet, and it will require network fees to do so. See below for the specifics.

Native token

When a deposit address is not yet deployed, native tokens can still be sent into the deposit address. When the deposit address is deployed, the native tokens will be fowarded automatically to the main wallet in the same transaction.

When a deposit address is deployed, native tokens will automatically be forwarded when the sender sends native tokens to the deposit address. The network fees will be paid by the sender in this case. You do not need to pay network fees for the forwarding of native tokens.

ERC-20 tokens

When a deposit address is not yet deployed, ERC-20 tokens can still be sent into the deposit address. When the deposit address is deployed, either you have to manually forward the ERC-20 tokens over, or Levain will forward supported tokens if you have set toAutoDeploy to true when creating the deposit address.

When a deposit address is deployed, ERC-20 tokens will not be automatically forwarded unless you have set toAutoDeploy to true when creating the deposit address. You will have to manually forward the ERC-20 tokens over to the main wallet via Levain App, or you can use the forwardTokens method to forward the tokens to the main wallet.

ERC-721 tokens

When a deposit address is not yet deployed, ERC-721 tokens can still be sent into the deposit address. When the deposit address is deployed, you have to manually forward the ERC-721 tokens over.

When a deposit address is deployed,

  • If the sender's wallet uses safeTransferFrom to send ERC-721 tokens to the deposit address, the tokens will be automatically forwarded to the main wallet in the same transaction.
  • If the sender's wallet uses transferFrom (e.g. MetaMask), the tokens will not be automatically forwarded. You will have to manually forward the ERC-721 tokens, for now via the contract's flushERC721 method.

Bitcoin

Levain uses 2-of-3 multisig for Bitcoin deposit addresses, deriving child keys from your organization's gas tank key, even if Bitcoin does not require a gas tank.

Bitcoin deposit addresses, will only exist in one state when created. This is because no network fees are required to create a Bitcoin deposit address.

  • ACTIVE: The deposit address has been created, and you can send Bitcoin to the deposit address.

When you receive deposits to a Bitcoin deposit address, you will have to manually forward the Bitcoin to the main wallet, as Levain does not automatically forward Bitcoin deposits due to the nature of how Bitcoin works, and network fees required to forward the Bitcoin.

For Bitcoin, network fees are paid by the deposit addresses within the transaction, which means you will get less Bitcoin in the main wallet than the sum of the amount you have in the deposit address. These are all recorded on-chain, and you will be able to reconcile the network fees incurred.

When you forward the Bitcoin to the main wallet, Levain consolidates all your Bitcoin deposits into a single transaction, and you will be required to approve, and then sign the transaction. Note that if you have dust amounts of Bitcoin, you will not be able to forward them to the main wallet, as the network fees will be higher than the amount of Bitcoin you have.

DeFiChain

Similar to Bitcoin, Levain uses 2-of-3 multisig for DeFiChain deposit addresses, deriving child keys from your organization's gas tank key, even if DeFiChain does not require a gas tank.

DeFiChain deposit addresses, will only exist in one state when created. This is because no network fees are required to create a DeFiChain deposit address.

  • ACTIVE: The deposit address has been created, and you can send DeFiChain tokens to the deposit address.

When you receive deposits to a DeFiChain deposit address, you will have to manually forward the DeFiChain tokens to the main wallet, as Levain does not automatically forward DeFiChain deposits due to the nature of how UTXO chains works.

When you forward the DeFiChain tokens to the main wallet, Levain consolidates all your DeFiChain deposits into a single transaction, and you will be required to approve, and then sign the transaction. Note that if you have dust amounts of DeFiChain tokens, you will not be able to forward them to the main wallet, as the network fees will be higher than the amount of DeFiChain tokens you have.

Tron

Levain derives deposit addresses using custodial private keys, as we do not use contract wallets for deposit addresses. This means that Tron deposit addresses will require TRX to flush out tokens.

When you create a deposit address on Tron, Levain will activate it with 1 TRX from your gas tank, which is required due to how Tron works.

  • PENDING_DEPLOYMENT: The deposit address has been created, but not yet activated on Tron.
  • DEPLOYING: The deposit address is currently being deployed on Tron, by way of sending 1 TRX to the deposit address, from your gas tank.
  • ACTIVE: The deposit address has been activated with 1 TRX from your gas tank. You can send funds to the deposit address, and it will require TRX to flush out tokens to the main wallet.