API to support:
- faucet
- Iron Fish Node telemetry
The API uses a queuing system (graphile-worker) to get the different faucet requests. The queue is currently only executing one job at a time.
Run dev environment and access http://localhost:8000/docs/
yarnDepends on Postgres
brew install postgresql
brew services start postgresql
createdb faucet;
psql
CREATE USER postgres;
grant all privileges on database faucet to postgres;
ALTER SCHEMA public OWNER to faucet;To start the api:
yarn
yarn devStart an Iron Fish node with
ironfish start --rpc.tcp --rpc.tcp.port=8021To start processing the queue:
yarn start:workeryarn
yarn build
yarn startThe repository is using OpenAPI 3.0
When updating or adding a new endpoint:
- Edit the openapi.yml online or offline using Swagger editor
- Save the yml file in
config/openapi.yml - Export the file in JSON and save it on
config/openapi.json - run
yarn api:types
- Download influxdb and run './influxd'
- Visit localhost:8086 and follow the setup instructions
- Suggested org name: ironfish
- Suggested initial bucket: devnet
- Hit configure later when you get to the welcome screen
- We don't need telegraf
- Visit Tokens
- or Click Data, then Tokens
- Copy your token to clipboard
- Copy the example.env file to .env and edit it with the appropriate values
- In three terminals run:
- http-api:
yarn dev - ironfish-cli:
yarn start start - ironfish-cli:
yarn start miners:start
- http-api:
- Visit Data Explorer in influxdb and explore the data
- As one example, paste this query into the Script Editor to show a simple graph:
from(bucket: "devnet") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "minedBlock") |> filter(fn: (r) => r["_field"] == "difficulty")