Payments
Leases are paid from deployment owner (tenant) to the provider through a deposit & withdraw mechanism.
Tenants are required to submit a deposit when creating a deployment. Leases will be paid passively from the balance of this deposit. At any time, a lease provider may withdraw the balance owed to them from this deposit.
If the available funds in the deposit ever reaches zero, a provider may close the lease. A tenant can add funds to their deposit at any time. When a deployment is closed, the unspent portion of the balance will be returned to the tenant.
Bidding on an order requires a deposit to be made. The deposit will be returned to the provider account when the bid transitions to state
CLOSED
.Escrow accounts are a mechanism that allow for time-based payments from one account to another without block-by-block micropayments. They also support holding funds for an account until an arbitrary event occurs.
Escrow accounts are necessary in akash for two primary reasons:
- 1.Leases in Akash are priced in blocks - every new block, a paymentfrom the tenant (deployment owner) to the provider (lease holder)is due. Performance and security considerations prohibit thenaive approach of transferring tokens on every block.
- 2.Bidding on an order should not be free (for various reasons, including performance and security). Akash requires a deposit for every bid. The deposit is returned to the bidder when the bid is closed.
Payments may be withdrawn from, which transfers any undisbursed balance from the module account to the payment owner's account.
Many actions invoke the settlement process and may cause the account to become overdrawn.
How are gas fees calculated on Akash?
Akash uses the basic Cosmos gas calculations for all fees. Cosmos documentation on gas can be found here.
Many actions trigger the account settlement process - it ensures an up-to-date ledger when acting on the account.
Account settlement goes as follows:
- 1.Determine
blockRate
- the amount owed for every block. - 2.Determine
heightDelta
- the number of blocks since last settlement. - 3.Determine
numFullBlocks
- the number of blocks that can be paid for in full. - 4.
Field | Description |
---|---|
ID | Unique ID of account. |
Owner | Account address of owner. |
State | Account state. |
Balance | Amount deposited from owner account. |
Transferred | Amount disbursed from account via payments. |
SettledAt | Last block that payments were settled. |
Name |
---|
OPEN |
CLOSED |
OVERDRAWN |
Field | Description |
---|---|
AccountID | |
PaymentID | Unique (over AccountID ) ID of payment. |
Owner | Account address of owner. |
State | Payment state. |
Rate | Tokens per block to transfer. |
Balance | Balance currently reserved for owner. |
Withdrawn | Amount already withdrawn by owner. |
Name |
---|
OPEN |
CLOSED |
OVERDRAWN |
Create an escrow account. Funds are deposited from the owner account to the escrow module account.
Field | Description |
---|---|
ID | Unique ID of account. |
Owner | Account address of owner. |
Deposit | Amount deposited from owner account. |
Add funds to an escrow account. Funds are transferred from the owner account to the escrow module account.
Field | Description |
---|---|
ID | Unique ID of account. |
Amount | Amount deposited from owner account. |
Re-calculate remaining account and payment balances.
Field | Description |
---|---|
ID | Unique ID of account. |
Close account - settle and close payments, return remaining account balance to owner account.
Field | Description |
---|---|
ID | Unique ID of account. |
Create a new payment. The account will first be settled; this method will fail if the account cannot be settled.
Field | Description |
---|---|
AccountID | |
PaymentID | Unique (over AccountID ) ID of payment. |
Owner | Account address of owner. |
Rate | Tokens per block to transfer. |
- Account is in state
OPEN
after being settled. ID
is unique.Owner
exists.Rate
is non-zero and account has funds for one block.
Withdraw funds from a payment balance. Account will first be settled.
Field | Description |
---|---|
AccountID | |
PaymentID | Unique (over AccountID ) ID of payment. |
Close a payment. Account will first be settled.
Field | Description |
---|---|
AccountID | |
PaymentID | Unique (over AccountID ) ID of payment. |
Hooks are callbacks that are registered by users of the escrow module that are to be called on specific events.
Whenever an account is closed
OnAccountClosed(Account)
will be called.Whenever a payment is closed,
OnAccountClosed(Account)
will be called.Last modified 1yr ago