-
Notifications
You must be signed in to change notification settings - Fork 157
Migration Guide #1039
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
Merged
Merged
Migration Guide #1039
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0e66877
Add migration guide for subgraphs to The Graph Network
itsjerryokolo 2ab21c7
Modify title
itsjerryokolo 75244b3
minor fixes
itsjerryokolo d168966
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo eeb74b8
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo 9b3f65d
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo f4942c2
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo 15c32a2
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo aa14a44
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo 2fa5919
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo b68183f
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo 0986c2c
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo e999df7
Update website/src/pages/en/resources/migration-guides/migrate-from-a…
itsjerryokolo b3272a7
Fix formatting
itsjerryokolo e59cf29
Update heading level for migration guide title
itsjerryokolo 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
163 changes: 163 additions & 0 deletions
163
website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| --- | ||
| title: Migrate Your Subgraph From Alchemy to The Graph Network | ||
| --- | ||
|
|
||
| ## Migrate Your Subgraph From Alchemy to The Graph Network | ||
|
|
||
| ## Goal | ||
|
|
||
| Migrate or deploy an existing Subgraph to **The Graph**. | ||
|
|
||
| ## Overview | ||
|
|
||
| This guide walks you through: | ||
|
|
||
| 1. Preparing your environment and source code | ||
| 2. Building and testing locally with **Graph Node Dev Mode (`gnd`)** | ||
| 3. Deploying to [The Graph Studio](https://thegraph.com/studio/). | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Prerequisites | ||
|
|
||
| You’ll need: | ||
|
|
||
| - Your subgraph source code (`subgraph.yaml`, `schema.graphql`, `src/mapping.ts`) | ||
| - [Node.js](https://nodejs.org), Yarn, and `graph-cli`: | ||
| ```bash | ||
| npm install -g @graphprotocol/graph-cli | ||
| ``` | ||
| - A [The Graph Studio](https://thegraph.com/studio) account and access token | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Install and Authenticate with CLI | ||
|
|
||
| Install and authenticate the CLI: | ||
|
|
||
| ```bash | ||
| npm install -g @graphprotocol/graph-cli | ||
| graph auth --studio <YOUR_ACCESS_TOKEN> | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Prepare and Build Your Subgraph | ||
|
|
||
| If you don’t already have a project, initialize one from a contract: | ||
|
|
||
| ```bash | ||
| graph init --from-contract <CONTRACT_ADDRESS> <SUBGRAPH_NAME> | ||
| ``` | ||
|
|
||
| Then build it: | ||
|
|
||
| ```bash | ||
| yarn codegen && yarn build | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Test Locally with Subgraph Dev Mode | ||
|
|
||
| `gnd` lets you run a local Graph Node instance for rapid testing—no IPFS or manual database setup required. | ||
|
|
||
| ### Install `gnd` | ||
|
|
||
| ```bash | ||
| graph node install | ||
| gnd --version | ||
| ``` | ||
|
|
||
| ### Run Locally | ||
|
|
||
| From your subgraph directory: | ||
|
|
||
| ```bash | ||
| gnd --ethereum-rpc mainnet:http://localhost:<PORT> --watch | ||
| ``` | ||
|
|
||
| Query your subgraph at:\ | ||
| `http://localhost:8000/subgraphs/name/subgraph-0/` | ||
|
|
||
| > On Windows, include a PostgreSQL connection string: | ||
| > | ||
| > ```bash | ||
| > gnd --ethereum-rpc mainnet:http://localhost:<PORT> > --postgres-url "postgresql://graph:yourpassword@localhost:5432/graph-node" | ||
| > ``` | ||
|
|
||
| **Common Flags** | Flag | Description | |------|--------------| | `--watch` | Auto-redeploy when files change | | `--postgres-url` | Required on Windows | | `--ethereum-rpc` | RPC endpoint (required) | | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Deploy to The Graph Network | ||
|
|
||
| After verifying locally, deploy your subgraph to Studio: | ||
|
|
||
| ```bash | ||
| graph deploy --studio <SUBGRAPH_SLUG> | ||
| ``` | ||
|
|
||
| This command publishes your Subgraph to The Graph Network via Studio. | ||
|
|
||
| --- | ||
|
|
||
| ## 6. Monitor and Manage Your Deployment | ||
|
|
||
| Access your Subgraph dashboard to view logs, indexing progress, and query endpoints: | ||
|
|
||
| **Dashboard:**\ | ||
| `https://thegraph.com/studio/<subgraph-name>` | ||
|
|
||
| List all Subgraph deployments: | ||
|
|
||
| ```bash | ||
| graph subgraph list | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 7. Update Your Application | ||
|
|
||
| Your subgraph’s GraphQL endpoint follows this format: | ||
|
|
||
| ``` | ||
| https://api.studio.thegraph.com/query/{user_id}/{subgraph_slug}/{version} | ||
| ``` | ||
|
|
||
| **Example:** | ||
|
|
||
| ``` | ||
| https://api.studio.thegraph.com/query/1234/my-subgraph/v1.0.0 | ||
| ``` | ||
|
|
||
| Replace your old endpoint with this one in your dApp or backend configuration. | ||
|
|
||
| --- | ||
|
|
||
| ## 8. Verify Your Deployment | ||
|
|
||
| Run a quick test query: | ||
|
|
||
| ```graphql | ||
| { | ||
| transfers(first: 5) { | ||
| id | ||
| from | ||
| to | ||
| value | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Ensure results match your expectations. | ||
|
|
||
| --- | ||
|
|
||
| ## 9. Next Steps | ||
|
|
||
| - [Monitor your subgraphs in Studio →](https://thegraph.com/studio) | ||
| - [Join The Graph community →](https://discord.gg/graphprotocol) | ||
|
|
||
| > Learn more about **Graph Node Dev Mode** →\ | ||
| > [https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/](https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/) | ||
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.