Network fees

On Redbelly, network fees are able to be calculated ahead of runtime making them predictable in US$ terms.

The gas model ensures that a simple native transaction on Redbelly costs US$0.01. A simple native transaction on Redbelly costs 21000 gas, thus fixing the unit gas price at US$0.000000476190476190.

Note that different opcodes on the Redbelly SEVM cost different amounts of gas to execute (in line with EVM compatibility), but the unit price of gas remains fixed in US$ terms.

This means that the same transaction executed at different times may cost you different amount of native RBNT coins in fees, but the cost in US dollar terms will remain the same independent from the market price of RBNT.

This makes smart contract execution costs predictable in US$ terms ahead of runtime, because the amount of gas required to execute a smart contract function is known. As a smart contract developer, you can calculate the $US cost of deploying and running your smart contract by calculating the amount of gas your smart contract requires to deploy or execute a specific function and multiplying that amount by the unit gas price.

Price oracle

To achieve this, Redbelly implements an on chain, distributed oracle solution that feeds an accurate USD/RBNT exchange rate to the blockchain without relying on external partners and can tolerate the presence of up to t Byzantine data sources.

By having an on chain price oracle that is read by the network nodes at block execution time, the nodes are able deduct the required number of RBNT coins to meet the gas requirements of the specific opcode execution in US$ terms.

When constructing transactions, as a wallet developer for example, the price feed oracle contract and the gas fees contract need to be called. The developer will use the eth_gasEstimate and eth_gasPrice methods which will return values for how much gas units this transaction will require and the unit price of gas in gwei.

You can query the current RBNT price on chain by querying the state of the price feed oracle contract using the script provided below. The script is written in TypeScript and should run in a NodeJS environment. The script uses functions from the ethers library, so you'll need to ensure it is installed by running:

npm i ethers

You will also need to set the following environment variables:

RPC_URL

This is the RPC url of the blockchain node that will be used to fetch the RBNT price.

Environment

URL

DevNet

https://rbn-gcp-australia-southeast2-a-0-rh-v2.devnet.redbelly.network:8545

Testnet

https://governors.testnet.redbelly.network/

Mainnet

Coming soon...

Bootstrap registry contract address

This is the DevNet contract address of the registry smart contract that the script will use to fetch the price oracle contract address:

Environment

URL

DevNet

0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5

Testnet

0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5

Mainnet

Coming soon...

 

The script

import { ethers } from "ethers";

// Ethereum smart contract ABIs
const priceFeedABI = [
  {
    inputs: [],
    name: "getLatestPrice",
    outputs: [
      {
        internalType: "uint256",
        name: "",
        type: "uint256",
      },
      {
        internalType: "uint256",
        name: "",
        type: "uint256",
      },
    ],
    stateMutability: "view",
    type: "function",
  },
];

const bootstrapRegistryABI = [
  {
    inputs: [
      {
        internalType: "string",
        name: "contractName",
        type: "string",
      },
    ],
    name: "getContractAddress",
    outputs: [
      {
        internalType: "address",
        name: "",
        type: "address",
      },
    ],
    stateMutability: "view",
    type: "function",
  },
];

// Function to get the contract address from a bootstrap registry
const getGasPriceContractAddress = async (provider) => {
  const bootstrapRegistryContract = new ethers.Contract(
    process.env.BOOTSTRAP_REGISTRY_CONTRACT || "",
    bootstrapRegistryABI,
    provider
  );
  return await bootstrapRegistryContract.getContractAddress("pricefeed");
};

// Function to fetch the latest price from the smart contract
const fetchLatestPrice = async () => {
  const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
  const priceFeedContractAddr = await getGasPriceContractAddress(provider);
  const priceFeedContract = new ethers.Contract(
    priceFeedContractAddr,
    priceFeedABI,
    provider
  );

  try {
    // Returns the latest price (6 Decimal Places) and the timestamp when it was updated
    return await priceFeedContract.getLatestPrice();
  } catch (error) {
    console.error("Error calling contract function:", error);
  }
};

// Calling fetchLatestPrice and logging the result
fetchLatestPrice().then(console.log);

Transaction fee distribution

To learn more about how transaction fees are portioned and distributed based on activity, review the transaction fees distribution policy.