This package contains the source code for the Livepeer Subgraph, a project for indexing and querying Livepeer data from the Ethereum blockchain using The Graph.
$ yarn
$ yarn prepare:arbitrum-one
The first command installs all external dependencies, while the latter generates
the subgraph.yaml
file, which is required by The Graph.
We use Handlebars to compile a
template subgraph and add the parameters specific to
each network (arbitrum-one and arbitrum-goerli). The network can be changed via the
NETWORK_NAME
environment variable or directly by choosing a different
"prepare" script. See package.json for all options.
Follow the instructions documented here.
- Install Docker and Docker Compose
- In the root of this project run
docker-compose up
. This command will look for thedocker-compose.yml
file and automatically provision a server with rust, postgres, and ipfs, and spin up a graph node with a GraphiQL interface athttp://127.0.0.1:8000/
. - Run
yarn create:local
to create the subgraph - Run
yarn deploy:local
to deploy it
After downloading the latest blocks from Ethereum, you should begin to see Livepeer smart contract events flying in. Open a GraphiQL browser at localhost:8000 to query the Graph Node.
We rely on Docker Compose to test the subgraph against our contracts. To run the tests, use one of the following methods.
This will use the dependencies in Docker and run the tests locally in Hardhat. This is the recommended flow for developing tests.
yarn start # in first terminal
In another terminal window, create the subgraph and deploy it, then run tests against it:
yarn create:local
yarn deploy:local
yarn test:development
This will build the latest tests into a Dockerfile and run them against the subgraph in Docker.
yarn test
To deploy the Livepeer subgraph on mainnet, make changes to l1-mainnet
.
Changes to this branch will automatically deploy to the L1 subgraph.