NEST-Protocol / NEST-Oracle-V3.6-minner

NEST 3.6 automatic quotation program is a sample program that can be used for secondary development based on the code logic of this program.The default values of related parameters of this program, such as block interval, quotation gasPrice multiples, and etc. are not optimal strategies, and users can adjust them according to the matter of fact.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEST 3.6 Automatic Quotation Program Operating Instructions

[toc]

Introduction

NEST 3.6 automatic quotation program is a sample program that can be used for secondary development based on the code logic of this program. Any problems encountered during development can be submitted on Github, and the developers of this program will answer them in time.

The default values of related parameters of this program, such as block interval, quotation gasPrice multiples, and etc. are not optimal strategies, and users can adjust them according to the matter of fact.

The main functions of the automatic quotation program are:

  • Check the balance of account and frozen/unfrozen assets.
  • Authorize ERC20 token.
  • Check the circulation of NTOKEN, if it exceeds 5 million, post2 quotation will be switched on.
  • Update the prices on exchange (exchanges in some region need to open the global VPN to obtain prices).
  • Initiate the quotation (including post and post2 quotations).
  • Cancel the quotation (automatically determine whether the latest quotation block number of the contract has changed, if the latest block number is bigger than the block number when you quote, then cancel the quotation to avoid being stuck in the block).
  • Unfreeze quotation assets, support single unfreezing and batch unfreezing.
  • Withdraw the unfreezing assets in the contract.
  • Re-acquire parameters in the contract.

Preparation Before Start

  1. Get ready: wallet private key and related assets, Ethereum node URL, TOKEN contract address, and corresponding trading pair on exchange.
    • Wallet private key: Generated by mnemonic, and can be registered through nestDapp.
    • assets
      Mining NEST: quotation requires to prepare at least 60.5 ETH, 30 ETH worth of TOKEN and 30 ETH worth of NTOKEN and 200,000 NEST.
      Mining NTOKEN: Post quotation requires to prepare at least 10.5 ETH, 10 ETH worth of TOKEN and 100,000 NEST,post2 quotation requires to prepare at least 20.5 ETH, 20 ETH worth of TOKEN and 20 ETH worth of NTOKEN and 200,000 NEST.;
    • Ethereum node URL.
    • TOKEN contract address: For example, if you quote ETH/USDT, you need to fill in the USDT token contract address 0xdac17f958d2ee523a2206206994597c13d831ec7
    • Exchange trading pair settings:
      Huobi Exchange trading pair query address https://api.huobi.pro/v1/common/symbols
      HBTC Exchange trading pair query address https://api.hbtc.com/openapi/v1/pairs
      MXC Exchange trading pair query address https://www.mxc.com/open/api/v2/market/symbols

Start and Close

  1. Run the quotation program:
    • go to releases to download the lastest release NEST-oracle-V3.6-miner.zip file.
    • Double-click start.bat under the route of the quotation program to run the quotation program, and a window will pop up, please do not close it. You can view log information such as quotation and unfreezing assets in the window.
  2. Log in:
    • Input http://127.0.0.1:8088/main in the browser to enter the login page with the default user name nest and password nestqwe123!.
    • If you need to modify the password, you can modify login.user.name (user name) and login.user.passwd (password) in src/main/resources/application.yml.
  3. Close the quotation program:
    • Stop mining before closing the quotation program, and then wait 10 minutes, and then close the window after the quotation asset is confirmed and unfreezed.

Related Settings

  1. Ethereum node (required):
    • The node address must be set first.
  2. Set the TOKEN address, select the price source, and fill in the TOKEN trading pair corresponding to the exchange (required):
    • If it is ETH/USDT quotation, fill in the TOKEN address with 0xdac17f958d2ee523a2206206994597c13d831ec7, you can select Huobi Exchange, and fill in the Huobi trading pair ethusdt corresponding to the transaction.
    • If it is ETH/COFI quotation, fill in the TOKEN address with 0x1a23a6BfBAdB59fa563008c0fB7cf96dfCF34Ea1, you can select Mc Exchange, and fill in the matcha trading pair COFI_USDT corresponding to the transaction.
  3. Set the NTOKEN price source and the trading pair corresponding to the exchange NTOKEN (required when the NTOKEN issuance is bigger than 5 million):
    • According to the current market situation of NTOKEN, NEST, NHBTC, and NYFI are currently listed on the exchange. You can choose different exchanges to obtain the prices:
      • To obtain the NEST price, you can select Huobi Exchange, and fill in the Huobi exchange pair nesteth corresponding to the transaction.
      • To obtain the NHBTC price, you can select Huobi Exchange, and fill in the Huobi trading pair nhbtceth corresponding to the transaction.
      • To obtain the NYFI price, you can select Hbtc Exchange, and fill in the HBTC trading pair NYFIUSDT corresponding to the transaction.
    • For other NTOKENs, you can select Fixed price, and the transaction pair can be left blank, but the fixed price must be filled in the input box below, that is, how many NTOKENs are equivalent to 1ETH.
  4. After the TOKEN and NTOKEN price sources and trading pairs are confirmed, click the confirm button. The background log will print the information of TOKEN and NTOKEN and price information on exchange. After the information are confirmed, it will continue to the follow-up operation.
  5. Set quotation private key (required):
    • Fill in the private key, the program will check the authorization, if it’s not be authorized, the program will automatically initiate an authorized transaction, please make sure that the authorized transaction is packaged successfully before making a quote.
    • TOKEN will be authorized by default. If NTOKEN issuance is bigger than 5 million, NTOKEN will be authorized simultaneously.
  6. GasPrice multiple configuration (doubled on the basis of the default gasPrice, can be adjusted according to the actual situation).
  7. Start mining:
    • After the above configuration is completed, mining can be started, and the information such as block height, the number of quotations, and the hash of the quotation transaction can be viewed in the background log.

Test Quotation

1. Comment on the transaction code of the quotation:
   // post quotation
   List<Type> typeList = Arrays.<Type>asList(
                new Address(address),
                new Uint256(ethNum),
                new Uint256(tokenAmount));
   String offerHash = ethClient.offer(POST, wallet, gasPrice, nonce, typeList, payableEthAmount);

   // post2 quotation
   List<Type> typeList = Arrays.<Type>asList(
                new Address(address),
                new Uint256(ethNum),
                new Uint256(tokenAmount),
                new Uint256(nTokenAmount));

   String offerHash = ethClient.offer(POST2, wallet, gasPrice, nonce, typeList, payableEthAmount);

2. Open http://127.0.0.1:8088/main , after relevant configuration, modify the start state.
3. Check the number of quoted ETH and quoted TOKEN or NTOKEN printed in the background window, and check the data.

About

NEST 3.6 automatic quotation program is a sample program that can be used for secondary development based on the code logic of this program.The default values of related parameters of this program, such as block interval, quotation gasPrice multiples, and etc. are not optimal strategies, and users can adjust them according to the matter of fact.


Languages

Language:Java 85.6%Language:HTML 14.4%