SAVE statement

Last updated: February 21, 2025

The save statement acts like if you were deducting funds from available balance of your account.

Let's take an example with balance(my_account)= GBP 120

save [GBP 100] from @my_account

send [GBP 10] (
   source = @my_account
   destination = @world
)

As a consequence if @my_account has a balance of 120 for instance with save 100 , the remaining available balance is 20.

Let's say now you want to send [GBP/2 30] from the account as a single source, you'll get an insufficient_funds error.

{
    "errorCode": "INSUFFICIENT_FUND",
    "errorMessage": "running numscript: script execution failed: account(s) @my_account had/have insufficient funds"
}

send [GBP/2 *] statement

  • If the balance of @my_account is greater than X, send [GBP/2 *] will send balance - X GBP/2, in our exemple a transaction of 20 then

  • a transaction of 0 is created when balance of @my_account is lower than amount in save

{
   "data": [
        {
            "id": 11,
            "metadata": {},
            "postings": [
                {
                    "amount": 0,
                    "asset": "GBP/2",
                    "destination": "world",
                    "source": "my_account"
                }
            ],
            "reverted": false,
            "timestamp": "2024-06-12T15:46:36.981785Z",
            "txid": 11
        }
    ]
}

Multiple source accounts

If you are creating a transaction with multiple sources, funds will be taken from @my_account account till the limit is reached, then completed with funds from other source accounts.