Git Product home page Git Product logo

hydradx-node's Introduction

HydraDX node

CROSS-CHAIN LIQUIDITY PROTOCOL BUILT ON SUBSTRATE

Contributions & Code of Conduct

Please follow the contributions guidelines as outlined in docs/CONTRIBUTING.md. We are welcoming and friendly community please follow our Code of Conduct.

Local Development

Follow these steps to prepare a local Substrate development environment ๐Ÿ› ๏ธ

Simple Setup

Install all the required dependencies with a single command (be patient, this can take up to 30 minutes).

curl https://getsubstrate.io -sSf | bash -s -- --fast

Manual Setup

Find manual setup instructions at the Substrate Developer Hub.

Build

Once the development environment is set up, build the node. This command will build the Wasm and native code:

cargo build --release

Run

Local Testnet

Relay chain repository (polkadot) has to be built in ../polkadot Install polkadot-launch utility used to start network.

npm install -g polkadot-launch

Start local testnet with 4 relay chain validators and HydraDX as a parachain with 2 collators.

cd ./rococo-local
polkadot-launch config.json

Observe HydraDX logs

multitail 99*.log

Local Testnet with Zombienet

Relay chain repository (polkadot) has to be built in ../polkadot Grab zombienet utility used to start network from releases

Start local testnet with 4 relay chain validators and HydraDX as a parachain with 2 collators.

cd ./rococo-local
zombienet --provider native config-zombienet.json

Use testing runtime

In the case of starting a testnet using the polkadot-launch tool, we don't have an option to communicate to its internal commands that we would like to use the testing runtime. To overcome this limitation, rename the binary so it starts with the testing prefix, e.g. testing-hydradx. Such a binary always uses the testing runtime, even if the --runtime testing option is not specified.

Start local testnet with testing runtime

cd ./rococo-local
polkadot-launch testing-config.json

Start local testnet with testing runtime using Zombienet

cd ./rococo-local
zombienet --provider native testing-config-zombienet.json

Interaction with the node

Go to the polkadot apps at https://dotapps.io

Then open settings screen -> developer and paste

NOTE - FixedU128 type is not yet implemented for polkadot apps. Balance is a measure so price can be reasonably selected. If using polkadot apps to create pool:

  • 1 Mega Units equals 1:1 price
  • 20 Mega Units equals 20:1 price
  • 50 Kilo Units equals 0.05:1 price
{
  "types": [
    {
      "AssetPair": {
        "asset_in": "AssetId",
        "asset_out": "AssetId"
      },
      "Amount": "i128",
      "AmountOf": "Amount",
      "Address": "AccountId",
      "OrmlAccountData": {
        "free": "Balance",
        "frozen": "Balance",
        "reserved": "Balance"
      },
      "BlockNumber": "u32",
      "BalanceInfo": {
        "amount": "Balance",
        "assetId": "AssetId"
      },
      "Chain": {
        "genesisHash": "Vec<u8>",
        "lastBlockHash": "Vec<u8>"
      },
      "CurrencyId": "AssetId",
      "CurrencyIdOf": "AssetId",
      "Intention": {
        "who": "AccountId",
        "asset_sell": "AssetId",
        "asset_buy": "AssetId",
        "amount": "Balance",
        "discount": "bool",
        "sell_or_buy": "IntentionType"
      },
      "IntentionId": "Hash",
      "IntentionType": {
        "_enum": [
          "SELL",
          "BUY"
        ]
      },
      "LookupSource": "AccountId",
      "OrderedSet": "Vec<AssetId>",
      "Price": "Balance",
      "Fee": {
        "numerator": "u32",
        "denominator": "u32"
      },
      "VestingScheduleOf": {
        "start": "BlockNumber",
        "period": "BlockNumber",
        "period_count": "u32",
        "per_period": "Balance"
      }
    }
  ],
  "alias": {
    "tokens": {
      "AccountData": "OrmlAccountData"
    }
  }
}

Connect to the

  • Hacknet: wss://hack.hydradx.io:9944
  • Stakenet: wss://rpc-01.snakenet.hydradx.io
  • or local node โ€“ if you are on chromium based browser, set chrome://flags/#allow-insecure-localhost

Performance check

Prerequisites: rust/cargo, python 3.8+

With the following script it is possible to run a simple performance check. It might be useful to determine whether your machine is suitable to run HydraDX node.

From the top-level node directory:

./scripts/check_performance.sh

This will run series of benchmarks ( which may take a while). The output will show benchmark results of HydraDX pallets and comparison against reference values.

The most interesting information would be the difference between the HydraDx benchmark value and the local machine's benchmark.

If the difference is >= 0, performance is similar or better. However, if the difference < 0 - your machine might not suitable to run HydraDX node. Contact HydraDX devs to discuss the results.

Testing of storage migrations and runtime upgrades

The try-runtime tool can be used to test storage migrations and runtime upgrades against state from a real chain. Run the following command to test against the state on HydraDX

cargo run --release --features=try-runtime try-runtime --no-spec-name-check on-runtime-upgrade live --uri wss://rpc.hydradx.cloud:443

or against HydraDX testnet on Rococo

cargo run --release --features=try-runtime try-runtime --no-spec-name-check on-runtime-upgrade live --uri wss://rococo-hydradx-rpc.hydration.dev:443

Honorable contributions

@apopiak for great reviews #87 and support.

hydradx-node's People

Contributors

andresilva avatar apopiak avatar chrisk700 avatar dependabot-preview[bot] avatar dmoka avatar enthusiastmartin avatar fakirayoub avatar gflow33 avatar green-jay avatar jak-pan avatar jareknowotka avatar martinfridrich avatar mckrava avatar mrq1911 avatar pmensik avatar roborambo avatar roznovjak avatar unordered-set avatar vgantchev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.