# On-Chain Rent Calculation

At 0xequity, token holders of a specific property receive monthly rent proportional to the number of tokens they own—the more tokens they own, the higher the rent they receive. The rent per month is being calculated on-chain using the formula provided below.<br>

## Average Number of Days in a Month

To accurately compute the average number of days in a month, accounting for leap years in the Gregorian calendar, follow these steps:

### Understanding Leap Years

The Gregorian calendar has two types of years:

* **Common years**: These have 365 days.
* **Leap years**: These have 366 days, occurring every 4 years, except for years divisible by 100 but not divisible by 400.

### Calculating Average Days Per Year

The Gregorian calendar system we use cycles every 400 years, which is 4800 months. In a cycle, there are 7 x 400 = 2800 months of 31 days, there are 4 x 400 = 1600 months of 30 days, there are 300 +3 = 303 months of 28 days, and there are 100 - 3 = 97 months of 29 days. Taking the weighted mean, the average number of days in a month is (2800 x 31 + 1600 x 30 + 303 x 28 + 97 x 29) / 4800 = 30.436875 days exactly.

We rounded the days from 30.436875 days to 30.43684 days.

&#x20;So in  1 Month (30.43684 days) = 2629743 Seconds approximately

Finally we calculate&#x20;

[**`rentPerSecond = rentAmount / 2629743`**](#user-content-fn-1)[^1]

**Why On-Chain Rent Calculation**&#x20;

Calculating rent on-chain offers numerous advantages compared to off-chain methods.&#x20;

1. 1.**Transparency:** On-chain calculations allow all transactions and computations to be publicly verified, building trust among investors.
2. 2.**Accuracy:** Automated smart contracts eliminate human error in rent calculations, ensuring accurate distribution of rental income.
3. 3.**Security:** Blockchain technology provides robust security, safeguarding the integrity of rent calculations against tampering or fraud.​
4. 4.**Efficiency:** Smart contracts simplify the process, reducing administrative workload and enabling quicker, real-time rent distributions.​
5. 5.**Immutable Records:** The blockchain’s unchangeable ledger guarantees that all calculations and transactions are permanently recorded, offering a dependable audit trail.

[^1]:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0xequity.com/innovations/on-chain-rent-calculation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
