NIP: 9
Title: Add BTC/ETH assets to the NULS main network for gas fees
Author: Reaper Ran <reaper@nuls.io>, Berzeck <Berzeck@nulstar.com>
Discussions-To:
Status: Draft
Type: Core
Created: 2024-02-24
Abstract
BTC and ETH have become the primary assets in the blockchain industry, and NULS is dedicated to innovation and exploration in this industry.
We propose that the NULS technical community add BTC/ETH as gas assets on the NULS mainnet, making it a multi-gas blockchain. This move will also benefit other Layer 2 networks created using NULS ChainBox with BTC/ETH as the primary assets and integrated into NULS parallel chains.
Motivation
The NULS blockchain network will attract more users and communities to build in the NULS network by providing use cases for major assets.
Specification
Gas Fees: It is used to reward the network node for block packaging and the stakers on the node, which means that the fee will be distributed to the node and the stakers on the node will receive BTC/ETH.
Gas Fee Calculation:
- 0.000001 BTC/KB
- 0.00002 ETH/KB
Calculation of Gas Fees for Transfer Transactions
The transaction size (in bytes) is used to calculate the gas fee. For every 1024 bytes, 0.000001 BTC or 0.00002 ETH is charged. Plus, a smaller fee is applied for transaction sizes below 1024 bytes.
Calculation of Gas Fees for Smart Contract Execution
Total fee = Gas usage * Gas price
The execution of a smart contract can be calculated. Each statement and each built-in function have fixed Gas prices and usage. At each invocation of a smart contract, all or a subset of the statements and built-in functions will be executed. There is a minimum price to pay for calling a contract, even if the call does nothing. This is to prevent malicious calls.
This is a subset of the pricing table. Prices will be added in subsequent updates.
Operation | Gas Consumption | Operation Explanation |
---|---|---|
Add | 1 | addition |
Sub | 1 | subtraction |
Mul | 1 | multiplication |
Div | 1 | division |
Step | 1 | Execute each step |
Stop | 0 | Stop execution |
Store | 100 | Store value |
Load | 100 | Load (read in) value |
Hash | 20 | Hash function |
Create | 50000 | Create contract fee |
Call | 500 | Call base fee |
Balance | 20 | Get balance |
Smart Contract transactions have three parameters:
- Sender: The sender of the transaction.
- Gas limit: The upper limit of gas usage. If the gas limit is reached and the transaction is not completed, the transaction will be canceled, and the changes will be reversed.
- Data: The data consists of specified parameters. Data is a hexadecimal encoding structure.
The total fee for a single contract transaction consists of three parts:
- The handling fee is calculated by transaction size. The transaction size (in bytes) is used to calculate the gas fee for every 1024 bytes 0.000001 BTC or 0.00002 ETH is charged. Plus, a smaller fee is applied for transaction sizes below 1024 bytes.
- The Smart Contract execution cost calculation. Gas is the execution cost based upon the total cost of executed statements and functions. Gas is multiplied by the Price of the execution. For BTC, the execution price is 1 SAT (1 SAT is one hundred millionth of a BTC). If there is remaining Gas, it will be refunded to the transaction.