Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RSKIP 433 #433

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions IPs/RSKIP433.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
rskip: 433
title: Fiat Stable Minimum Gas Price
description:
status: Draft
purpose: Usa
author: RM
layer: Node
complexity: 2
created: 2024-06
---
# Fiat Stable Minimum Gas Price


|RSKIP | 433 |
| :------------ |:-------------|
|**Title** |Fiat Stable Minimum Gas Price|
|**Created** |JUNE-2024 |
|**Author** |RM |
|**Purpose** |Usa |
|**Layer** |Node |
|**Complexity** |2 |
|**Status** |Draft |

# **Abstract**

This RSKIP proposes a feature that allows Rootstock miners to configure the minimum gas price (MinGasPrice) in fiat currency instead of the current cryptocurrency (WEI) linked to Bitcoin.

## Motivation

In the current RSK network, miners have the ability to set the minimum gas price through the `miner.minGasPrice` configuration, which is denominated in WEI. This parameter is essentially linked to the Bitcoin price, causing the gas price to vary in correlation with Bitcoin's value. This behavior creates uncertainty in transaction costs, often leading to increased costs when Bitcoin prices go up. This unpredictability can negatively impact user experience, as transaction fees become less stable.

This can be solved adding a new feature that allows miners to specify and configure the minimum gas price in fiat currency. By decoupling gas prices from Bitcoin's market fluctuations, this property aims to stabilize transaction costs in terms of fiat value, thereby improving predictability. This approach not only protects users from the volatility of cryptocurrency markets but also provides a better user experience.

## Specification

We could introduce a new configuration property, `stableMinGasPrice` to specify the minimum gas price in fiat currency. Key elements of this configuration include:
1. **Enabled Flag:** Adding the `enabled` flag to disable the stable gas price feature. If this value is false, then the system should behave as it currently does, using the `miner.minGasPrice` configuration.
2. **source.method:** Defines the method to retrieve the Bitcoin price. It can be one of these 2 methods:
* `HTTP_GET`: Simple HTTP Get request to fetch the price.
* `ETH_CALL`: Call to a Smart Contract that returns the price.
3. **Minimum Stable Gas Price:** `minStableGasPrice` to specify the minimum gas price in the chosen fiat currency.
4. **Refresh Rate:** `refreshRate` to determine how often the Bitcoin price should be refreshed.

It should look something like this:
```
miner {
# The default gas price
minGasPrice = 4265280000000

stableGasPrice {
enabled = false
minStableGasPrice = 4265280000000 # 0.00000426528 USD per gas unit
refreshRate = 360
method = HTTP_GET || ETH_CALL

# Examples:
# method = "HTTP-GET"
# params {
# url = "https://domain.info/ticker"
# jsonPath = "/USD/buy"
# timeout = 2 seconds
# }
#
# method = "ETH_CALL"
# params {
# from: "0xcd2a3d9f938e13cd947ec05abc7fe734df8dd825",
# to: "0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826",
# data: "0x8300df49"
# }
}
}
```

When the `stableGasPrice` feature is **enabled**, we should adjust the behavior to retrieve BTC price data according to the he cached _minStableGasPrice_ or the specified method to keep transaction costs stable in fiat currency (like USD or EUR). It first checks if there is a recent, **cached** Bitcoin price within the defined _refresh rate_ and uses this value if available. If no valid cached price exists, it fetches the latest Bitcoin price using the specified method (HTTP_GET or ETH_CALL).

If the price retrieval fails but a cached price is still valid, the system uses the cached price. If **both** the price fetch and cached price are unavailable, it defaults to the original `minGasPrice` setting.

## Rationale

The mechanism would only trigger if a RSK miner configures the minimumGasPrice in fiat currency by enabling `stableGasPrice` in the configuration settings.

## Backwards Compatibility

This feature would be backwards compatible, as it is just a node behavior change and it ensures that existing configurations and functionalities remain intact for users who choose not to adopt or enable the `stableGasPrice` setting. Therefore, this feature doesn't require consensus rules changes and, as a consequence, is not mandatory for all network nodes to adopt it.

# **Copyright**

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ You can find an easily browseable version of this information [here](https://ips
| 415 |[Fix pegnatories address derivation from public keys](IPs/RSKIP415.md)| 30-JAN-24 | MI | Usa | Core | 1 | Adopted |
| 417 |[Avoid transactions to be reverted when Bridge method calls from smart contracts return an empty response](IPs/RSKIP417.md)| 28-FEB-24 | MI | Usa | Core | 1 | Adopted |
| 419 |[Powpeg Spendability Validation Protocol](IPs/RSKIP419.md)| 31-AUG-23 | JD, JZ | Sec | Core | 2 | Draft |
| 433 |[StableMinGasPrice](IPs/RSKIP433.md)| 06-JUNE-24 | RM | Usa | Core | 2 | Draft |

(*) Under evaluation to be implemented in the next reference client release

Expand Down Expand Up @@ -265,6 +266,7 @@ You can find an easily browseable version of this information [here](https://ips
| SM | Shreemoy Mishra | [email protected] |
| SMS | Sebastian Matias Sicardi | |
| VK | Volodymyr Kravets | [email protected] |
| RM | Reynold Morel | [email protected] |

## Build locally

Expand Down