Skip to content

Commit

Permalink
Merge pull request #314 from neonlabsorg/main
Browse files Browse the repository at this point in the history
Sync docs
  • Loading branch information
vodolaz authored Mar 22, 2024
2 parents 9186f2a + 7539466 commit a52d783
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 147 deletions.
81 changes: 0 additions & 81 deletions docs/developing/gasless.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/operating/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Operator keys should be spread [evenly between Proxy instances](operator-introdu

## Holder accounts

[Holder accounts](/docs/architecture/solana-accounts/#holder-accounts) are a crucial element of Neon EVM. Neon Proxy creates holder accounts with [rent-exempt balances](https://docs.solana.com/ru/developing/programming-model/accounts#rent) on start. The number of holder accounts created determines the TPS provided to users and can be configured with `PRX_PERM_ACCOUNT_LIMIT`.
[Holder accounts](/docs/architecture/solana-accounts/#holder-accounts) are a crucial element of Neon EVM. Neon Proxy creates holder accounts with [rent-exempt balances](https://solana.com/docs/core/accounts#rent) on start. The number of holder accounts created determines the TPS provided to users and can be configured with `PRX_PERM_ACCOUNT_LIMIT`.

You may retrieve a list of Neon Operator key accounts and attached holder accounts (see [**Retrieve your balance**](#query-balance) below).

Expand Down
30 changes: 15 additions & 15 deletions docs/operating/transaction-gas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ approvedBy: na
comment: todo the zero gas for testing setup (see commented out section)
---

import Formula from '../single-source-snippets/_price_formula.mdx'
import Price from '../single-source-snippets/_gas_price_calc.mdx'
import Formula from '../single-source-snippets/_price_formula.mdx';
import Price from '../single-source-snippets/_gas_price_calc.mdx';

## TL;DR

Operators:
Operators:

- [Configure the Operator fee](#gas-price-the-operator-fee)
- [Configure oracle price sources](#calculation-configuration)
Expand All @@ -26,29 +26,29 @@ Operators:

Neon Proxy enables Neon Operators to earn NEON tokens by processing transactions from Neon users.

The Neon Operator economy is based on providing a custom gas price returned by the eth_gasPrice method. The Neon Proxy calculates the gas price based on the assumption that it should cover the cost of transaction processing on the Solana cluster and include the profit of the Neon Operator. The Neon Operator should include all additional costs (such as hardware rent) plus profit in their Operator Fee.
The Neon Operator economy is based on providing a custom gas price returned by the eth_gasPrice method. The Neon Proxy calculates the gas price based on the assumption that it should cover the cost of transaction processing on the Solana cluster and include the profit of the Neon Operator. The Neon Operator should include all additional costs (such as hardware rent) plus profit in their Operator Fee.

The Neon EVM calculates gas usage by tracking the SOL spent by the Neon Operator during transaction execution. The gas price includes the ratio of NEON and SOL tokens, so the payment from the Neon User to Neon Operator covers all spent SOLs. The ultimate gas price is variable because it depends on the prices of SOL and NEON.
The Neon EVM calculates gas usage by tracking the SOL spent by the Neon Operator during transaction execution. The gas price includes the ratio of NEON and SOL tokens, so the payment from the Neon User to Neon Operator covers all spent SOLs. The ultimate gas price is variable because it depends on the prices of SOL and NEON.

### Pass on gas savings

Because the Neon EVM operates on Solana, not Ethereum, it takes advantage of Solana’s inexpensive transaction costs and favorable approach to only charge for storage allocation. This contrasts with Ethereum, where calculations require much more gas, and gas is charged for every change in data stored in Ethereum. As a result, gas usage on Solana is much cheaper than on Ethereum, and the Neon EVM passes these savings on to users.


## Gas price: the Operator fee

The Neon Proxy obtains the current prices of SOL and NEON tokens from the [pyth.network](http://pyth.network) oracles.

<Formula/>
<Formula />

> This ensures that the Neon Operator receives enough NEON to cover the transaction cost in SOL.
The Neon Operator configures the value of `PRX_OPERATOR_FEE`, where 1.0 represents 100% of the potential fee extraction. The value of this parameter is currently set to **1**.
The Neon Operator configures the value of `PRX_OPERATOR_FEE`, where 1.0 represents 100% of the potential fee extraction. The value of this parameter is currently set to **2.5**.

Parameter `PRX_GAS_PRICE_SLIPPAGE` provides a buffer against transactions getting stuck in the mempool if there is volatility in prices of $SOL and $NEON. The value of this parameter is currently set to **0.25**.

For example:
<Price/>

<Price />

Neon recommended that Neon Operators should initially set `PRX_OPERATOR_FEE` to “1.0” for Mainnet launch. This allows Operators to cover their hardware costs while transaction demands are low. As demand grows, Operators may adjust their fees in response.

Expand All @@ -59,31 +59,32 @@ Neon recommended that Neon Operators should initially set `PRX_OPERATOR_FEE` to
An Operator has two options:

- **Recommended**: set up the `PRX_MINIMAL_GAS_PRICE` to 1 as per the default value in EVMs
- Set up the `PRX_MINIMAL_GAS_PRICE` to reject low offers
- Set up the `PRX_MINIMAL_GAS_PRICE` to reject low offers

> For example, by setting the gas price minimum to 65 Galan, Neon Proxy rejects transactions with a gas price of less than 65.
## Gas price: oracle configuration
If a transaction request arrives with a gas price below that of the Operator costs + Operator fee, but with a gas price larger than the designated `PRX_MINIMAL_GAS_PRICE`, the Neon Proxy accepts the transaction into mempool.

The Neon transaction will only be executed when the gas price covers Operator costs + Operator fee. If the number of transactions in the mempool grows to the `PRX_MEMPOOL_CAPACITY` (by default =4096), Neon Proxy removes the transaction with the smallest gas price from the mempool to accept transactions with the higher gas price. Therefore, it's not critical to set the `PRX_MINIMAL_GAS_PRICE` to a small value.
If a transaction request arrives with a gas price below that of the Operator costs + Operator fee, but with a gas price larger than the designated `PRX_MINIMAL_GAS_PRICE`, the Neon Proxy accepts the transaction into mempool.

The Neon transaction will only be executed when the gas price covers Operator costs + Operator fee. If the number of transactions in the mempool grows to the `PRX_MEMPOOL_CAPACITY` (by default =4096), Neon Proxy removes the transaction with the smallest gas price from the mempool to accept transactions with the higher gas price. Therefore, it's not critical to set the `PRX_MINIMAL_GAS_PRICE` to a small value.

## Calculation configuration

The Neon Proxy has several settings that accommodate the calculation of gas-price on your required network:

- `PRX_PP_SOLANA_URL`: the HTTP/S address of the Solana node (Devnet/Mainnet) that provides the Pyth data account that supplies $NEON and $SOL prices
- `PRX_PYTH_MAPPING_ACCOUNT`: the Solana address of the Pyth mapping account; select the address on (https://pyth.network/developers/accounts) based on the type of network (Devnet/Mainnet)
- `PRX_UPDATE_PYTH_MAPPING_PERIOD_SEC`: the time period to reread the Pyth mapping account. The Neon Proxy reads the Pyth mapping account at the start, gets the addresses of $NEON and $SOL accounts, and rechecks the address from the Pyth Mapping account only after `UPDATE_PYTH_MAPPING_PERIOD_SEC`. It is recommended to set this generously (e.g. 1/3/10 hours), because the price feed accounts don’t change often.
- `PRX_MINIMAL_GAS_PRICE`: the minimum gas price to accept transactions into the mempool for on-chain execution

<!--
<!--

> Let's take a closer look at the minimum gas price variable.

## Zero gas price for testing

On Devnet test NEON is available, however, for beta Mainnet testing purposes, the Neon Proxy can be configured to accept transactions with a 0 gas price (a balance of SOL is available to cover the transaction fees on Solana).
On Devnet test NEON is available, however, for beta Mainnet testing purposes, the Neon Proxy can be configured to accept transactions with a 0 gas price (a balance of SOL is available to cover the transaction fees on Solana).

To enable this configuration, the Neon Operator should set up the following parameters:

Expand All @@ -94,4 +95,3 @@ To enable this configuration, the Neon Operator should set up the following para
As a result, the Neon Proxy returns the 0 gas price and accepts Neon transactions with the 0 gas price.

-->

22 changes: 11 additions & 11 deletions docs/single-source-snippets/_gas_price_calc.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
| Component | Value | Units/Definition | Calculation |
| ------------------------ | ------------ | ---------------- | ----------- |
| Sol | 50 | $ | |
| Neon | 0.5 | $ | |
| Ratio | | SOL:NEON | 120 |
| Galan ratio | | Ratio \*10<sup>-9</sup> | 0.00000012 |
| Operator fee ratio | 1 | | |
| Proxy Gas Price Slippage | 0.25 | | |
| Adjustor | | 1+fee+slippage | 2.09 |
| **Gas price** | **0.0000002475** | NEON | Gas price formula |
| | **247.5** | Galan |
| Component | Value | Units/Definition | Calculation |
| ------------------------ | ---------------- | ----------------------- | ----------------- |
| Sol | 125 | $ | |
| Neon | 1.5 | $ | |
| Ratio | | SOL:NEON | 83.3333 |
| Galan ratio | | Ratio \*10<sup>-9</sup> | 0.0000000833333 |
| Operator fee ratio | 2.5 | | |
| Proxy Gas Price Slippage | 0.25 | | |
| Adjustor | | 1+fee+slippage | 3.75 |
| **Gas price** | **0.0000003125** | NEON | Gas price formula |
| | **312.5** | Galan |
10 changes: 5 additions & 5 deletions docs/tokens/gas_fees.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ proofedDate: 20231204
iterationBy: na
includedInSite: true
approvedBy: na
comment: Calc sheet https://docs.google.com/spreadsheets/d/1g2ms3DveyPgrG0Gf6cSwq6xhT0AgrrRus_pa9ICHP4w/edit?usp=sharing
comment: Calc sheet https://docs.google.com/spreadsheets/d/1g2ms3DveyPgrG0Gf6cSwq6xhT0AgrrRus_pa9ICHP4w/edit?usp=sharing
---

import Formula from '../single-source-snippets/_price_formula.mdx'
Expand All @@ -24,7 +24,7 @@ The NEON token is used to pay the “gas fees” required for transaction execut

:::info
Neon EVM will soon support fee payment in the same token as the transaction token for supported tokens e.g. SOL and USDC.
:::
:::

> `Gas Fee` = `Gas amount` \* `Gas price`
>
Expand Down Expand Up @@ -85,11 +85,11 @@ The Gas amount is calculated with N=1 iterations and S=0 storage costs:

### Example 2: create a new account
Within [Solana](https://docs.solana.com/storage_rent_economics), the rental cost for storage can be paid via one of two methods:
1. Set it and forget it.
1. Set it and forget it.

> With this approach, accounts with two years' worth of rent deposited are exempt from network rent charges. By maintaining this minimum balance, the broader network benefits from reduced liquidity and the account holder can rest assured that their data is retained for continual access and usage.
2. Pay per byte.
2. Pay per byte.

> The network can charge rent on a per-epoch basis, in credit for the next epoch. This rent is deducted at a rate specified in genesis, in Lamports per Kilobyte-year.
Expand Down Expand Up @@ -119,4 +119,4 @@ To simplify the user experience, Neon takes option 1 and charges two years' wort

## What next?

If you want to get your dApp started on Neon EVM, you may be wondering how you pay for the first transactions that are required to buy the NEON required to cover gas costs. This is where our starter pack of [gasless transactions](/docs/developing/gasless) comes in. Furthermore, our "coming soon" feature will allow users to pay fees in [alternative tokens](https://neonevm.org/blog/feature-alternative-gas-fee-token).
If you want to get your dApp started on Neon EVM, you may be wondering how you pay for the first transactions that are required to buy the NEON required to cover gas costs. This is where our starter pack of gasless transactions comes in. Furthermore, our "coming soon" feature will allow users to pay fees in [alternative tokens](https://neonevm.org/blog/feature-alternative-gas-fee-token).
39 changes: 6 additions & 33 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ const sidebars = {
{
type: 'category',
label: '🧬 Neon EVM Overview',
items:
[
'about/why_neon',
'about/neon_ecosystem',
'about/how_it_works'
]
items: ['about/why_neon', 'about/neon_ecosystem', 'about/how_it_works']
},
{
type: 'doc',
Expand All @@ -32,20 +27,13 @@ const sidebars = {
{
type: 'category',
label: '💰 Tokens',
items: [
'tokens/neon_token',
'tokens/gas_fees',
'tokens/token_list'
]
items: ['tokens/neon_token', 'tokens/gas_fees', 'tokens/token_list']
},
{ type: 'doc', label: 'Neon Proxy API', id: 'api/neon-api' },
{
type: 'category',
label: '💬 FAQ',
items: [
'faq/neon-brief-faq',
'faq/neonpass'
]
items: ['faq/neon-brief-faq', 'faq/neonpass']
},
{ type: 'html', value: '<div class="sidebar-menu-divider"/>' },
{ type: 'html', value: '<h4 class="sidebar-menu-title">Tools</h4>' },
Expand All @@ -69,11 +57,6 @@ const sidebars = {
label: 'Request Test Tokens',
id: 'developing/utilities/faucet'
},
{
type: 'doc',
label: 'Gasless transactions',
id: 'developing/gasless'
},
{
type: 'category',
label: 'Use Tokens',
Expand Down Expand Up @@ -143,9 +126,7 @@ const sidebars = {
{
type: 'category',
label: 'Token Accounts',
items: [
'tokens/token-accounts'
]
items: ['tokens/token-accounts']
},
{ type: 'html', value: '<div class="sidebar-menu-divider"/>' },
{ type: 'html', value: '<h4 class="sidebar-menu-title">Operate</h4>' },
Expand All @@ -157,20 +138,12 @@ const sidebars = {
{
type: 'category',
label: 'Run Neon Proxy',
items: [
'operating/basic',
'operating/enhanced',
'operating/installation/setup_kubernetes'
]
items: ['operating/basic', 'operating/enhanced', 'operating/installation/setup_kubernetes']
},
{
type: 'category',
label: 'Configuration',
items: [
'operating/transaction-gas',
'operating/accounts',
'operating/configuration'
]
items: ['operating/transaction-gas', 'operating/accounts', 'operating/configuration']
},
{ type: 'html', value: '<div class="sidebar-menu-divider"/>' },
{ type: 'html', value: '<h4 class="sidebar-menu-title">Govern</h4>' },
Expand Down
2 changes: 1 addition & 1 deletion src/components/NeonEcosystemView/proxy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function Proxy(props: { changeState: Dispatch<any>, theme: 'dark' | 'ligh
<circle cx="1259" cy="390" r="15" stroke={linkColor} strokeWidth="2"/>
</g>
</a>
<a href="/docs/tokens/gas_fees">
<a href="/docs/tokens/gas_fees.mdx">
<text fill={linkColor} fontFamily="Inter" fontSize="25" letterSpacing="-0.514979px" textDecoration="underline"><tspan x="1491.85" y="398.091">gas fees</tspan></text>
<g>
<path d="M1602.6 382.8H1616.2V396.4" stroke={linkColor} strokeWidth="2" strokeMiterlimit="10" strokeLinecap="round"/>
Expand Down

0 comments on commit a52d783

Please sign in to comment.