-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update readme for dufour channels #360
Open
QYuQianchen
wants to merge
1
commit into
main
Choose a base branch
from
q/update-readme-channels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,34 @@ | ||
# Subgraph for HoprChannels | ||
|
||
This subgraph gets updated to index the latest production HOPR network. | ||
Currently it's deployed for "Dufour" network. | ||
|
||
## How to run | ||
## Development | ||
1. Install | ||
|
||
Here's the _tl;dr_ version: | ||
|
||
```bash | ||
// Using hoprnet/hoprnet | ||
$ yarn run:network | ||
// Inside this repo | ||
$ pbpaste | xargs -I {} echo "ETHEREUM_NETWORK=localhost\nETHEREUM_ENDPOINT={}" > .env | ||
$ yarn prepare-local | ||
$ yarn codegen | ||
$ yarn pre-build | ||
$ yarn build | ||
$ docker-compose up | ||
$ yarn create-local | ||
$ yarn deploy-local | ||
// Back to hoprnet/hoprnet | ||
$ DEBUG=hopr* yarn run:hoprd:alice | ||
$ yarn run:faucet:alice | ||
```sh | ||
yarn install && yarn codegen | ||
export DUFOUR_SUBGRAPH_NAME=hopr-channels | ||
``` | ||
### 1. Run local network | ||
First, make sure you are running [hoprnet/hoprnet](https://github.com/hoprnet/hoprnet) | ||
local network via `yarn run:network`. Update your `.env` with your network address, | ||
likely `http://localhost:8545` within your workstation, or a public URL like | ||
`https://8545-amber-cod-wcakvqd8.ws-eu11.gitpod.io/` if you are using Gitpod. | ||
|
||
### 2. Update graph configuration for local use | ||
|
||
Run `yarn prepare-local` so your `subgraph.yaml` is automatically generated for local | ||
use with the adequate configuration. | ||
|
||
### 3. Generate the graph web assembly code | ||
|
||
Run `yarn codegen` which will parse your `subgraph.yaml` file | ||
into types ready to be imported for your `mappings.ts`. You | ||
are now ready to modify your `mappings.ts` as needed based on | ||
the handlers you described previously in your graph. | ||
|
||
### 4. Build your project mappings into wasm | ||
|
||
Run `yarn build`, which will compile everything for the | ||
`graph-node` to use in `wasm` format. Any AssemblyScript | ||
errors will be shown there. | ||
|
||
### 5. Start Subgraph node via docker-compose | ||
2. Create a project in Subgraph studio, if not done | ||
|
||
Since a subgraph relies on an IPFS daemon and a PostgreSQL database to run, we | ||
will now run `docker-compose up` to kickstart the adequate services. This data | ||
will be stored locally under your `./data` folder. | ||
|
||
If you find any errors, you can always `rm -rf data` to restart the bootstrap | ||
process and interact with the ethereum network. This is likely in the case of | ||
long running nodes. | ||
|
||
### 6. Create subgraph configuration in local node | ||
|
||
Run `yarn create-local` to deploy your subgraph configuration to the local | ||
graph node, which should be shown in your logs. | ||
|
||
### 7. Deploy your subgraph configuraiton | ||
```sh | ||
npx graph init --studio $DUFOUR_SUBGRAPH_NAME | ||
npx graph auth --studio | ||
``` | ||
|
||
Run `yarn deploy-local` to deploy your actual subgraph mappings code to the | ||
local graph node, which will start fetching events from your network. You will | ||
see a URL available under `${url}/subgraphs/name/hoprnet/hopr-channels/graphql` | ||
3. Build the subgraph | ||
```sh | ||
yarn build | ||
``` | ||
|
||
### 8. Interact with your network to allow event fetching | ||
4. Deploy to Subgraph Studio | ||
```sh | ||
npx graph deploy --studio $DUFOUR_SUBGRAPH_NAME | ||
``` | ||
|
||
From the `hoprnet/hoprnet` project, start running nodes in the network to see | ||
events showing up in your query indexer. Go to your GraphQLi instance to start | ||
interacting with your GraphQL endpoint via queries. | ||
## Deployment | ||
- Deployment ID: QmNSBAgoudxv5Qk9Yj16yz9U8MPbiSTUfjQi4njAuNksBu | ||
- Query: https://gateway.thegraph.com/api/[api-key]/subgraphs/id/Feg6Jero3aQzesVYuqk253NNLyNAZZppbDPKFYEGJ1Hj | ||
- Explorer: https://thegraph.com/explorer/subgraphs/Feg6Jero3aQzesVYuqk253NNLyNAZZppbDPKFYEGJ1Hj?view=Overview&chain=mainnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there already a subgraph called "hopr-channels" that is deployed ?