Files
redstone-node/docs/RUN_REDSTONE_NODE.md
2022-07-07 11:28:25 +02:00

5.5 KiB

Run node locally

Prerequisites

  • Node.js (v16 or higher) and yarn
  • Arweave wallet (> 0.1AR)

Prepare

1. Install dependencies

yarn install

2. Prepare manifest

Manifest is a public JSON file that defines the provider's obligation regarding the data that they provide. It sets fetching interval, tokens, sources and other public technical details for the provided data.

There are 2 options for loading manifest in the redstone-node:

  1. Loading from JSON file. This option is preferred for local runs and experiments
  2. Loading from SmartWeave contracts

You can use any of our ready-to-use manifests. For example:

  • main.json - 1000+ tokens, used by the main redstone provider
  • rapid.json - 10 most popular tokens, used by redstone-rapid provider
  • coingecko.json - 20 tokens, uses only coingecko fetcher

If you want to create your own manifest read this guide.

3. Prepare env variables

Env variables should be prepared following this guide

Run the node

Local run

yarn start

We recommend redirecting output to some log file(s), for example:

yarn start > my-redstone-node.logs 2> my-redstone-node.error.logs

Run in docker

You can run a local redstone-node in docker. Instead of config file you should use REDSTONE_NODE_CONFIG environment variable. The value should be stringified json and the only difference comparing to config json file arweaveKeysJWK is required instead of arweaveKeysFile read this guide

  1. Prepare your Dockerfile based on ./Dockerfile. Name it Dockerfile.my-redstone-node and place in the project root folder.

  2. Build a docker container with redstone-node

docker build -f Dockerfile.my-redstone-node -t my-redstone-node .
  1. Run the docker container
docker run -it my-redstone-node

Verify if node is running correctly

There are 2 main things that your node need to do:

1. Save prices on Arweave

To verify if prices are being saved on Arweave, navigate to https://viewblock.io/arweave/address/YOUR_ADDRESS. You should see some transactions with tag app and value Redstone ~20 minutes after the node running.

2. Broadcast signed prices to the RedStone cache layer (RedStone API)

You can simply open this URL https://api.redstone.finance/prices?provider=YOUR_ADDRESS in browser and see if it returns signed data. Don't forget to replace YOUR_ADDRESS with your Arweave wallet address 😉

Example of correct output
{
  "USDT": {
    "id": "ffdd4454-25d0-4e2a-b022-d10dba06bd66",
    "source": {
      "binanceus": 0.9998,
      "bitfinex": 1.0001,
      "bitfinex2": 1.0001,
      "bittrex": 0.99974,
      "cex": 1.0031,
      "coingecko": 1,
      "currencycom": 0.9985,
      "ftx": 1,
      "kraken": 1.0001,
      "okcoin": 1,
      "kyber": 0.9981773824698535,
      "sushiswap": 0.9999276470174321,
      "uniswap": 1.000213104216893
    },
    "symbol": "USDT",
    "timestamp": 1632229811658,
    "version": "0.4",
    "value": 1,
    "permawebTx": "_GY215TNS24PjgIzvNVyb6uGKAj7t53Q0pEzG34yotA",
    "provider": "zYqPZuALSPa_f5Agvf8g2JHv94cqMn9aBtnH7GFHbuA",
    "signature": "LONG_STRING_VALUE_WILL_BE_HERE....",
    "minutes": 10,
    "providerPublicKey": "tfkkt6lHR3lSEBNvjistpdGb8pR9UJoOVO-IuXRXD9PckAqY7TAVuDVhrcQDM56GZ_EUh6Eg_NRYd-EGW8SEQLHXtY_CM4P8563xUpw0XcZJbpOeScFcN5JdN47gq8vllOheO6-v4nRPLVabRVJqkXEqzdEwxQNYDkmPL-gxE0ziZcQRQZdJUzL5mI9DzwpPC86JBVwsBK71iuRlstABciIu8u77qyArkNu0pPig9OFQvT3Vg4OPuWXd83EhqEuN5gqVufyomkmL8X7agiEjDf-UQIfZrSYqgiJsWiVJ2aKHRhLZN17wdX51L21Cg2Sbyb3B1Roy5EgUUTdJ2MY7LnI-CTbBBJLKUHSvN67MDhj1OSBwUULc8bgVCzmfVQryIFmb4tucKvz7TRAWseXNO2MtMlggXa42Hx0sOTopbFTmT_r9glRLYw3QLzyJVH7Ltqr8QldoU-VMWtpo5cmOGh8jwVknSHqWNURbRCoDfAuwh8lpWXBjL_V8haaY0OKFT9Lpi1VW8o4Kfx7ED1VAnLcpVIoV5CkPs_L0Qy_G7XpgA02OAbJH2KvwxZPeSSymdupmr1KMc8iGz5B4a1HEcKggk5ETFfeGz5r0hDha3dwDj-dOv1jbADcdgk7e2xaLgw1CpS1XEHhAnhBJgAzJDJpcHKrxPkD6cUc7FbnsBCE"
  },
  "AR": {
    "id": "9beef2ce-278e-4edd-bde0-f06741840c91",
    "source": {
      "binance": 40.90852001974157,
      "coinex": 40.93901891635859,
      "coingecko": 41.41,
      "hitbtc": 41.83028667225191,
      "huobipro": 40.85182207094863
    },
    "symbol": "AR",
    "timestamp": 1632229811658,
    "version": "0.4",
    "value": 40.92376946805008,
    "permawebTx": "_GY215TNS24PjgIzvNVyb6uGKAj7t53Q0pEzG34yotA",
    "provider": "zYqPZuALSPa_f5Agvf8g2JHv94cqMn9aBtnH7GFHbuA",
    "signature": "LONG_STRING_VALUE_WILL_BE_HERE....",
    "minutes": 10,
    "providerPublicKey": "tfkkt6lHR3lSEBNvjistpdGb8pR9UJoOVO-IuXRXD9PckAqY7TAVuDVhrcQDM56GZ_EUh6Eg_NRYd-EGW8SEQLHXtY_CM4P8563xUpw0XcZJbpOeScFcN5JdN47gq8vllOheO6-v4nRPLVabRVJqkXEqzdEwxQNYDkmPL-gxE0ziZcQRQZdJUzL5mI9DzwpPC86JBVwsBK71iuRlstABciIu8u77qyArkNu0pPig9OFQvT3Vg4OPuWXd83EhqEuN5gqVufyomkmL8X7agiEjDf-UQIfZrSYqgiJsWiVJ2aKHRhLZN17wdX51L21Cg2Sbyb3B1Roy5EgUUTdJ2MY7LnI-CTbBBJLKUHSvN67MDhj1OSBwUULc8bgVCzmfVQryIFmb4tucKvz7TRAWseXNO2MtMlggXa42Hx0sOTopbFTmT_r9glRLYw3QLzyJVH7Ltqr8QldoU-VMWtpo5cmOGh8jwVknSHqWNURbRCoDfAuwh8lpWXBjL_V8haaY0OKFT9Lpi1VW8o4Kfx7ED1VAnLcpVIoV5CkPs_L0Qy_G7XpgA02OAbJH2KvwxZPeSSymdupmr1KMc8iGz5B4a1HEcKggk5ETFfeGz5r0hDha3dwDj-dOv1jbADcdgk7e2xaLgw1CpS1XEHhAnhBJgAzJDJpcHKrxPkD6cUc7FbnsBCE"
  }
}