Module 2: nToken oracle1. How to open an ERC20 Token/ETH price oracle?
The nToken oracle is an open system. Any wallet address or smart contract address can create a new ERC20 Token/ETH price oracle through the nToken auction contract. Each ERC20 Token/ETH price oracle can only be created once, and the oracle that has been created cannot be created again.
nToken oracle creation process:
Deploy nToken oracle through NEST DAPP to create a contract. After successful deployment, enter the oracle auction process. The auction period is 5 days and the starting amount is 100,000 NEST.
1) During the auction period, anyone who can participate in the auction with a minimum bid span of 10,000 NEST;
2) After the auction period ends, the oracle enters the activation process; after activation, the initial deployment of the oracle is completed;
3) At the same time when the oracle machine is activated, the final NEST bidding funds will be smashed into the address 0x0000...0001 for permanent destruction;
4.) If there is a prophecy machine that ends the auction within the income distribution period of the NEST system, the activation is unexecutable and it can only be activated after the end of the collection period.
Bidding incentives: 50% of the bid difference nToken oracle initialization:
1) Deploy nToken token contract
2) Add a new oracle quote trading pair
Rights of successful bidders: 5% will be allocated when each nToken mining is released
2. nToken prediction machine quote mechanism
The core of nToken is: Quote mining (incentive), verification cycle period, price chain, beta coefficient. Take the price of HBTC/ETH as an example:
1) Any participant can pass the price that he recognized to the quotation contract, such as 1 HBTC = 40ETH, and then enter these two assets into the quotation contract according to the price ratio, generally the scale of 10-100 ETH, the quotation The handling fee is 1% of the quotation scale of ETH. Mining for quotation will get nHBTC incentives.
2) After entering the asset, wait for T0 time (currently 25 blocks, about 5 minutes). During this time period, anyone can use the price of the bidder to buy ETH or HBTC. If there is no transaction in T0, then The quotation is accepted by the system; if the transaction is completed then the price is invalid, and part of the transaction is partially invalid. After this time, the assets can be recovered.
3) If someone is willing to make a deal with the bidder, then at the same time when he deals, he must also report a new price according to the above standard, so that p1, p2 ... price chain is formed after the initial quote P0.
4) The quote size of the trader is an integer multiple of his transaction scale, where beta> 1 (currently beta=2), which means that the price chain will eventually terminate (downtime) with the expansion of the scale, and the evildoer The cost has increased geometrically, thus countering the attack.
5) The value of nToken: The downstream users of nToken oracles need to pay the ETH fee every time they call the price data of the oracles, and holding nHBTC can get the distribution of ETH income from these systems.
Price deviation defense mechanism: If this quote deviates more than 10% from the last valid quote, the scale of this quote is 10 ETH * 10 (the scale is expanded by 10 times)
3. nToken quote verification mechanism
Anyone can become a verifier, verify the price of the quoted miner's quotation, if there is a deviation between a single quotation and the market price, and there is a certain arbitrage space, then the verifier can taker arbitrage.
The specific verification rules are as follows:
1) The minimum number of validator orders is X * 10 ETH, where X must be an integer;
2) The validator needs to submit a new quotation at the same time as the order is received. The size of the new quotation is required to be beta times the size of the order. The current beta=2; (Note: If the new quotation of the verifier is The previous effective quotation has more than 10% of the price deviation, so the new quotation will be x 10 times)
3) New quotes initiated by nToken validators do not participate in nToken mining;
4) The validator needs to pay a transaction fee of 0.1% of the ETH amount for the order while paying the order;
4. How does nToken miners quote mining?
Suppose the price of HBTC/ETH at this time is: 1 HBTC = 40 ETH;
Step 1: nToken quote miners need to deploy a quote contract of HBTC oracle, and transfer 10 ETH and 0.25 HBTC assets to the quote contract at the same time; (Remarks: 10 ETH is the minimum quote size)
Step 2: When the quotation contract is successfully deployed, it will take effect on the chain immediately. Any third-party verifier can transfer 10 ETH for 0.25 HBTC, or 0.25 HBTC for 10 ETH; if it is traded, it means there is arbitrage space between this single quote and the market price; because it can represent the market The fair price quotation will not be executed under normal circumstances, the transaction needs to pay 0.1% of the transaction fee, and the trader needs to initiate a new quotation and the quotation size x 2 times;
Step 3: If the quotation is not completed within 25 Ethereum block time (about 5 minutes), then the quotation data of this order will be hired by the oracle system to participate in the oracle price formation; Otherwise, if the quotation The single-verified person's complete transaction means that the quotation data cannot represent the fair market price, and will be discarded by the system without participating in the formation of the oracle price. Regardless of whether the transaction is completed or not, after 5 minutes of life cycle, the quoted miner can retrieve the quoted asset from the contract, and also get the nToken mining reward for the next quote.
The above is the quotation process of NEST predictor.
nToken mining cost: 1% of ETH quoted scale + gas fee nToken mining release rules:
1) There is no upper limit on the total amount of nToken;
2) The Ethereum block number of the nToken oracle when it is activated is the initial output block, and the initial output of nToken for each block is 4;
3) Decrease every 2.4 million blocks (about 1 year), the nToken output of each block successively decay to 80% of the original, and stop declining when the number of nTokens produced in a single block is 0.4;
4) The nToken mining allocation for each quote is: nToken miner: 95%
Auction winner: 5%
Calculation of mining output per quote:
Firstly, calculate the number of nToken mining rewards M contained in the block of the packaged quote transaction. If the height difference between the block and the previous block containing the quote transaction is K, then:
M=K*4
This means that if there is no quotation mining order for a period of time, the first new mining will get all nToken rewards that have not been mined before. In this way, miners can be incentivized to conduct continuous quotation mining and maintain the stability and security of the nToken oracle network.
Assuming that the sum of quotation fees in this block is E, and the fee paid for a certain quotation is e, then the number of nToken mining for this quotation is n:
n = (e / E) * M
Let me introduce you to the NEST predictor quote tool:
Mobile: NEST DAPP (NEST quotation must-have APP)
NEST DAPP Android version download address:
https://nestdapp.io/download/nest.html (browser opens)
NEST DAPP iOS version download address: Open the App Store, log in to AppleID account, search: NEST DAPP
NEST DAPP website:
https://nestdapp.io/The funds required to participate in NEST oracle quote mining: 10 ETH + Token assets worth 10
ETH.
5. How do nToken validators taker arbitrage?
If a quoted miner reports a quote that deviates from the market price, then the verifier can take arbitrage.
Suppose that the fund size of the quotation is: 10 ETH + 0.5 HBTC, the ETH price is 0.05 HBTC At this moment, the ETH market price is: 1 ETH = 0.025 HBTC;
Then, the arbitrage opportunity appears, the verifier operates:
Step 1: The verifier can transfer 10 ETH to the quotation contract and exchange it for 0.5 HBTC; Step 2: The verifier wants to report a new price, assuming 10 ETH + 0.25 HBTC;
Step 3: The validator sells 0.5 HBTC in the market to obtain 20 ETH, and the final profit is 10 ETH.
6. How do DEFI developers transfer nToken predictor price data?
NEST predictor price transfer developer documentation:
https://www.nestfans.com/wiki/nest_dev7. Charging rules for transfering nToken predictor price data nToken prediction machine charging rules:
1) Single call price of each block 0.0001 ETH
2) The minimum payment fee for a single transfer is 0.001 ETH 3) The maximum payment fee for a single transfer is 0.01 ETH nToken oracle transfer ETH income distribution rules:
1) Quote miner: 20% (multiple quotes in the same block price, assigned to the last quote address)
2) nToken revenue pool: 80% (distributed by nToken holders)