# Query for a polkadot connect parachain's lease time

Is there a simple way to query polkadot in order to get which block will be the last block of the lease period?

I want to be able to query polkadot in order to see how long a certain parachain has left of its lease time, is there a simple way of doing this?

Thanks

## 1 Answer

You can query the storage `slots -> leases (your_para_id)`, you will get a list. The first item in the list is the amount locked for the current `Lease Period`, the following items are for the subsequent lease periods.

So you can take then take the size of that list, and increment from the current leasePeriodIndex to get the leases. To translate this information in the number of blocks you have to retrieve the storage constants `slots -> leasePeriod`, which is the number of blocks over which a single period lasts. And `slots -> leaseOffset`, which is the number of blocks to offset each lease period by. See more information about that in How to compute the starting and ending of a lease period?

• Values from polkadot: leasePeriod = 1,209,600 leaseOffset = 921,600 slots > leases (2034): `[ [ 13UVJyLnbVp77Z2t6qgGcKzXE67EGerxzucL4BjCph173ncH 24,438,735,072,384,654 ] ]` Number of Lease Periods = Length of List - 1 = 1 - 1 = 0 Total Lease Time (in blocks) = Current Lease Time (in blocks) + (Number of Lease Periods * leasePeriod) + (Number of Lease Periods * leaseOffset) What am I missing here? Oct 25, 2023 at 15:03
• From slots > leases (2034) you get that this parachain only have 1 lease remaining, if you check this page from the wiki to see the numbers, you can see that 1,209,600 equals 12 weeks: wiki.polkadot.network/docs/…. Using the leaseOffset to and the link I shared you can calculate exactly how long it has left Oct 26, 2023 at 7:17