Withdraw Funds from Escrow

To withdraw funds deposited previously to an escrow account associated to a chainlet, you will need the chain-id associated to the chainlet.

Please note that unlike escrow deposits, that allow you to specify a specific amount, withdrawing of funds from an escrow account withdraws all the funds you deposited. This is an all-or-nothing operation. It will only allow you to withdraw funds that have been deposited from an account that you own or control.

To withdraw funds from an escrow account, use

sagacli account withdraw-escrow <chain-id> \
--from <account address or key name making the withdrawal>

Withdrawal Example

Let us step through the withdrawal with the help of an example.

Let us assume that we have a chainlet with a chain-id of magicwarriors_1698795593524888-1

Prior to making the withdrawal, this chainlet had access to funds from two separate accounts i.e. one belonging to the chainlet owner, and the other belonging to a different user with a key named fundkey.

$ sagacli account get-escrow magicwarriors_1698795593524888-1
ChainId                              TotalBalance        Funder                                          FunderDeposit
-------                              ------------        ------                                          -------------
magicwarriors_1698795593524888-1     290000000upsaga     saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn     10000000.0000upsaga
magicwarriors_1698795593524888-1     290000000upsaga     saga1yuvju0cztlahsf6f37z9j83vwyzgj6pzhx090f     280000000.0000upsaga

Now, the user with the key fundkey wishes to withdraw his/her contribution of10,000,000,000 upsaga tokens from the chainlet's escrow.

Checking the Account Balance Pre-Withdrawal

Before we process this withdrawal, let us take a look at the account balance associated with the key fundkey:

$ sagacli account balance --address saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn
Amount     Denom
------     -----
8000000000 upsaga

Account saga14hyhswxf0shnpzup406yvjejmfsrjnvzq897re (associated with key fundkey) has a balance of 8,000,000,000 upsaga tokens.

Process Escrow Withdrawal

Now, we will process an escrow withdrawal from chainlet magicwarriors_1698795593524888-1

To do so, we will execute a withdraw-escrow transaction in the following manner:

$ sagacli account withdraw-escrow magicwarriors_1698795593524888-1 --from saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn

You are about to sign and broadcast a transaction, with the following configurations:
* Keyname:                fundkey
* Keyring:                file
* Address:                saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn
* Network RPC:            https://spc.sagarpc.io
* Platform chain id:      spc-1
* Ledger:                 false
* Gas limit:              250000
* Message Detail:
	creator:"saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn"
	chainId:"magicwarriors_1698795593524888-1"

Do you want to proceed? (y/N):
y
2023-03-23T15:13:23-05:00 INF tx broadcasted to the remote node code=0 gas_used=69449 gas_wanted=200000 hash=DFA654213E4402D5D6B716847D83CF0F851CBF0E1891F51638D57A8386B9B67B
ChainId                               TotalBalance     Funder                                                 FunderDeposit
-------                               ------------     ------                                                 -------------
magicwarriors_1698795593524888-1      280000000upsaga  saga1yuvju0cztlahsf6f37z9j83vwyzgj6pzhx090f            280000000.0000upsaga

As can be seen from the output above, the withdrawal returned the funds to the account with the key fundkey whose account address is saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn.

Checking the Account Post-Withdrawal

We can also check whether the account address saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn received the funds back and that its account balance was updated:

$ sagacli account balance --address saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn
Amount       Denom
------       -----
8010000000   upsaga

Yes, the account saga17gk4chqd0lrkyamrxdmu62czmu0dpnemmxlymn received all of the funds (10,000,000,000upsaga tokens) from the escrow, and its balance was correctly updated.

IMPORTANT: Withdrawing all of the funds in a chainlet escrow account, on behalf of all funders, will change the escrow account balance to zero which will instruct the SAGA Platform to stop running the chainlet and its related RPC and Chainlet Explorer infrastructure and services. In order to keep your chainlet live, make sure the chainlet escrow account has always enough funds to pay for the epoch fees.

Further Details

For further details and options on escrow withdrawal, please see

sagacli account withdraw-escrow --help

Last updated