Visit the Umbrella Network website for more information.
Umbrella Validator fetches data from third-party data sources, agrees with other validators in the sidechain on the right values, and submits the data to the blockchain.
Hardware requirements are light. The only heavy part is you'll need a blockchain node connection. You can use a machine with as little as 10GB of storage and 2GB of RAM.
In order to run scheduler, worker and API separately you need nodejs and npm.
- node >= 16 - Install
Instructions how to run blockchain locally you can find in phoenix, you need to:
- start local blockchain node
- deploy smart contracts to local blockchain node
- get address of Chain and keys for validator
There are two docker compose file: docker-compose.yml
and docker-compose.core.yml
- docker-compose.yml: It starts mongodb, redis, schedulers, workers and api.
- docker-compose-core.yml: It starts mongodb and redis.
In the section Run Validator Fully you will need to use docker-compose.yml
.
In the section Run Validator Separately you will need to use docker-compose.core.yml
.
NOTE For docker-compose.yml
you need to replace the MONGO_URL and REDIS_URL settings to work with docker.
echo 'MONGODB_URL=mongodb://db:27017/pegasus'>> .env
echo 'REDIS_URL=redis://cache:6379' >> .env
One-line command:
cp example.env .env
docker-compose --env-file=.env build && docker-compose --env-file=.env
It is the same previous command but you can specify different envs.
One-line command:
#node 1
cp example.env .env.node1
docker-compose --env-file=.env.node1 build && docker-compose --env-file=.env.node1 up -d
#node 2
cp example.env .env.node2
docker-compose --env-file=.env.node2 build && docker-compose --env-file=.env.node2 up -d
#node 3
cp example.env .env.node3
docker-compose --env-file=.env.node3 build && docker-compose --env-file=.env.node3 up -d
Install packages.
npm install
Build
npm build
Setup a dotenv file (.env
) with local configuration values.
cp example.env .env
docker-compose -f docker-compose.core.yml up
# run with a custom env file
docker-compose --env-file=.env -f docker-compose.core.yml up
Build docker imagine using docker-compose
docker-compose -f docker-compose.core.yml up
Run worker start script, you need to inform what worker you want to start
npm run start:worker -- --worker BlockMintingWorker
# run in the debug mode
npm run start:dev:worker -- --worker BlockMintingWorker
Build docker imagine using docker-compose
docker-compose -f docker-compose.core.yml up
Run start scheduler script
npm run start:scheduler
# run in the debug mode
npm run start:dev:scheduler
Build docker imagine using docker-compose
docker-compose -f docker-compose.core.yml up
Run start API service script
npm run start
# run in the debug mode
npm run start:dev
Run feedProcessor using the feeds file in .env config. The output is the leaves
npm run task:dev:feed
Setup a testing dotenv file (.testing.env
) with local configuration values and set MONDODB_URL for use local instance.
echo 'MONGODB_URL=mongodb://localhost:27017/pegasus' > .testing.env
Build docker imagine using docker-compose
docker-compose -f docker-compose.core.yml up
In another terminal run the test script
npm run test
echo 'AWS_REPOSITORY=...' >> .env
make
Fetchers is responsible to fetch data. You can use HTTP or WS protocols.
- Add the new fetcher under
src/services/fetchers
this class must have apply method that does the fetch for a specif endpoint. Refer tosrc/services/fetchers/CryptoCompareHistoDayFetcher.ts
for more details; - Export the new fetcher at
src/services/fetchers/index.ts
; - Add the new fetcher in collection object at
src/repositories/FeedFetcherRepository.ts
, it will be used onsrc/services/FeedProcessor.ts
.
- Create a WS Client at
src/services/ws
, checksrc/services/ws/CryptoCompareWSClient.ts
to get more details; - Create a initializer at
src/services
, checksrc/services/CryptoCompareWSInitializer.ts
to get more details; - At
src/tasks.ts
start the initializer. Check howPolygonIOPriceInitializer
andCryptoCompareWSInitializer
initialize; - Add the new fetcher under
src/services/fetchers
this class must have apply method that does the fetch for a specific data source. Refer tosrc/services/fetchers/CryptoCompareHistoDayFetcher.ts
for more details; - Export the new fetcher at
src/services/fetchers/index.ts
; - Add the new fetcher in collection object at
src/repositories/FeedFetcherRepository.ts
, it will be used onsrc/services/FeedProcessor.ts
.
Calculators are responsible to receive data and return it formatted.
- Create the new calculator on
src/services/calculators
, checksrc/services/calculators/OptionsPriceCalculator.ts
to get more details; - Export the new calculator at
src/services/calculators/index.ts
; - Add the new calculator in collection object at
src/repositories/CalculatorRepository.ts
, it will be used onsrc/services/FeedProcessor.ts
.
- Add new chainId on
src/types/ChainsIds.ts
. - Add the new settings on
src/config/settings.ts
. - Create the Dispatcher class under
src/services/dispatcher/
folder (seesrc/services/dispatcher/BSCBlockDispatcher.ts
). - Add the dispatcher instance inside
this.dispatcher
in the constructor method onsrc/services/dispatcher/BlockChainDispatcher.ts
We document our API using swagger. Access http://localhost:3003/docs
after the server starts to explore the available endpoints.
See the Change Log.