# Leasing
The Waves blockchain uses Leased Proof of Stake (LPoS) consensus algorithm. Just like in all other Proof of Stake (PoS) consensus algorithms, each participant's chance to generate the next block is proportional to their economic stake in the network. Unlike Proof of Work, PoS doesn’t require significant computational capacities or energy, also making attacks on the network unprofitable for participants.
LPoS differs from PoS in that ordinary users can take part in block generation by leasing out their WAVES tokens to generating nodes. In essence, the lessor gives the node the right to generate blocks using their WAVES. The tokens remain locked on the lessor's account until the lessor cancels the lease.
Leased tokens increase the node's chance to generate a block and get rewards. Commonly node owners share the rewards with lessors. However, the Waves protocol does not regulate leasing payments, they are at the discretion of the node owner.
# Leasing Benefits for WAVES holder
- Each WAVES holder can participate in block generation and earn rewards without running their own node.
- Leasing is safe by design: WAVES tokens are not transferred to the lessee, but remain under the full control of the holder.
- Lease can be canceled instantly, unilaterally.
Generating nodes can work with different efficiency and send back different percentages as rewards. You can choose a node and lease out your WAVES, for example, in the WX Network application developed by a third-party team from the community.
# Leasing Benefits for Node Owner
- Leased WAVES tokens increase the chance to generate the next block and get rewards.
- The node owner can independently set the terms of payments to lessors.
If you'd like to run a generating node and attract users to lease WAVES to your node, see instructions.
# Create and Cancel Lease
The Waves protocol provides two ways to lease WAVES:
- Any account can send a Lease transaction.
- dApp can create a lease by the Lease script action performed by a callable function within an Invoke Script transaction or Ethereum-like transaction.
The lessor can cancel their lease:
- Any account — by a Lease Cancel transaction.
- dApp — by the LeaseCancel script action performed by a callable function.
The lease amount cannot be changed: you can only cancel the lease and create a new one.
Please keep in mind that the generating balance of account is calculated as the lowest effective balance (that is the balance considering leasing) for the last 1000 blocks (more about calculating the generating balance). Transactions that cancel the lease and create the new one may be fall into different blocks.
Example. Suppose at height 3500000 the node's generating balance and effective balance are both 5000 WAVES.
At height 3500001, the lease of 100 WAVES to the node is canceled. The node's generating balance becomes 4900 WAVES.
At height 3500002, the new lease of 70 WAVES to the node is created. However, the node's generating balance is still 4900 WAVES. The generating balance can increase only at height 3501001, when block 3500001 drops out of the last 1000 blocks.
The Lease
and LeaseCancel
script actions performed in the same script invocation are guaranteed to be in the same block. Therefore, the dApp can safely withdraw a part of the leased WAVES using these script actions with the same recipient. If a lease of 100 WAVES is canceled and a new lease of 70 WAVES is created, the recipient's generating balance will decrease by the difference of 30 WAVES.
# Lease Parameters
You can get lease parameters using the Node REST API:
- GET /leasing/active/{address} returns a list of active leases involving a given address, both incoming and outcoming
- GET /leasing/info/{id} returns lease parameters by lease ID
- GET /leasing/info, POST /leasing/info return lease parameters by a list of lease IDs
Example lease:
{
"id": "CcqcGx5iWd6xvxzJnoVQHD91R5jYZAZHvZq2DMVuWKx1",
"originTransactionId": "CcqcGx5iWd6xvxzJnoVQHD91R5jYZAZHvZq2DMVuWKx1",
"sender": "3PD9TqtXN9tC1tg5TFUC2BNukebfLaYUsdy",
"recipient": "3PEjdMgnR7a48RnZoW8RF8TeEqidue28Wgm",
"amount": 268100000000,
"height": 3516046,
"status": "canceled",
"cancelHeight": 3519182,
"cancelTransactionId": "4mHhTVKJoQ4jTF828eBRrXZzy1ni2N2yQLwVhunp4agb"
}
Field | Description |
---|---|
id | Lease ID. If the lease is created by a Lease transaction, its ID is the same as the transaction ID |
originTransactionId | ID of the Lease transaction, or Invoke Script transaction, or Ethereum-like transaction in which the lease was created |
sender | Lessor's address |
recipient | Lessee's address |
amount | Amount of WAVELETs to lease (that is, amount of WAVES multiplied by 108) |
height | Sequence number of the block in which the lease was created |
status | Lease status: active or canceled |
cancelHeight | Sequence number of the block in which the lease was cancelled. null if the lease is active |
cancelTransactionId | ID of the Lease Cancel transaction, or Invoke Script transaction, or Ethereum-like transaction in which the lease was canceled. null if the lease is active |