diff --git a/fern/api-reference/alchemy-rollups/customizations-integrations.mdx b/fern/api-reference/alchemy-rollups/customizations-integrations.mdx index 6457ec503..5f4b30580 100644 --- a/fern/api-reference/alchemy-rollups/customizations-integrations.mdx +++ b/fern/api-reference/alchemy-rollups/customizations-integrations.mdx @@ -55,12 +55,6 @@ Leverage our full suite of developer tools—the same ones powering leading plat * **Optimized Throughput:** Ensures transactions are processed quickly by mitigating gas fee spikes. * **Enhanced User Experience:** Reduces friction, making it easier for users to engage with your dApp. -### Subgraphs - -* **Effortless Indexing:** Deploy custom GraphQL APIs for fast, reliable on-chain data indexing. -* **Real-Time Data Access:** Provides speedy querying of your blockchain data. -* **Customizable APIs:** Tailor the subgraph to suit your application’s specific data requirements. - *** # 3. Partner Marketplace diff --git a/fern/api-reference/data/blockchain-data-at-scale.mdx b/fern/api-reference/data/blockchain-data-at-scale.mdx index 1ac0d28d2..46d81d1ed 100644 --- a/fern/api-reference/data/blockchain-data-at-scale.mdx +++ b/fern/api-reference/data/blockchain-data-at-scale.mdx @@ -22,12 +22,3 @@ Use Webhooks to build fast and reliable push notifications, create alerts on any | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ![Image 1](https://alchemyapi-res.cloudinary.com/image/upload/v1764179968/docs/api-reference/data/fccfc148ba4f51a0b70f29f752b6f34eef7393448ef6b8b34ec3ff12837f2119-Screenshot_2025-02-24_at_4.35.05_PM.png) | ![Image 2](https://alchemyapi-res.cloudinary.com/image/upload/v1764179968/docs/api-reference/data/b32f4f59ad4bf5e861689427cf49d9aa4fcd0f4f1e769fea4b347706e70d2296-Screenshot_2025-02-24_at_4.34.52_PM.png) | | **Ideal for:** Push notifications, wallets, consumer facing apps

**How it works:** Define your Webhook and start receiving relevant events | **Ideal for:** Infinite customization, specific data needs, multi-chain apps

**How it works:** Customize your event to your exact needs and immediately receive them. | - -## Ship lightning fast with Subgraphs - -Leverage Alchemy Subgraphs to ship features as soon as possible, simplify your infrastructure, and not worry about scaling. - -| [**Subgraphs**](/reference/subgraphs-quickstart) | [**Community**](/reference/community-subgraphs) | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| ![Image 1](https://alchemyapi-res.cloudinary.com/image/upload/v1764179969/docs/api-reference/data/d7fe7e657ef8b453c07750404e425ebf5588d17cd6f75f390bb6754b01f47849-Screenshot_2025-02-24_at_4.36.12_PM.png) | ![Image 2](https://alchemyapi-res.cloudinary.com/image/upload/v1764179970/docs/api-reference/data/14d450a6a4cc9eecdd5ca4066a4b66570ac9e76ea0ca834c43e8351d2f20e9a4-Screenshot_2025-02-24_at_4.36.52_PM.png) | -| **Ideal for:** Scaling existing Subgraphs, moving quickly with Subgraph indexing

**How it works:** Define your Subgraph, let Alchemy handle the infra, and query via GraphQL | **Ideal for:** Immediate data querying, common use-cases

**How it works:** Select a community Subgraph and immediately start querying via GraphQL. | diff --git a/fern/api-reference/data/subgraphs/community-subgraphs.mdx b/fern/api-reference/data/subgraphs/community-subgraphs.mdx deleted file mode 100644 index 769e4827a..000000000 --- a/fern/api-reference/data/subgraphs/community-subgraphs.mdx +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Community subgraphs -description: Query popular subgraphs managed by Alchemy -subtitle: Query popular subgraphs managed by Alchemy -slug: reference/community-subgraphs ---- - -Community subgraphs are subgraphs managed by Alchemy. These subgraphs provide APIs for popular protocols such as Compound and protocol-agnostic APIs such as token ownership. Anyone with an Alchemy account can query them without writing or deploying subgraphs. - -# Querying community subgraphs - -Community subgraphs can be activated for querying from the subgraph dashboard. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179973/docs/api-reference/data/subgraphs/41e6aeb-Screen_Shot_2023-12-06_at_3.38.04_PM.png) - -Browse any available subgraph, test queries on it a dedicated playground, and activate it to add the subgraph to your dashboard. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179974/docs/api-reference/data/subgraphs/902d91d-Screenshot_2023-12-06_at_11.20.57_AM.png) - -Community subgraphs are available for querying as soon as they’re activated. Each has its own dedicated page in your dashboard, just like subgraphs you deploy yourself. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179974/docs/api-reference/data/subgraphs/51bdad0-https://alchemyapi-res.cloudinary.com/image/upload/v1764180164/docs/tutorials/alchemy-university/ethereum-basics/Untitled_1.png) - -# Versioning & updates - -Alchemy may deploy multiple versions for some Community subgraphs over time to keep them up to date and fix any bugs. **We always recommend querying the live version endpoint for these subgraphs** — this is the most up-to-date version endorsed by our team. - -For backwards compatibility, any updates that involve breaking schema changes will be represented as an entirely new subgraph rather than a new version. - -# Request new community subgraphs - -If there's a popular subgraph you or other projects may be interested in querying, please drop a suggestion [here](https://alchemyapi.typeform.com/to/iKz79hB2). - -# Billing - -Activated community subgraphs will not count towards stored entities, updated entities, deployments, or subgraphs. - -\*\*Only queries made to Community subgraphs will count towards billing. - -# Managed by Alchemy - -Alchemy is responsible for ensuring these subgraphs stay syncing and have correct data. - -However, since these subgraphs are not written by Alchemy, they may have occasionally have bugs. **Our team will monitor for these issues and attempt to fix them, but if you discover a bug please reach out to our team at !** diff --git a/fern/api-reference/data/subgraphs/developing-a-subgraph/creating-a-subgraph.mdx b/fern/api-reference/data/subgraphs/developing-a-subgraph/creating-a-subgraph.mdx deleted file mode 100644 index 83a170d38..000000000 --- a/fern/api-reference/data/subgraphs/developing-a-subgraph/creating-a-subgraph.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Creating a Subgraph -description: Create your subgraph from scratch or an existing contract. -subtitle: Create your subgraph from scratch or an existing contract. -slug: reference/creating-a-subgraph ---- - - - If you already have a subgraph and are looking to deploy it on Alchemy - Subgraphs, see [Deploying a Subgraph](/reference/deploying-a-subgraph). - - -# From Scratch - -To create a subgraph from scratch: - -`shell shell graph init --product hosted-service ` - -# From an Existing Contract - -To create a subgraph that indexes all events of an existing contract: - - - ```shell shell - graph init \ - --product hosted-service - --from-contract \ - [--network ] \ - [--abi ] \ - - ``` - - -The ABI will be fetched from Etherscan. If it can't be found, the `--abi` file will need to be specified. - -# From an Example Subgraph - -Alchemy Subgraphs has several example subgraphs for you to instantly deploy. See [your dashboard](https://dashboard.alchemy.com/signup) to get started. diff --git a/fern/api-reference/data/subgraphs/developing-a-subgraph/data-sources.mdx b/fern/api-reference/data/subgraphs/developing-a-subgraph/data-sources.mdx deleted file mode 100644 index f8544c402..000000000 --- a/fern/api-reference/data/subgraphs/developing-a-subgraph/data-sources.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Data Sources -description: Define your input data sources from on-chain smart contracts. -subtitle: Define your input data sources from on-chain smart contracts. -slug: reference/data-sources ---- - -# Overview - -Each "data source" within a subgraph manifest corresponds to an Ethereum contract on a specific network. - -For example, the following data source pulls Compound v3 data for the USDC deployment: - -```shell -specVersion: 0.0.5 -schema: - file: ./schema.graphql -dataSources: - - kind: ethereum - name: Comet - network: mainnet - source: - address: "0xc3d688B66703497DAA19211EEdff47f25384cdc3" - abi: Comet - startBlock: 15331586 - mapping: - ... -``` - -See [full specification](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md#15-data-source) for more details. - -# Adding a Data Source - -To add a new data source to an existing subgraph, you can use the `graph add` CLI command: - -```shell -graph add
[] - -Options: - - --abi Path to the contract ABI (default: download from Etherscan) - --contract-name Name of the contract (default: Contract) - --merge-entities Whether to merge entities with the same name (default: false) - --network-file Networks config file path (default: "./networks.json") -``` - -# Proxy Contracts - -EVM protocols often use a **proxy contract** that points to an **implementation contract** for the sake of upgradeability. - -Event log and transaction data is associated with the **proxy contract** address, but need to be decoded using the **implementation contract** ABI. Because of this, you'll likely need to download the **implementation contract** ABI and associate it with the **proxy contract** address in your data source. - -# Factory Contracts - -Another common pattern is to use factory or registry contracts that create and manage other smart contracts. - -In order to handle sub-contracts that are dynamically created, you'll need to use [Data Source Templates](https://thegraph.com/docs/en/developing/creating-a-subgraph/#data-source-templates). diff --git a/fern/api-reference/data/subgraphs/developing-a-subgraph/developing-a-subgraph.mdx b/fern/api-reference/data/subgraphs/developing-a-subgraph/developing-a-subgraph.mdx deleted file mode 100644 index 28bfa9241..000000000 --- a/fern/api-reference/data/subgraphs/developing-a-subgraph/developing-a-subgraph.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Developing a Subgraph -description: Learn how to create a subgraph and write your GraphQL Schema, handlers, and subgraph manifest. -subtitle: Learn how to create a subgraph and write your GraphQL Schema, handlers, and subgraph manifest. -slug: reference/developing-a-subgraph ---- - -Every subgraph is a collection of GraphQL, AssemblyScript / Typescript, and YAML code that follows the same structure. Go through the following guides to learn how to create your subgraph and iterate on the code: - -| Page | Description | -| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| [Graph CLI](/reference/graph-cli) | Learn how to work with the open-source `graph-cli` package. | -| [Creating a Subgraph](/reference/creating-a-subgraph) | Create your subgraph from scratch or an existing contract. | -| [Project Structure](/reference/project-structure) | Understand the project structure of a subgraph and important files (schema.graphql, subgraph.yaml). | -| [Data Sources](/reference/data-sources) | Define your input data sources from on-chain smart contracts. | -| [Writing Mappings](/reference/writing-mappings) | Write AssemblyScript mappings for transforming input data into your GraphQL API. | diff --git a/fern/api-reference/data/subgraphs/developing-a-subgraph/graph-cli.mdx b/fern/api-reference/data/subgraphs/developing-a-subgraph/graph-cli.mdx deleted file mode 100644 index 327b51080..000000000 --- a/fern/api-reference/data/subgraphs/developing-a-subgraph/graph-cli.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Graph CLI -description: Learn how to work with the open-source graph-cli package. -subtitle: Learn how to work with the open-source graph-cli package. -slug: reference/graph-cli ---- - -Learn how to work with the open-source `graph-cli` package. - -The `graph-cli` package contains commands that help you create, develop, and publish your subgraph. - -# Installation - - - ```shell shell - # NPM - npm install -g @graphprotocol/graph-cli - - - # Yarn - yarn global add @graphprotocol/graph-cli - - ``` - - -# Version - -Please note that CLI versions after `0.73.0` may introduce a "hosted service is deprecated" error — this is an automatic message and does not apply to Alchemy Subgraphs. If you see this error please downgrade to `0.73.0` or earlier. Contact support with any questions! - -# Commands - -| Command | Description | -| --------------- | ------------------------------------------------------------------------------------- | -| `graph init` | Creates a new subgraph project | -| `graph codegen` | Generates AssemblyScript types for smart contract ABIs and the subgraph schema | -| `graph deploy` | Deploys a subgraph (See [Deploying a Subgraph](/reference/deploying-a-subgraph)) | -| `graph add` | Adds a new datasource to the yaml file and updates schema.graphql, abis, and mappings | -| `graph test` | Runs unit tests with [Matchstick](https://github.com/LimeChain/matchstick) | - -See [full specification](https://github.com/graphprotocol/graph-tooling/tree/main/packages/cli) for additional commands and details. diff --git a/fern/api-reference/data/subgraphs/developing-a-subgraph/project-structure.mdx b/fern/api-reference/data/subgraphs/developing-a-subgraph/project-structure.mdx deleted file mode 100644 index e99774e0b..000000000 --- a/fern/api-reference/data/subgraphs/developing-a-subgraph/project-structure.mdx +++ /dev/null @@ -1,217 +0,0 @@ ---- -title: Project Structure -description: Understand the project structure of a subgraph and important files (schema.graphql, subgraph.yaml). -subtitle: Understand the project structure of a subgraph and important files (schema.graphql, subgraph.yaml). -slug: reference/project-structure ---- - -# Overview - -## Top-level folders - -| Name | Description | -| ---------- | --------------------------------------------------------------------------- | -| abis/ | Used for .json ABI files. | -| build/ | Built assets that are uploaded to IPFS upon deploy | -| generated/ | Generated AssemblyScript types after running `graph codegen`. Do not edit! | -| src/ | AssemblyScript handlers and helpers for processing data | -| tests/ | Unit tests powered by [Matchstick](https://github.com/LimeChain/matchstick) | - -## Top-level files - -| Name | Description | -| -------------- | --------------------------------------------------------------------------------------------------------- | -| networks.json | Chain-specific metadata (i.e. contract addresses, start blocks). Use with `graph build` or `graph deploy` | -| schema.graphql | Schema for your GraphQL API | -| subgraph.yaml | YAML file for all subgraph metadata (i.e. input data sources, triggers, handlers) | - -# Subgraph Manifest (subgraph.yaml) - -The subgraph.yaml file serves as the blueprint for your subgraph. It outlines the input data sources, triggers you'd like to handle, and the handlers that should respond to triggers. By configuring the subgraph.yaml file, you provide all the necessary instructions for Alchemy Subgraphs to index and serve your GraphQL API. - -See the [full specification here](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md). - - - ```yaml subgraph.yaml - specVersion: 0.0.5 - schema: - file: ./schema.graphql - dataSources: - - kind: ethereum - name: Comet - network: mainnet - source: - address: "0xc3d688B66703497DAA19211EEdff47f25384cdc3" - abi: Comet - startBlock: 15331586 - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - entities: - - AbsorbCollateral - - AbsorbDebt - - BuyCollateral - - PauseAction - - Supply - - SupplyCollateral - - Transfer - - TransferCollateral - - Withdraw - - WithdrawCollateral - - WithdrawReserves - abis: - - name: Comet - file: ./abis/Comet.json - eventHandlers: - - event: AbsorbCollateral(indexed address,indexed address,indexed address,uint256,uint256) - handler: handleAbsorbCollateral - - event: AbsorbDebt(indexed address,indexed address,uint256,uint256) - handler: handleAbsorbDebt - - event: BuyCollateral(indexed address,indexed address,uint256,uint256) - handler: handleBuyCollateral - - event: PauseAction(bool,bool,bool,bool,bool) - handler: handlePauseAction - - event: Supply(indexed address,indexed address,uint256) - handler: handleSupply - - event: SupplyCollateral(indexed address,indexed address,indexed address,uint256) - handler: handleSupplyCollateral - - event: Transfer(indexed address,indexed address,uint256) - handler: handleTransfer - - event: TransferCollateral(indexed address,indexed address,indexed address,uint256) - handler: handleTransferCollateral - - event: Withdraw(indexed address,indexed address,uint256) - handler: handleWithdraw - - event: WithdrawCollateral(indexed address,indexed address,indexed address,uint256) - handler: handleWithdrawCollateral - - event: WithdrawReserves(indexed address,uint256) - handler: handleWithdrawReserves - file: ./src/comet.ts - ``` - - -# GraphQL Schema (schema.graphql) - -The schema.graphql file contains the schema for your GraphQL API. See the [GraphQL docs](https://graphql.org/learn/schema/) or [The Graph's docs](https://thegraph.com/docs/en/querying/graphql-api/) for more details. - - - ```graphql schema.graphql - type AbsorbCollateral @entity(immutable: true) { - id: Bytes! - absorber: Bytes! # address - borrower: Bytes! # address - asset: Bytes! # address - collateralAbsorbed: BigInt! # uint256 - usdValue: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type AbsorbDebt @entity(immutable: true) { - id: Bytes! - absorber: Bytes! # address - borrower: Bytes! # address - basePaidOut: BigInt! # uint256 - usdValue: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type BuyCollateral @entity(immutable: true) { - id: Bytes! - buyer: Bytes! # address - asset: Bytes! # address - baseAmount: BigInt! # uint256 - collateralAmount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type PauseAction @entity(immutable: true) { - id: Bytes! - supplyPaused: Boolean! # bool - transferPaused: Boolean! # bool - withdrawPaused: Boolean! # bool - absorbPaused: Boolean! # bool - buyPaused: Boolean! # bool - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type Supply @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - dst: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type SupplyCollateral @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - dst: Bytes! # address - asset: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type Transfer @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - to: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type TransferCollateral @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - to: Bytes! # address - asset: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type Withdraw @entity(immutable: true) { - id: Bytes! - src: Bytes! # address - to: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type WithdrawCollateral @entity(immutable: true) { - id: Bytes! - src: Bytes! # address - to: Bytes! # address - asset: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - - type WithdrawReserves @entity(immutable: true) { - id: Bytes! - to: Bytes! # address - amount: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - ``` - diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deleting-a-subgraph.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deleting-a-subgraph.mdx deleted file mode 100644 index dc41d178e..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deleting-a-subgraph.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Deleting a Subgraph -description: Delete an existing subgraph or subgraph version on Alchemy Subgraphs. -subtitle: Delete an existing subgraph or subgraph version on Alchemy Subgraphs. -slug: reference/deleting-a-subgraph ---- - -# Subgraph deletion - -You can delete a subgraph from the settings tab of the subgraph page. - -# Subgraph version deletion - -To delete a subgraph version, first navigate to a subgraph version. You should see a button next to the version dropdown. - -Note: We only allow deletion of non-live subgraph versions. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179975/docs/api-reference/data/subgraphs/moving-your-subgraph-to-production/49fe89b-spaces_NMaiOyVuvMhJW4VFvNeM_uploads_git-blob-b7dfb7f245c935dd6958117b05ff57011ce2c568_delete_subgraph_version_example.png) - -## API endpoint - -You can also delete a version via an API call: - - - ```bash bash - curl -X DELETE https://subgraphs.alchemy.com/api/subgraphs////delete \ - -H 'x-api-key: ' - ``` - - -Note that this uses the *deploy key*, not query keys. - -## Version auto-deletion - -If you'd like to automatically clean up old versions, you can turn on auto-deletion from your subgraph settings tab. - -This will automatically delete the oldest non-live version of your subgraph once you're over your version limit. diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deploying-a-subgraph.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deploying-a-subgraph.mdx deleted file mode 100644 index 38162c546..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/deploying-a-subgraph.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Deploying a Subgraph -description: Import an existing subgraph or deploy a new subgraph to Alchemy Subgraphs. -subtitle: Import an existing subgraph or deploy a new subgraph to Alchemy Subgraphs. -slug: reference/deploying-a-subgraph ---- - -# Import from The Graph - -From your Alchemy Subgraphs dashboard, you can import your existing subgraph from The Graph in 1 click. - -# Import from IPFS CID - -If you have an existing self-hosted subgraph, you can import via the IPFS CID in 1 click. - -# Deploy a Subgraph - -From within your subgraph repo, run the following command: - - - ```shell shell - cd - - graph deploy \ - --version-label \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key \ - --ipfs https://ipfs.satsuma.xyz - ``` - - -## CLI Options - -**\** (Required): Specifies a unique name for a new/existing subgraph. - -* This name should not include the organization name (e.g. use `mainnet` instead of `syndicate/mainnet`). -* Valid names are composed of alphanumeric characters, `.`, `-`, and `_`. - -**—version-label** (Required): - -* Label that will be used as a unique version name for the subgraph. -* Valid labels are composed of alphanumeric characters, `.`, `-`, and `_`. - -**—node** (Required): Always set to [\](https://app.satsuma.xyz/api/subgraphs/deploy). - -**—deploy-key** (Required): API deploy key that you can access from your [Subgraph Dashboard](https://dashboard.alchemy.com/subgraphs) through the Add Subgraph button or the top of any subgraph's page. - -**—ipfs** (Optional): The IPFS node to which the deployment files are uploaded to. - -## Suggestions - -* We highly recommend using Alchemy Subgraph's IPFS gateway by specifying the `--ipfs` flag. -* If you're running this from a npm script, make sure to keep your deploy key in a .env file or pass it in dynamically: - - - ```json package.json - { - "name": "compound-v3-subgraph", - ... - "scripts": { - "deploy": "graph deploy compound-v3 --version-label $VERSION_LABEL --node https://subgraphs.alchemy.com/api/subgraphs/deploy --deploy-key $DEPLOY_KEY --ipfs https://ipfs.satsuma.xyz", - }, - ... - } - ``` - - ```shell Shell Command - DEPLOY_KEY=dummy_key VERSION_LABEL=v0.0.3 npm run deploy - ``` - - -# Errors - -```shell -Error: ✖ The hosted service is deprecated -``` - -Please note that CLI versions after `0.73.0` may introduce a "hosted service is deprecated" error — this is an automatic message and does not apply to Alchemy Subgraphs. If you see this error please change your version to `0.73.0` or earlier as shown below. Contact support with any questions! - -`npm i -g @graphprotocol/graph-cli` diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/direct-database-access.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/direct-database-access.mdx deleted file mode 100644 index 7c7db2eff..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/direct-database-access.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Direct Database Access -description: Query your underlying subgraph data via SQL with direct database access. -subtitle: Query your underlying subgraph data via SQL with direct database access. -slug: reference/direct-database-access ---- - -# Overview - -For Enterprise customers, we offer a read-only user to your subgraph's underlying Postgres database. - -**Use cases** - -* Powering complex SQL aggregations that are difficult with GraphQL. -* Powering internal analytics or dashboards. - -# Data schema - -Every subgraph maps to a Postgres DB schema, and every entity in your subgraph maps to a table in that schema. - -Each table row represents a state of a subgraph entity for a specific block range. Any time that your subgraph changes, the subgraph captures a new row. - -Every row will have the following columns: - -* `block_start_inclusive` -* `block_end_exclusive` - -This allows you to answer complex time-series queries with your subgraph entities. For example: - -* You can track how the TVL for a Pool increases over time. -* You can track total protocol users over time. diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/moving-to-production.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/moving-to-production.mdx deleted file mode 100644 index c89c1b5d6..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/moving-to-production.mdx +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Moving your Subgraph to Production -description: Take your subgraph code from development to a production GraphQL API with Alchemy Subgraphs. -subtitle: Take your subgraph code from development to a production GraphQL API with Alchemy Subgraphs. -slug: reference/moving-to-production ---- - -Now that you've written your subgraph, let's get you started with running it on Alchemy Subgraphs! - -| Page | Description | -| ----------------------------------------------------------- | -------------------------------------------------------------------------- | -| [Deploying a Subgraph](/reference/deploying-a-subgraph) | Import an existing subgraph or deploy a new subgraph to Alchemy Subgraphs. | -| [Subgraph Versioning](/reference/subgraph-versioning) | Learn how to maintain multiple versions of your subgraph. | -| [Querying a Subgraph](/reference/querying-a-subgraph) | Query from your subgraph's production-ready GraphQL API endpoint. | -| [Deleting a Subgraph](/reference/deleting-a-subgraph) | Delete an existing subgraph or subgraph version on Alchemy Subgraphs. | -| [Supported Chains](/reference/supported-subgraph-chains) | See the supported chains and networks for Alchemy Subgraphs. | -| [Direct Database Access](/reference/direct-database-access) | See the supported chains and networks for Alchemy Subgraphs. | diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/querying-a-subgraph.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/querying-a-subgraph.mdx deleted file mode 100644 index 9a5dbda5a..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/querying-a-subgraph.mdx +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: Querying a Subgraph -description: Query from your subgraph's production-ready GraphQL API endpoint. -subtitle: Query from your subgraph's production-ready GraphQL API endpoint. -slug: reference/querying-a-subgraph ---- - -The HTTP endpoint for GraphQL queries can be found on the subgraph page in the dashboard. - -# Authentication and API restrictions - -## Rate Limits - -GraphQL queries are subject to rate limits set on each organization. - -Please check your billing dashboard to see rate limit details for your organization. - -## Query keys - -All GraphQL queries are authenticated using a query key, which can be created and managed from the main dashboard. Your organization can have multiple query keys with the following settings: - -* **Origins**: Permitted origins for queries. Wildcard matching is supported (e.g. `*.alchemy.com`). -* **Rate limits** (Coming soon): Queries per second allowed per query key. - -Example use cases: - -* **From your backend** - Create a query key with no origin restrictions and no rate limit. -* **From your frontend** - Create a query key that allows origins from your domain(s) and has no rate limit. -* **For your community** - Create a query key with a rate limit and no origin restrictions. - -## Using query keys - -We currently support two ways of passing in query keys into queries — by path and by header. - -**Path** - -The query key can be included as part of the URL path. For example: - - - ```bash bash - curl -v \ - 'https://subgraph.satsuma-prod.com////version//api' \ - --data-raw '{"query":"{entities(first:1){id}}"}' - ``` - - -**Header** - -The query key can be attached with a `x-api-key` header. For example: - - - ```bash bash - curl -v \ - 'https://subgraph.satsuma-prod.com///version//api' \ - -H 'x-api-key: ' \ - --data-raw '{"query":"{entities(first:1){id}}"}' - ``` - - -# Indexing Status - -We provide an indexing status endpoint for every subgraph version, which you can find in the dashboard. - -It returns the following information: - - - ```json json - { - "data": { - "indexingStatusForCurrentVersion": { - "subgraph": "QmXqNgptc2b5WzwmFfCu8PxsLgetBe5M8eBKvSyu5jqkei", - "synced": true, - "health": "healthy", - "fatalError": null, - "nonFatalErrors": [], - "chains": [ - { - "chainHeadBlock": { - "number": "17787217" - }, - "latestBlock": { - "number": "17787217" - } - } - ] - } - } - } - ``` - diff --git a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/subgraph-versioning.mdx b/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/subgraph-versioning.mdx deleted file mode 100644 index 362d9ef8f..000000000 --- a/fern/api-reference/data/subgraphs/moving-your-subgraph-to-production/subgraph-versioning.mdx +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Subgraph Versioning -description: Learn how to maintain multiple versions of your subgraph. -subtitle: Learn how to maintain multiple versions of your subgraph. -slug: reference/subgraph-versioning ---- - -# Overview - -Alchemy Subgraphs (fka Satsuma) allows you to deploy different *subgraphs* and *subgraph versions*. - -* Each subgraph has a **live version**, which serves traffic at a static endpoint: - - `https://subgraph.satsuma-prod.com////api` - -* Each **subgraph version** gets a version-specific endpoint: - - `https://subgraph.satsuma-prod.com////version//api` - -* Version names must be unique within a subgraph. - -* Alchemy will randomly generate a version name when deploying from versions of the CLIs that don't support the `--version-label` flag. - -# Promoting a version to live - -When deploying a **new subgraph**, the first version will be set to live. - -However, **new versions of existing subgraphs** will not be automatically promoted to live. You can promote the version to live within the dashboard. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179975/docs/api-reference/data/subgraphs/moving-your-subgraph-to-production/a0354c9-Screenshot_2023-10-21_at_6.37.41_PM.png) - -## API endpoint - -You can also set a version to live via an API call: - - - ```bash bash - curl -X POST https://subgraphs.alchemy.com/api/subgraphs////promote-live \ - -H 'x-api-key: ' - ``` - - -Your team ID is automatically-generated — it can be found directly after the query key in your subgraph's query endpoint. - -#### Use cases - -This flexible system allows you to do things like: - -* Test a new version with live queries before switching your application over. -* Instantly roll back to a previous version if there are issues with a new version. - -# Auto-promote - -In certain situations, you might want to **auto-promote** a newly deployed version. Once the subgraph version finishes syncing, it will automatically get promoted to live. - -This can be useful within your CI / CD pipelines. - -## API endpoint - -Make a request to this endpoint to enable auto-promote for a subgraph version: - - - ```bash bash - curl -X POST https://subgraphs.alchemy.com/api/subgraphs////auto-promote-live \ - -H "Content-Type: application/json" -H "x-api-key: " - ``` - - -Your team ID is automatically-generated — it can be found directly after the query key in your subgraph's query endpoint. diff --git a/fern/api-reference/data/subgraphs/subgraphs-overview.mdx b/fern/api-reference/data/subgraphs/subgraphs-overview.mdx deleted file mode 100644 index b74f91d9b..000000000 --- a/fern/api-reference/data/subgraphs/subgraphs-overview.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: Subgraphs Overview -description: Learn about developing and deploying to Alchemy Subgraphs. -subtitle: Learn about developing and deploying to Alchemy Subgraphs. -slug: reference/subgraphs-overview ---- - -# What is a Subgraph? - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764179976/docs/api-reference/data/subgraphs/d3dae1b-65121be30b81ddcea1043a1f_alchemy-subgraphs-by-satsuma.jpg) - -Subgraphs are an open-source tool for building custom GraphQL APIs with blockchain data. - -## How it works - -1. Write your subgraph code. -2. Deploy to Alchemy Subgraphs. -3. Query live blockchain data through your GraphQL API. - -## Why use a subgraph? - -* Ship in days, not weeks - Spend up to 50% less time on data indexing and dealing with forks / reorgs. -* Simplify your infrastructure - Save hours every week on infra maintenance or downtime. diff --git a/fern/api-reference/data/subgraphs/subgraphs-quickstart.mdx b/fern/api-reference/data/subgraphs/subgraphs-quickstart.mdx deleted file mode 100644 index ee015e6b7..000000000 --- a/fern/api-reference/data/subgraphs/subgraphs-quickstart.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Subgraphs Quickstart -description: A developer's guide to developing and deploying to Alchemy Subgraphs. -subtitle: A developer's guide to developing and deploying to Alchemy Subgraphs. -slug: reference/subgraphs-quickstart ---- - -# Getting Started - -## Creating a new subgraph - -1. Install the `graph-cli`: - - - ```bash bash - npm install -g @graphprotocol/graph-cli - ``` - - -2. Retrieve contract address and related ABI. - -3. Create a new subgraph: - - - ```bash bash - graph init --from-contract <0x_CONTRACT_ADDRESS> --abi '' - ``` - - -4. Make modifications as necessary to the manifest, schema, and handlers. - -5. See [Developing a Subgraph](/reference/developing-a-subgraph) for more details. - -## Deploying your subgraph - -1. Get your deploy key from your [Alchemy Dashboard](https://dashboard.alchemy.com/signup). - -2. Run the following: - - - ```bash bash - cd - - graph deploy \ - --version-label \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key - --ipfs https://ipfs.satsuma.xyz - ``` - - - See []()[Deploying a Subgraph](/reference/deploying-a-subgraph) for more details. - -3. You’ll receive a link to view your newly deployed subgraph. Congrats! 🎉 diff --git a/fern/api-reference/data/subgraphs/supported-subgraph-chains.mdx b/fern/api-reference/data/subgraphs/supported-subgraph-chains.mdx deleted file mode 100644 index ef30418da..000000000 --- a/fern/api-reference/data/subgraphs/supported-subgraph-chains.mdx +++ /dev/null @@ -1,158 +0,0 @@ ---- -title: Supported Subgraph Chains -description: See the supported chains and networks for Alchemy Subgraphs. -subtitle: See the supported chains and networks for Alchemy Subgraphs. -slug: reference/supported-subgraph-chains ---- - -Alchemy Subgraphs supports the following `network` options. - -> If you’re creating a subgraph from The Graph CLI: you can select `ethereum` as the Protocol and any network afterwards, then change the `network` parameter in the manifest (`subgraph.yaml` file) once the codebase is generated. - -Certain networks are currently available only to Enterprise customers as noted in the table. - -Enterprise customers on dedicated infrastructure can enable any of the networks below by reaching out to our team or add a network we don't support by supplying their own RPC endpoint for it (see below). - -# Available Networks - -| `network` id | Network name | Network type | Availability | -| ------------------ | ------------------------------- | ------------ | ------------------ | -| abstract-mainnet | Abstract | ⭐ Mainnet | 🟢 Available | -| abstract-testnet | Abstract Testnet | Testnet | 🟢 Available | -| andromeda | Metis Andromeda | ⭐ Mainnet | 🟢 Available | -| apechain-curtis | ApeChain Curtis | Testnet | 🟢 Available | -| apechain-mainnet | ApeChain | ⭐ Mainnet | 🟢 Available | -| arbitrum-goerli | Arbitrum Goerli | Testnet | 🟢 Available | -| arbitrum-nova | Aribtrum Nova | ⭐ Mainnet | 🟢 Available | -| arbitrum-one | Arbitrum One | ⭐ Mainnet | 🟢 Available | -| arbitrum-sepolia | Arbitrum Sepolia | Testnet | 🟢 Available | -| autonomys-taurus | Autonomys Taurus | Testnet | 🟢 Available | -| avalanche | Avalanche | ⭐ Mainnet | 🟢 Available | -| base | Base | ⭐ Mainnet | 🟢 Available | -| base-sepolia | Base Sepolia | Testnet | 🟢 Available | -| base-testnet | Base Testnet | Testnet | 🟢 Available | -| berachain-bartio | Berachain bArtio | Testnet | 🟢 Available | -| berachain-mainnet | Berachain | ⭐ Mainnet | 🟢 Available | -| blast-mainnet | Blast | ⭐ Mainnet | 🟢 Available | -| blast-sepolia | Blast Sepolia | Testnet | 🟢 Available | -| botanix-mainnet | Botanix | ⭐ Mainnet | 🟢 Available | -| botanix-testnet | Botanix Testnet | Testnet | 🟢 Available | -| bsc | Binance Smart Chain / BNB Chain | ⭐ Mainnet | 🟢 Available | -| celo | Celo | ⭐ Mainnet | 🟢 Available | -| celo-alfajores | Celo Alfajores | Testnet | 🟢 Available | -| chapel | BSC Chapel | Testnet | 🟢 Available | -| degen-mainnet | Degen | ⭐ Mainnet | 🟢 Available | -| degen-sepolia | Degen Sepolia | Testnet | 🟢 Available | -| earnm-sepolia | Earnm Sepolia | Testnet | 🟢 Available | -| fantom | Fantom | ⭐ Mainnet | 🟢 Available | -| flow-mainnet | Flow | ⭐ Mainnet | 🟢 Available | -| flow-testnet | Flow Testnet | Testnet | 🟢 Available | -| fuji | Avalanche Fuji | Testnet | 🟢 Available | -| galactica-mainnet | Galactica | ⭐ Mainnet | 🟢 Available | -| galactica-cassiopeia| Galactica Cassiopeia | Testnet | 🟢 Available | -| geist-mainnet | Geist | ⭐ Mainnet | 🟢 Available | -| geist-polter | Geist Polter | Testnet | 🟢 Available | -| gensyn-testnet | Gensyn Testnet | Testnet | 🟢 Available | -| goerli | Ethereum Goerli | Testnet | 🟢 Available | -| holesky | Ethereum Holesky | Testnet | 🟢 Available | -| ink-mainnet | Ink | Mainnet | 🟢 Available | -| ink-sepolia | Ink Sepolia | Testnet | 🟢 Available | -| linea | Linea | ⭐ Mainnet | 🟢 Available | -| linea-sepolia | Linea Sepolia | Testnet | 🟢 Available | -| mainnet | Ethereum | ⭐ Mainnet | 🟢 Available | -| mantle-mainnet | Mantle | ⭐ Mainnet | 🟢 Available | -| mantle-sepolia | Mantle Sepolia | Testnet | 🟢 Available | -| matic | Polygon | ⭐ Mainnet | 🟢 Available | -| monad-testnet | Monad Testnet | Testnet | 🟢 Available | -| moonbase | Moonbase (Moonbeam Testnet) | Testnet | 🟡 Enterprise Only | -| moonbeam | Moonbeam | ⭐ Mainnet | 🟡 Enterprise Only | -| moonriver | Moonriver | ⭐ Mainnet | 🟡 Enterprise Only | -| mumbai | Polygon Mumbai | Testnet | 🟢 Available | -| optimism | Optimism | ⭐ Mainnet | 🟢 Available | -| optimism-goerli | Optimism Goerli | Testnet | 🟢 Available | -| optimism-sepolia | Optimism Sepolia | Testnet | 🟢 Available | -| polygon-amoy | Polygon Amoy | Testnet | 🟢 Available | -| polygon-zkevm | Polygon zkEVM | ⭐ Mainnet | 🟢 Available | -| rise-testnet | Rise Testnet | Testnet | 🟢 Available | -| ronin | Ronin | ⭐ Mainnet | 🟢 Available | -| saigon | Saigon (Ronin Testnet) | Testnet | 🟢 Available | -| scroll-mainnet | Scroll | ⭐ Mainnet | 🟢 Available | -| scroll-sepolia | Scroll Sepolia | Testnet | 🟢 Available | -| sei-mainnet | Sei Mainnet | ⭐ Mainnet | 🟢 Available | -| sepolia | Ethereum Sepolia | Testnet | 🟢 Available | -| settlus-septestnet | Settlus Sepolia | Testnet | 🟢 Available | -| shape-mainnet | Shape | ⭐ Mainnet | 🟢 Available | -| shape-sepolia | Shape Sepolia | Testnet | 🟢 Available | -| soneium-mainnet | Soneium | Mainnet | 🟢 Available | -| soneium-minato | Soneium Minato | Testnet | 🟢 Available | -| sonic-blaze | Sonic Blaze | Testnet | 🟢 Available | -| sonic-mainnet | Sonic | ⭐ Mainnet | 🟢 Available | -| sonic-testnet | Sonic Testnet | Testnet | 🟢 Available | -| story-aeneid | Story Aeneid | Testnet | 🟢 Available | -| story-mainnet | Story Mainnet | ⭐ Mainnet | 🟢 Available | -| unichain-mainnet | Unichain | ⭐ Mainnet | 🟢 Available | -| unichain-sepolia | Unichain Sepolia | Testnet | 🟢 Available | -| worldchain-mainnet | World Chain | ⭐ Mainnet | 🟢 Available | -| worldchain-sepolia | World Chain Sepolia | Testnet | 🟢 Available | -| xdai | Gnosis Chain / xDai | ⭐ Mainnet | 🟡 Enterprise Only | -| xmtp-testnet | XMTP Sepolia | Testnet | 🟢 Available | -| zetachain | ZetaChain | ⭐ Mainnet | 🟢 Available | -| zetachain-athens | ZetaChain Athens | Testnet | 🟢 Available | -| zksync-era | zkSync Era | ⭐ Mainnet | 🟢 Available | -| zksync-era-sepolia | zkSync Era Sepolia | Testnet | 🟢 Available | -| zora-mainnet | Zora | ⭐ Mainnet | 🟢 Available | -| zora-sepolia | Zora Sepolia | Testnet | 🟢 Available | - -## Custom JSON RPC Endpoint Requirements - -Enterprise plans can bring their own JSON RPC endpoints to index subgraphs on networks Alchemy doesn't natively support. For indexing to perform well (low block lag to head of the chain, fast initial indexing, etc), the endpoint must meet certain requirements. - -**Methods** - -Subgraphs indexing needs access to the following JSON RPC methods: - -* `eth_getBlockByNumber` -* `eth_getBlockByHash` -* `eth_getTransactionReceipt` (batch requests) -* `eth_getLogs` - * Must support a `fromBlock` and `toBlock` block range of at least 2000. -* `eth_chainId` -* `web3_clientVersion` -* `net_version` -* `eth_call` -* (Optional, to support subgraphs that have call handlers) `trace_filter` - -**Archive data** - -Subgraphs indexing may make `eth_call`s at blocks as early as the genesis block. - -**Throughput / rate limits** - -The throughput needed on the endpoint depends on the block production time, number of transactions in each block, and initial indexing activity. We can work with you to test if an endpoint has sufficient throughput and **recommend starting with an endpoint that supports at least 500 requests / second**. - -At a minimum, subgraph indexing continuously makes JSON RPC calls to get each block that’s produced and all the transactions in the block. As subgraphs are indexing, they will also consume additional throughput making calls to get contract storage and events. - -**Response times** - -If JSON RPC response time is too high, subgraphs may see slow initial indexing or lag in keeping up with chain tip. - -At a minimum, to keep up with the chain, response time must be low enough to receive a response for an `eth_getBlockBy*` call and `eth_getTransactionReceipt` calls for every block and transaction being produced in under the block production time. - -We can work with you to test this, but the **rule of thumb is**: - -```text -Br: eth_getBlockBy* response time -Tr: eth_getTransactionReceipt response time -N: p99 number of transactions in a block -B: block production time - -Br + Tr * N < B -``` - -**Data consistency** - -Subgraph indexing requires data consistency across JSON RPC calls. These consistency issues are typically caused by naive load balancing across nodes, such as a round robin strategy. If a node provider is hosting the endpoint, they’ve likely solved this and provide consistent data. - -* After calling `eth_getBlockBy*`, subsequent `eth_getTransactionReceipt` calls for each transaction in the block must succeed. -* Block height must be monotonically increasing across requests. -* After getting block and transaction data, subsequent `eth_call`s for that block must succeed. diff --git a/fern/api-reference/ethereum/ethereum-api-faq/ethereum-developer-guide-to-the-merge.mdx b/fern/api-reference/ethereum/ethereum-api-faq/ethereum-developer-guide-to-the-merge.mdx index 08058d3fa..c6e53212f 100644 --- a/fern/api-reference/ethereum/ethereum-api-faq/ethereum-developer-guide-to-the-merge.mdx +++ b/fern/api-reference/ethereum/ethereum-api-faq/ethereum-developer-guide-to-the-merge.mdx @@ -2,7 +2,7 @@ title: Ethereum Developer Guide to the Merge description: Everything you need to know as an Ethereum developer to prepare for The Merge. subtitle: Everything you need to know as an Ethereum developer to prepare for The Merge. -slug: reference/ethereum-developer-guide-to-the-merge +slug: docs/ethereum-developer-guide-to-the-merge --- This document outlines what you need to know as an Ethereum developer about The Merge diff --git a/fern/api-reference/ethereum/ethereum-api-quickstart.mdx b/fern/api-reference/ethereum/ethereum-api-quickstart.mdx index 68df08d10..2840938fd 100644 --- a/fern/api-reference/ethereum/ethereum-api-quickstart.mdx +++ b/fern/api-reference/ethereum/ethereum-api-quickstart.mdx @@ -1,124 +1,105 @@ --- -title: Ethereum API Quickstart -description: How to get started building on Ethereum and using the JSON-RPC API -subtitle: How to get started building on Ethereum and using the JSON-RPC API -slug: reference/ethereum-api-quickstart +title: Ethereum API Overview +description: How to get started building on Ethereum using Alchemy +subtitle: How to get started building on Ethereum using Alchemy +slug: docs/ethereum --- -*To use the Ethereum API you'll need to [create a free Alchemy account](https://dashboard.alchemy.com/signup) first!* + + Build faster with production-ready APIs, smart wallets and rollup infrastructure across 70+ chains. Create your free Alchemy API key and{" "} + get started today. + -# What is the Ethereum API? +The Ethereum API allows applications to connect to an Ethereum node that is part of the Ethereum blockchain. Developers can interact with on-chain data and send different types of transactions to the network by utilizing the endpoints provided by the API. -The Ethereum API allows applications to connect to an Ethereum node that is part of the Ethereum blockchain. Developers can interact with on-chain data and send different types of transactions to the network by utilizing the endpoints provided by the API. The API follows a JSON-RPC standard. JSON-RPC is a stateless, lightweight, remote procedure call (RPC) protocol that is commonly used when interacting with Ethereum. +## Send Your First Request on Alchemy -# Getting Started Instructions - -## 1. Choose a Package Manager (npm or yarn) - -For this guide, we will be using npm or yarn as our package manager to install necessary packages. - -### npm - -To get started with `npm`, follow the documentation to install Node.js and `npm` for your operating system: [https://docs.npmjs.com/downloading-and-installing-node-js-and-npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) - -### yarn - -To get started with `yarn`, follow these steps: [https://classic.yarnpkg.com/lang/en/docs/install](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) - -## 2. Set Up Your Project - -To kickstart your project, open your terminal and execute the following commands: +Let's use the [`viem`](https://www.npmjs.com/package/viem) package to create an Ethereum client connected to Alchemy and fetch the latest block number! - ```shell npm - mkdir ethereum-api-quickstart - cd ethereum-api-quickstart - npm init --yes + ```text npm + npm install --save viem ``` - ```shell yarn - mkdir ethereum-api-quickstart - cd ethereum-api-quickstart - yarn init --yes + ```text yarn + yarn add viem ``` -## 3. Install Axios - -For making API requests, we'll use Axios, a widely-used HTTP client. Install Axios with the following command: +## Create Client Connected to Alchemy - ```shell npm - npm install axios - ``` - - ```shell yarn - yarn add axios - ``` +```js +import { createPublicClient, http } from "viem"; +import { mainnet } from "viem/chains"; + +const client = createPublicClient({ + chain: mainnet, + transport: http("https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY"), +}); +``` -## 4. Make Your First Request +Now that you've created a client connected to Alchemy, you can continue with some basics: -You are all set now to use Ethereum API and make your first request. For instance, let's make a request to `get the latest block`. Create an `index.js` file in your project directory and paste the following code snippet into the file. +## Get Latest Block Number - ```javascript index.js - import axios from "axios"; - - const url = `https://eth-mainnet.g.alchemy.com/v2/${yourAlchemyAPIKey}`; - - const payload = { - jsonrpc: '2.0', - id: 1, - method: 'eth_blockNumber', - params: [] - }; - - axios.post(url, payload) - .then(response => { - console.log('The latest block number is', parseInt(response.data.result, 16)); - }) - .catch(error => { - console.error(error); - }); - ``` +```js +const blockNumber = await client.getBlockNumber(); +console.log("Current block number:", blockNumber); +``` -Remember to replace `yourAlchemyAPIKey` with your actual Alchemy API key that you can get from your [Alchemy dashboard](https://dashboard.alchemy.com/signup). - -You can also make these requests on testnets like `eth-sepolia` or `eth-holesky` by just replacing the request URL: +## Get an Address Balance - ```text text - # Mainnet - https://eth-mainnet.g.alchemy.com/v2/ - # Sepolia Testnet - https://eth-sepolia.g.alchemy.com/v2/ - # Holesky Testnet - https://eth-holesky.g.alchemy.com/v2/ - ``` +```js +const balance = await client.getBalance({ address: "0xab5801a7d398351b8be11c439e05c5b3259aec9b" }); +console.log("Balance (ETH):", Number(balance) / 1e18); +``` -## 5. Run Your Script - -To execute your script and make a request to the Ethereum network, run: +## Read Block Data - ```shell shell - node index.js - ``` +```js +const block = await client.getBlock({ + blockNumber: blockNumber, // from previous example +}); +console.log(block); +``` -You should see the latest block number outputted to your console. +## Fetch a Transaction by Hash + + +```js +const tx = await client.getTransaction({ hash: "0xYOUR_TX_HASH" }); +console.log(tx); +``` + + +## Fetch Transaction Receipt - ```shell shell - The latest block number is 11043912 - ``` +```js +const receipt = await client.getTransactionReceipt({ + hash: "0xYOUR_TX_HASH" +}); +console.log(receipt); +``` -*** +# Ethereum Tutorials + +Check out the following tutorials to learn how to build with Ethereum: + +* [Build a Web3 Dashboard](/docs/web3-dashboard-prompt) +* [Ethereum Developer Guide to the Merge](/docs/ethereum-developer-guide-to-the-merge) +* [How do I distinguish between a contract address and wallet address?](/reference/contract-address-vs-wallet-address) -You must not stop here! Want to build your first Dapp and use Ethereum APIs? Head towards Alchemy Tutorials. +For full documentation on Web3 libraries, check out the official documentation: -[**View**: /docs](/docs) +* [Viem Documentation](https://viem.sh) - Modern TypeScript interface for Ethereum +* [Ethers.js Documentation](https://docs.ethers.org) - Complete Ethereum wallet implementation diff --git a/fern/api-reference/geist/geist-deprecation-notice.mdx b/fern/api-reference/geist/geist-deprecation-notice.mdx index 3b3714e28..16b273823 100644 --- a/fern/api-reference/geist/geist-deprecation-notice.mdx +++ b/fern/api-reference/geist/geist-deprecation-notice.mdx @@ -20,7 +20,7 @@ We strongly recommend migrating to **Base**, as the Aavegotchi ecosystem (Geist' **Alternative options:** * **[Arbitrum](/reference/arbitrum-api-quickstart)**: The underlying framework that powered Geist * **[Polygon](/reference/polygon-pos-api-quickstart)**: For other gaming and NFT applications -* **[Ethereum](/reference/ethereum-api-quickstart)**: For scalable Ethereum applications +* **[Ethereum](/docs/ethereum)**: For scalable Ethereum applications ## Next Steps diff --git a/fern/api-reference/node-api/chain-apis-overview.mdx b/fern/api-reference/node-api/chain-apis-overview.mdx index dee2e4250..b5570890b 100644 --- a/fern/api-reference/node-api/chain-apis-overview.mdx +++ b/fern/api-reference/node-api/chain-apis-overview.mdx @@ -13,7 +13,7 @@ Dive into each API's detailed documentation by following the links below, organi {/* BEGIN AUTOGENERATED SECTION */} ## Ethereum APIs -📙 Get started with our [Ethereum API Quickstart Guide](/docs/reference/ethereum-api-quickstart). +📙 Get started with our [Ethereum API Quickstart Guide](/docs/ethereum). | | | | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | diff --git a/fern/api-reference/node-api/node-supported-chains.mdx b/fern/api-reference/node-api/node-supported-chains.mdx index 7c5151b0f..794753553 100644 --- a/fern/api-reference/node-api/node-supported-chains.mdx +++ b/fern/api-reference/node-api/node-supported-chains.mdx @@ -10,7 +10,7 @@ slug: docs/reference/node-supported-chains Alchemy supports both EVM and non-EVM chains, view API references below: - } href="/reference/ethereum-api-quickstart"> + } href="/docs/ethereum"> View Ethereum API reference. @@ -198,3 +198,177 @@ Alchemy supports both EVM and non-EVM chains, view API references below: View HyperEVM API reference. + +## List of HTTP URLs by Supported Network + +| Platform | Network Name | HTTPS URL | +| --- | --- | --- | +| World Chain | World Chain Mainnet | https://worldchain-mainnet.g.alchemy.com/v2/API\_KEY | +| World Chain | World Chain Sepolia | https://worldchain-sepolia.g.alchemy.com/v2/API\_KEY | +| Shape | Shape Mainnet | https://shape-mainnet.g.alchemy.com/v2/API\_KEY | +| Shape | Shape Sepolia | https://shape-sepolia.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Mainnet | https://eth-mainnet.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Sepolia | https://eth-sepolia.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Holešky | https://eth-holesky.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Hoodi | https://eth-hoodi.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Mainnet Beacon | https://eth-mainnetbeacon.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Sepolia Beacon | https://eth-sepoliabeacon.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Holešky Beacon | https://eth-holeskybeacon.g.alchemy.com/v2/API\_KEY | +| Ethereum | Ethereum Hoodi Beacon | https://eth-hoodibeacon.g.alchemy.com/v2/API\_KEY | +| ZKsync | ZKsync Mainnet | https://zksync-mainnet.g.alchemy.com/v2/API\_KEY | +| ZKsync | ZKsync Sepolia | https://zksync-sepolia.g.alchemy.com/v2/API\_KEY | +| OP Mainnet | OP Mainnet Mainnet | https://opt-mainnet.g.alchemy.com/v2/API\_KEY | +| OP Mainnet | OP Mainnet Sepolia | https://opt-sepolia.g.alchemy.com/v2/API\_KEY | +| Polygon PoS | Polygon Mainnet | https://polygon-mainnet.g.alchemy.com/v2/API\_KEY | +| Polygon PoS | Polygon Amoy | https://polygon-amoy.g.alchemy.com/v2/API\_KEY | +| Arbitrum | Arbitrum Mainnet | https://arb-mainnet.g.alchemy.com/v2/API\_KEY | +| Arbitrum | Arbitrum Sepolia | https://arb-sepolia.g.alchemy.com/v2/API\_KEY | +| Starknet | Starknet Mainnet | https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/v0\_10/API\_KEY | +| Starknet | Starknet Sepolia | https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/v0\_10/API\_KEY | +| Arbitrum Nova | Arbitrum Nova Mainnet | https://arbnova-mainnet.g.alchemy.com/v2/API\_KEY | +| Astar | Astar Mainnet | https://astar-mainnet.g.alchemy.com/v2/API\_KEY | +| Polygon zkEVM | Polygon zkEVM Mainnet | https://polygonzkevm-mainnet.g.alchemy.com/v2/API\_KEY | +| Polygon zkEVM | Polygon zkEVM Cardona | https://polygonzkevm-cardona.g.alchemy.com/v2/API\_KEY | +| ZetaChain | ZetaChain Mainnet | https://zetachain-mainnet.g.alchemy.com/v2/API\_KEY | +| ZetaChain | ZetaChain Testnet | https://zetachain-testnet.g.alchemy.com/v2/API\_KEY | +| Mantle | Mantle Mainnet | https://mantle-mainnet.g.alchemy.com/v2/API\_KEY | +| Mantle | Mantle Sepolia | https://mantle-sepolia.g.alchemy.com/v2/API\_KEY | +| Berachain | Berachain Mainnet | https://berachain-mainnet.g.alchemy.com/v2/API\_KEY | +| Berachain | Berachain Bepolia | https://berachain-bepolia.g.alchemy.com/v2/API\_KEY | +| Blast | Blast Mainnet | https://blast-mainnet.g.alchemy.com/v2/API\_KEY | +| Blast | Blast Sepolia | https://blast-sepolia.g.alchemy.com/v2/API\_KEY | +| Linea | Linea Mainnet | https://linea-mainnet.g.alchemy.com/v2/API\_KEY | +| Linea | Linea Sepolia | https://linea-sepolia.g.alchemy.com/v2/API\_KEY | +| Zora | Zora Mainnet | https://zora-mainnet.g.alchemy.com/v2/API\_KEY | +| Zora | Zora Sepolia | https://zora-sepolia.g.alchemy.com/v2/API\_KEY | +| Ronin | Ronin Mainnet | https://ronin-mainnet.g.alchemy.com/v2/API\_KEY | +| Ronin | Ronin Saigon | https://ronin-saigon.g.alchemy.com/v2/API\_KEY | +| Plasma | Plasma Mainnet | https://plasma-mainnet.g.alchemy.com/v2/API\_KEY | +| Plasma | Plasma Testnet | https://plasma-testnet.g.alchemy.com/v2/API\_KEY | +| Standard | Standard Mainnet | https://standard-mainnet.g.alchemy.com/v2/API\_KEY | +| Commons | Commons Mainnet | https://commons-mainnet.g.alchemy.com/v2/API\_KEY | +| Mythos | Mythos Mainnet | https://mythos-mainnet.g.alchemy.com/v2/API\_KEY | +| Settlus | Settlus Mainnet | https://settlus-mainnet.g.alchemy.com/v2/API\_KEY | +| Settlus | Settlus Sepolia | https://settlus-septestnet.g.alchemy.com/v2/API\_KEY | +| Earnm | Earnm Sepolia | https://earnm-sepolia.g.alchemy.com/v2/API\_KEY | +| Earnm | Earnm Mainnet | https://earnm-mainnet.g.alchemy.com/v2/API\_KEY | +| X Protocol | X Protocol Mainnet | https://xprotocol-mainnet.g.alchemy.com/v2/API\_KEY | +| BOB | BOB Mainnet | https://bob-mainnet.g.alchemy.com/v2/API\_KEY | +| BOB | BOB Sepolia | https://bob-sepolia.g.alchemy.com/v2/API\_KEY | +| MegaETH | MegaETH Mainnet | https://megaeth-mainnet.g.alchemy.com/v2/API\_KEY | +| MegaETH | MegaETH Testnet | https://megaeth-testnet.g.alchemy.com/v2/API\_KEY | +| Rootstock | Rootstock Mainnet | https://rootstock-mainnet.g.alchemy.com/v2/API\_KEY | +| Rootstock | Rootstock Testnet | https://rootstock-testnet.g.alchemy.com/v2/API\_KEY | +| Worldl3 | WorldL3 Devnet | https://worldl3-devnet.g.alchemy.com/v2/API\_KEY | +| Citrea | Citrea Testnet | https://citrea-testnet.g.alchemy.com/v2/API\_KEY | +| Citrea | Citrea Mainnet | https://citrea-mainnet.g.alchemy.com/v2/API\_KEY | +| Tea | Tea Sepolia | https://tea-sepolia.g.alchemy.com/v2/API\_KEY | +| Solana | Solana Mainnet | https://solana-mainnet.g.alchemy.com/v2/API\_KEY | +| Solana | Solana Devnet | https://solana-devnet.g.alchemy.com/v2/API\_KEY | +| Gensyn | Gensyn Testnet | https://gensyn-testnet.g.alchemy.com/v2/API\_KEY | +| Gensyn | Gensyn Mainnet | https://gensyn-mainnet.g.alchemy.com/v2/API\_KEY | +| Arc | Arc Testnet | https://arc-testnet.g.alchemy.com/v2/API\_KEY | +| Story | Story Mainnet | https://story-mainnet.g.alchemy.com/v2/API\_KEY | +| Story | Story Aeneid | https://story-aeneid.g.alchemy.com/v2/API\_KEY | +| Clankermon | Clankermon Mainnet | https://clankermon-mainnet.g.alchemy.com/v2/API\_KEY | +| Humanity | Humanity Mainnet | https://humanity-mainnet.g.alchemy.com/v2/API\_KEY | +| Humanity | Humanity Testnet | https://humanity-testnet.g.alchemy.com/v2/API\_KEY | +| Risa | Risa Testnet | https://risa-testnet.g.alchemy.com/v2/API\_KEY | +| Base | Base Mainnet | https://base-mainnet.g.alchemy.com/v2/API\_KEY | +| Base | Base Sepolia | https://base-sepolia.g.alchemy.com/v2/API\_KEY | +| Tempo | Tempo Testnet | https://tempo-testnet.g.alchemy.com/v2/API\_KEY | +| HyperEVM | Hyperliquid Mainnet | https://hyperliquid-mainnet.g.alchemy.com/v2/API\_KEY | +| HyperEVM | Hyperliquid Testnet | https://hyperliquid-testnet.g.alchemy.com/v2/API\_KEY | +| Galactica | Galactica Mainnet | https://galactica-mainnet.g.alchemy.com/v2/API\_KEY | +| Galactica | Galactica Cassiopeia | https://galactica-cassiopeia.g.alchemy.com/v2/API\_KEY | +| Lens | Lens Mainnet | https://lens-mainnet.g.alchemy.com/v2/API\_KEY | +| Lens | Lens Sepolia | https://lens-sepolia.g.alchemy.com/v2/API\_KEY | +| World Mobile Chain | WorldMobileChain Mainnet | https://worldmobilechain-mainnet.g.alchemy.com/v2/API\_KEY | +| Frax | Frax Mainnet | https://frax-mainnet.g.alchemy.com/v2/API\_KEY | +| Frax | Frax Sepolia | https://frax-sepolia.g.alchemy.com/v2/API\_KEY | +| Ink | Ink Mainnet | https://ink-mainnet.g.alchemy.com/v2/API\_KEY | +| Ink | Ink Sepolia | https://ink-sepolia.g.alchemy.com/v2/API\_KEY | +| Avalanche | Avalanche Mainnet | https://avax-mainnet.g.alchemy.com/v2/API\_KEY | +| Avalanche | Avalanche Fuji | https://avax-fuji.g.alchemy.com/v2/API\_KEY | +| Botanix | Botanix Mainnet | https://botanix-mainnet.g.alchemy.com/v2/API\_KEY | +| Botanix | Botanix Testnet | https://botanix-testnet.g.alchemy.com/v2/API\_KEY | +| Gnosis | Gnosis Mainnet | https://gnosis-mainnet.g.alchemy.com/v2/API\_KEY | +| Gnosis | Gnosis Chiado | https://gnosis-chiado.g.alchemy.com/v2/API\_KEY | +| CelestiaBridge | CelestiaBridge Mainnet | https://celestiabridge-mainnet.g.alchemy.com/v2/API\_KEY | +| CelestiaBridge | CelestiaBridge Mocha | https://celestiabridge-mocha.g.alchemy.com/v2/API\_KEY | +| BNB Smart Chain | BNB Smart Chain Mainnet | https://bnb-mainnet.g.alchemy.com/v2/API\_KEY | +| BNB Smart Chain | BNB Smart Chain Testnet | https://bnb-testnet.g.alchemy.com/v2/API\_KEY | +| Alchemy Arbitrum | Alchemy Arbitrum Fam | https://alchemyarb-fam.g.alchemy.com/v2/API\_KEY | +| Alchemy Arbitrum | Alchemy Arbitrum Sepolia | https://alchemyarb-sepolia.g.alchemy.com/v2/API\_KEY | +| Boba | Boba Mainnet | https://boba-mainnet.g.alchemy.com/v2/API\_KEY | +| Boba | Boba Sepolia | https://boba-sepolia.g.alchemy.com/v2/API\_KEY | +| SUI | SUI Mainnet | https://sui-mainnet.g.alchemy.com/v2/API\_KEY | +| SUI | SUI Testnet | https://sui-testnet.g.alchemy.com/v2/API\_KEY | +| Syndicate | Syndicate Manchego | https://syndicate-manchego.g.alchemy.com/v2/API\_KEY | +| Lumia | Lumia Prism | https://lumia-prism.g.alchemy.com/v2/API\_KEY | +| Lumia | Lumia Beam | https://lumia-beam.g.alchemy.com/v2/API\_KEY | +| Unichain | Unichain Mainnet | https://unichain-mainnet.g.alchemy.com/v2/API\_KEY | +| Unichain | Unichain Sepolia | https://unichain-sepolia.g.alchemy.com/v2/API\_KEY | +| Syndicate | Syndicate Mainnet | https://synd-mainnet.g.alchemy.com/v2/API\_KEY | +| Superseed | Superseed Mainnet | https://superseed-mainnet.g.alchemy.com/v2/API\_KEY | +| Superseed | Superseed Sepolia | https://superseed-sepolia.g.alchemy.com/v2/API\_KEY | +| Rise | Rise Testnet | https://rise-testnet.g.alchemy.com/v2/API\_KEY | +| Monad | Monad Testnet | https://monad-testnet.g.alchemy.com/v2/API\_KEY | +| Monad | Monad Mainnet | https://monad-mainnet.g.alchemy.com/v2/API\_KEY | +| Flow EVM | Flow EVM Mainnet | https://flow-mainnet.g.alchemy.com/v2/API\_KEY | +| Flow EVM | Flow EVM Testnet | https://flow-testnet.g.alchemy.com/v2/API\_KEY | +| Openloot | Openloot Sepolia | https://openloot-sepolia.g.alchemy.com/v2/API\_KEY | +| Worldmobile | WorldMobile Devnet | https://worldmobile-devnet.g.alchemy.com/v2/API\_KEY | +| Worldmobile | WorldMobile Testnet | https://worldmobile-testnet.g.alchemy.com/v2/API\_KEY | +| Tron | Tron Mainnet | https://tron-mainnet.g.alchemy.com/v2/API\_KEY | +| Tron | Tron Testnet | https://tron-testnet.g.alchemy.com/v2/API\_KEY | +| Unite | Unite Mainnet | https://unite-mainnet.g.alchemy.com/v2/API\_KEY | +| Unite | Unite Testnet | https://unite-testnet.g.alchemy.com/v2/API\_KEY | +| Degen | Degen Mainnet | https://degen-mainnet.g.alchemy.com/v2/API\_KEY | +| Degen | Degen Sepolia | https://degen-sepolia.g.alchemy.com/v2/API\_KEY | +| Bitcoin | Bitcoin Mainnet | https://bitcoin-mainnet.g.alchemy.com/v2/API\_KEY | +| Bitcoin | Bitcoin Testnet | https://bitcoin-testnet.g.alchemy.com/v2/API\_KEY | +| Bitcoin | Bitcoin Signet | https://bitcoin-signet.g.alchemy.com/v2/API\_KEY | +| Polynomial | Polynomial Mainnet | https://polynomial-mainnet.g.alchemy.com/v2/API\_KEY | +| Polynomial | Polynomial Sepolia | https://polynomial-sepolia.g.alchemy.com/v2/API\_KEY | +| Mode | Mode Mainnet | https://mode-mainnet.g.alchemy.com/v2/API\_KEY | +| Mode | Mode Sepolia | https://mode-sepolia.g.alchemy.com/v2/API\_KEY | +| Edge | Edge Mainnet | https://edge-mainnet.g.alchemy.com/v2/API\_KEY | +| Edge | Edge Testnet | https://edge-testnet.g.alchemy.com/v2/API\_KEY | +| Moonbeam | Moonbeam Mainnet | https://moonbeam-mainnet.g.alchemy.com/v2/API\_KEY | +| Alchemy | Alchemy Sepolia | https://alchemy-sepolia.g.alchemy.com/v2/API\_KEY | +| Alchemy | Alchemy Internal | https://alchemy-internal.g.alchemy.com/v2/API\_KEY | +| ApeChain | ApeChain Mainnet | https://apechain-mainnet.g.alchemy.com/v2/API\_KEY | +| ApeChain | ApeChain Curtis | https://apechain-curtis.g.alchemy.com/v2/API\_KEY | +| Celo | Celo Mainnet | https://celo-mainnet.g.alchemy.com/v2/API\_KEY | +| Celo | Celo Sepolia | https://celo-sepolia.g.alchemy.com/v2/API\_KEY | +| Aptos | Aptos Mainnet | https://aptos-mainnet.g.alchemy.com/v2/API\_KEY | +| Aptos | Aptos Testnet | https://aptos-testnet.g.alchemy.com/v2/API\_KEY | +| Anime | Anime Mainnet | https://anime-mainnet.g.alchemy.com/v2/API\_KEY | +| Anime | Anime Sepolia | https://anime-sepolia.g.alchemy.com/v2/API\_KEY | +| Alterscope | Alterscope Mainnet | https://alterscope-mainnet.g.alchemy.com/v2/API\_KEY | +| Metis | Metis Mainnet | https://metis-mainnet.g.alchemy.com/v2/API\_KEY | +| Sonic | Sonic Mainnet | https://sonic-mainnet.g.alchemy.com/v2/API\_KEY | +| Sonic | Sonic Testnet | https://sonic-testnet.g.alchemy.com/v2/API\_KEY | +| Sonic | Sonic Blaze | https://sonic-blaze.g.alchemy.com/v2/API\_KEY | +| Sei | Sei Mainnet | https://sei-mainnet.g.alchemy.com/v2/API\_KEY | +| Sei | Sei Testnet | https://sei-testnet.g.alchemy.com/v2/API\_KEY | +| XMTP | XMTP Ropsten | https://xmtp-ropsten.g.alchemy.com/v2/API\_KEY | +| XMTP | XMTP Mainnet | https://xmtp-mainnet.g.alchemy.com/v2/API\_KEY | +| ADI | ADI Testnet AB | https://adi-testnet.g.alchemy.com/v2/API\_KEY | +| ADI | ADI Mainnet | https://adi-mainnet.g.alchemy.com/v2/API\_KEY | +| Scroll | Scroll Mainnet | https://scroll-mainnet.g.alchemy.com/v2/API\_KEY | +| Scroll | Scroll Sepolia | https://scroll-sepolia.g.alchemy.com/v2/API\_KEY | +| opBNB | opBNB Mainnet | https://opbnb-mainnet.g.alchemy.com/v2/API\_KEY | +| opBNB | opBNB Testnet | https://opbnb-testnet.g.alchemy.com/v2/API\_KEY | +| Race | Race Mainnet | https://race-mainnet.g.alchemy.com/v2/API\_KEY | +| Race | Race Sepolia | https://race-sepolia.g.alchemy.com/v2/API\_KEY | +| CrossFi | CrossFi Testnet | https://crossfi-testnet.g.alchemy.com/v2/API\_KEY | +| CrossFi | CrossFi Mainnet | https://crossfi-mainnet.g.alchemy.com/v2/API\_KEY | +| Abstract | Abstract Mainnet | https://abstract-mainnet.g.alchemy.com/v2/API\_KEY | +| Abstract | Abstract Testnet | https://abstract-testnet.g.alchemy.com/v2/API\_KEY | +| Soneium | Soneium Mainnet | https://soneium-mainnet.g.alchemy.com/v2/API\_KEY | +| Soneium | Soneium Minato | https://soneium-minato.g.alchemy.com/v2/API\_KEY | +| Stable | Stable Mainnet | https://stable-mainnet.g.alchemy.com/v2/API\_KEY | +| Stable | Stable Testnet | https://stable-testnet.g.alchemy.com/v2/API\_KEY | +| V | V Devnet | https://rpc.devnet.alchemy.com/API\_KEY | diff --git a/fern/api-reference/polygon-pos/polygon-api-quickstart.mdx b/fern/api-reference/polygon-pos/polygon-api-quickstart.mdx index 9bf9e1e3f..bc4bb1e0c 100644 --- a/fern/api-reference/polygon-pos/polygon-api-quickstart.mdx +++ b/fern/api-reference/polygon-pos/polygon-api-quickstart.mdx @@ -1,117 +1,97 @@ --- title: Polygon PoS API Quickstart -description: How to get started building on Polygon PoS and using the JSON-RPC API +description: How to get started building on Polygon PoS and using subtitle: How to get started building on Polygon PoS and using the JSON-RPC API -slug: reference/polygon-pos-api-quickstart +slug: docs/polygon-pos --- - - Sign up to start building on Polygon. [Get started for free](https://dashboard.alchemy.com/signup) + + Build faster with production-ready APIs, smart wallets and rollup infrastructure across 70+ chains. Create your free Alchemy API key and{" "} + get started today. -# Getting Started Instructions +## Send Your First Request on Alchemy -## 1. Choose a package manager (npm or yarn) - -For this guide, we will be using npm or yarn as our package manager to install Viem or Ethers.js. - -### npm - -To get started with `npm`, follow the documentation to install Node.js and `npm` for your operating system: [https://docs.npmjs.com/downloading-and-installing-node-js-and-npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) - -### yarn - -To get started with `yarn`, follow these steps: [https://classic.yarnpkg.com/lang/en/docs/install](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) - -## 2. Set up your project (npm or yarn) +Let's use the [`viem`](https://www.npmjs.com/package/viem) package to create an Ethereum client connected to Alchemy and fetch the latest block number! - ```text Shell (npm) - mkdir alchemy-polygon-api - cd alchemy-polygon-api - npm init --yes + ```text npm + npm install --save viem ``` - ```text Shell (yarn) - mkdir alchemy-polygon-api - cd alchemy-polygon-api - yarn init --yes + ```text yarn + yarn add viem ``` -## 3. Install Web3 Library - -Run the following command to install Viem or Ethers.js with npm or yarn. +## Create Client Connected to Alchemy - ```text Viem (npm) - npm install viem - ``` - - ```text Viem (yarn) - yarn add viem - ``` - - ```text Ethers.js (npm) - npm install ethers - ``` - - ```text Ethers.js (yarn) - yarn add ethers - ``` +```js +import { createPublicClient, http } from "viem"; +import { mainnet } from "viem/chains"; + +const client = createPublicClient({ + chain: mainnet, + transport: http("https://polygon-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY"), +}); +``` -## 4. Make your first request +Now that you've created a client connected to Alchemy, you can continue with some basics: -You are all set now to use Polygon PoS API and make your first request. For instance, lets make a request to `get latest block`. Create an `index.js` file and paste one of the following code snippets into the file. +## Get Latest Block Number - ```javascript Viem - import { createPublicClient, http } from 'viem' - import { polygon } from 'viem/chains' - - const client = createPublicClient({ - chain: polygon, - transport: http('https://polygon-mainnet.g.alchemy.com/v2/demo') // Replace 'demo' with your API Key - }) +```js +const blockNumber = await client.getBlockNumber(); +console.log("Current block number:", blockNumber); +``` + - async function main() { - const latestBlock = await client.getBlockNumber() - console.log('The latest block number is', latestBlock) - } +## Get an Address Balance - main() - ``` + +```js +const balance = await client.getBalance({ address: "0xab5801a7d398351b8be11c439e05c5b3259aec9b" }); +console.log("Balance (ETH):", Number(balance) / 1e18); +``` + - ```javascript Ethers.js - import { JsonRpcProvider } from 'ethers' +## Read Block Data - const provider = new JsonRpcProvider('https://polygon-mainnet.g.alchemy.com/v2/demo') // Replace 'demo' with your API Key + +```js +const block = await client.getBlock({ + blockNumber: blockNumber, // from previous example +}); +console.log(block); +``` + - async function main() { - const latestBlock = await provider.getBlockNumber() - console.log('The latest block number is', latestBlock) - } +## Fetch a Transaction by Hash - main() - ``` + +```js +const tx = await client.getTransaction({ hash: "0xYOUR_TX_HASH" }); +console.log(tx); +``` -## 5. Run script - -To run the above node script, use cmd `node index.js`, and you should see the output. +## Fetch Transaction Receipt - ```text shell - The latest block number is 62250231n - ``` +```js +const receipt = await client.getTransactionReceipt({ + hash: "0xYOUR_TX_HASH" +}); +console.log(receipt); +``` -*** - # Polygon Tutorials -You must not stop here! Want to build your first Dapp on Polygon and use Polygon APIs? +Want to build your first Dapp on Polygon and use Polygon APIs? Check out the following tutorials to learn how to build on Polygon: diff --git a/fern/api-reference/pricing-resources/pricing-faq/new-pricing-for-existing-scale-and-growth-customers.mdx b/fern/api-reference/pricing-resources/pricing-faq/new-pricing-for-existing-scale-and-growth-customers.mdx index f3a2010e6..b973e3325 100644 --- a/fern/api-reference/pricing-resources/pricing-faq/new-pricing-for-existing-scale-and-growth-customers.mdx +++ b/fern/api-reference/pricing-resources/pricing-faq/new-pricing-for-existing-scale-and-growth-customers.mdx @@ -25,7 +25,6 @@ If you're on a Growth plan, your account will automatically transition to Pay As * No interruption to your service * Lower costs with similar usage patterns * Same admin fee (8%) for Gas Manager -* Only pay for the entities and queries you use on Subgraphs * Same features and support you rely on ## Scale Monthly Plans @@ -38,7 +37,6 @@ If you're on a Growth Monthly plan, your account will automatically transition t * No interruption to your service * Lower costs with similar usage patterns * Your gas manager pricing will stay at a 7% admin fee -* Only pay for the entities and queries you use on Subgraphs * Same features and support you rely on ## Scale Annual Plans @@ -51,7 +49,6 @@ If you're on an Scale Annual plan, your transition includes special handling of * All remaining Compute Units credited through December 31st, 2025 * Credits will be automatically applied to your usage * Your gas manager pricing will stay at a 7% admin fee -* Only pay for the entities and queries you use on Subgraphs * No interruption to your service or features ## New Benefits @@ -70,5 +67,4 @@ With Pay As You Go plan, you'll get: 1. **How do unused compute units work for Scale Annual plan customers?** If you're on a Scale Annual plan, all remaining Compute Units will be credited to you and will expire at the end of your annual contract. **Note:** For the month of February, these credits will be transferred as a dollar value directly to your account. Starting March 1st, credits will be issued in Compute Units (CUs), available for you to use any time before your contract ends. 2. **What happens to my current features?** You'll maintain access to all your current features and services. 3. **Will my costs increase?** With similar usage patterns, most Growth plan, Scale Monthly, and Scale Annually users will see their costs decrease under Pay As You Go plan. -4. **How does Pay As You Go plan work for Subgraphs?** Check out [alchemy.com/pricing](http://alchemy.com/pricing) for full details. We’re getting rid of the base fees and allotments from our prior plans. Now, there’s a single, reduced rate for queries ($20/M) and stored entities ($25/M) to reflect exactly how much you’re using. If you have any questions or feedback, please contact us at or open a ticket in the dashboard. diff --git a/fern/api-reference/pricing-resources/pricing-faq/pay-as-you-go-pricing-faq.mdx b/fern/api-reference/pricing-resources/pricing-faq/pay-as-you-go-pricing-faq.mdx index d44c13dd6..913bc8016 100644 --- a/fern/api-reference/pricing-resources/pricing-faq/pay-as-you-go-pricing-faq.mdx +++ b/fern/api-reference/pricing-resources/pricing-faq/pay-as-you-go-pricing-faq.mdx @@ -13,13 +13,13 @@ We firmly believe that costs shouldn’t be a barrier to building innovative app This FAQ answers what you need to know about our Pay As You Go plan. -1. **What is Pay As You Go plan?** Pay As You Go is our new pricing plan. You only pay for what you use, with no platform fees. Rates start at \$0.45 per million Compute Units and automatically decrease to $0.40 per million Compute Units after you hit 300M Compute Units. +1. **What is Pay As You Go plan?** Pay As You Go is our new pricing plan. You only pay for what you use, with no platform fees. Rates start at $0.45 per million Compute Units and automatically decrease to $0.40 per million Compute Units after you hit 300M Compute Units. 2. **When is Pay As You Go plan available?** The new pricing plan launches on February 1st, 2025. 3. **What does Pay As You Go plan include?** Check out [alchemy.com/pricing](http://alchemy.com/pricing) for full details. -4. **How do I calculate my costs under the Pay As You Go plan?** \$0.45 per million Compute Units until you hit 300M monthly Compute Units. After 300M, your rate drops to $0.40 per million Compute Units. +4. **How do I calculate my costs under the Pay As You Go plan?** $0.45 per million Compute Units until you hit 300M monthly Compute Units. After 300M, your rate drops to $0.40 per million Compute Units. ```text For an app using 120M Compute Units / month: @@ -35,42 +35,16 @@ This FAQ answers what you need to know about our Pay As You Go plan. 5. **How do Compute Units work?** Each API request uses Compute Units (CUs) based on its complexity. Check out [this breakdown of Alchemy's compute unit costs](/reference/compute-unit-costs) per method, chain, and product. On average, one API request uses about 25 CUs, though this can vary. For example, 4M requests typically use around 100M CUs. -6. **How does Pay As You Go plan work for Subgraphs?** - - Our old pricing (before Feb 1st, 2025) is below: - - | | Free | Growth ($49/mo) | Scale ($199/mo) | - | ------------------------ | ---- | --------------- | --------------- | - | Deployments | 2 | 10 | 30 | - | Queries | 500K | 1M | 10M | - | Extra Queries | – | $50/M | $25/M | - | Rate Limit (queries/sec) | 5 | 10 | 30 | - | Stored Entities | 250K | 500K | 2.5M | - | Extra Stored Entities | – | $50/M | $30/M | - - Our new pricing (after Feb 1st, 2025) is as follows: - - | | Free | Pay As You Go | - | ------------------------ | ---- | ------------- | - | Deployments | 2 | 30 | - | Queries | 200K | $20/M | - | Rate Limit (queries/sec) | 5 | 30 | - | Stored Entities | 100K | $25/M | - - We’re getting rid of the base fees and allotments from our prior plans. Starting Feb 1st, 2025, there’s a single, reduced rate for queries (\$20/M) and stored entities (\$25/M) to reflect exactly how much you’re using. - - Check out [alchemy.com/pricing](http://alchemy.com/pricing) for full details. - -7. **How does Pay As You Go plan work for Gas Manager?** +6. **How does Pay As You Go plan work for Gas Manager?** Check out [alchemy.com/pricing](http://alchemy.com/pricing) for full details. -8. **How does this impact Enterprise plans?** Enterprise plans remain unchanged. +7. **How does this impact Enterprise plans?** Enterprise plans remain unchanged. -9. What do I need to know if I’m an existing Scale or Growth Customer? Check out all details [here](/reference/new-pricing-for-existing-scale-and-growth-customers). +8. What do I need to know if I’m an existing Scale or Growth Customer? Check out all details [here](/reference/new-pricing-for-existing-scale-and-growth-customers). -10. I’m a free plan user! What happens after I hit 30M Compute Units? +9. I’m a free plan user! What happens after I hit 30M Compute Units? - We offer **the most generous free plan** in the industry. Our free plan gives you **3x the capacity** to build for free compared to competitors, giving you massive computing power and throughput to start building right away. + We offer **the most generous free plan** in the industry. Our free plan gives you **3x the capacity** to build for free compared to competitors, giving you massive computing power and throughput to start building right away. - When you're ready to scale beyond 30M Compute Units per month, Pay As You Go plan provides a seamless path forward with competitive rates that get cheaper when you build more. + When you're ready to scale beyond 30M Compute Units per month, Pay As You Go plan provides a seamless path forward with competitive rates that get cheaper when you build more. diff --git a/fern/api-reference/pricing-resources/pricing/pricing-plans.mdx b/fern/api-reference/pricing-resources/pricing/pricing-plans.mdx index 42ca1c45a..56aea09c6 100644 --- a/fern/api-reference/pricing-resources/pricing/pricing-plans.mdx +++ b/fern/api-reference/pricing-resources/pricing/pricing-plans.mdx @@ -47,15 +47,6 @@ slug: reference/pricing-plans | Gas Manager Coverage API | ✓ | ✓ | ✓ | | Gas Manager Admin API | ✗ | ✓ | ✓ | -## Subgraphs Pricing - -| Feature | Free Tier | PAYG | Enterprise Tier | -| ----------------------------- | --------- | ----- | --------------- | -| Subgraph Deployments | 2 | 30 | Unlimited | -| Queries | 200K | $20/M | Custom | -| Base Throughput (queries/sec) | 5 | 30 | Custom | -| Stored Entities | 100K | $25/M | Custom | - ## Throughput (CUPS) Each application has reserved dedicated throughput, measured in Compute Units per Second (CUPS). Your app can exceed these limits based on elastic demand in our system. diff --git a/fern/api-reference/websockets/subscription-api-endpoints/alchemy-minedtransactions.mdx b/fern/api-reference/websockets/subscription-api-endpoints/alchemy-minedtransactions.mdx index f2f8a2ca3..d25902470 100644 --- a/fern/api-reference/websockets/subscription-api-endpoints/alchemy-minedtransactions.mdx +++ b/fern/api-reference/websockets/subscription-api-endpoints/alchemy-minedtransactions.mdx @@ -18,7 +18,7 @@ The `alchemy_minedTransactions` subscription type subscribes to mined transactio # Parameters * `addresses` (optional): \[`array of objects`] list of addresses to filter mined transactions for specified by `to` or `from` in the following format: `[{"to": "string", "from": "string"}]`. Limit of 1000 total addresses. -* `includeRemoved` (optional): `boolean` specifier to include transactions that have been removed from the cannonical chain (or [re-orged](/reference/ethereum-developer-guide-to-the-merge#what-is-a-re-org-re-organization)). +* `includeRemoved` (optional): `boolean` specifier to include transactions that have been removed from the cannonical chain (or [re-orged](/docs/ethereum-developer-guide-to-the-merge#what-is-a-re-org-re-organization)). * `hashesOnly` (optional): `boolean` default value is `false`, where the response will return a full transaction object (matches the payload of [eth\_getTransactionByHash](/reference/eth-gettransactionbyhash)) . If set to `true`, the payload returned contains only the *hashes* of the transactions that are mined. diff --git a/fern/docs.yml b/fern/docs.yml index 8ff263af3..65d674c48 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -790,11 +790,10 @@ navigation: path: api-reference/data/nft-api/nft-api-overview.mdx - page: NFT API Quickstart path: api-reference/data/nft-api/nft-api-quickstart.mdx - - section: Solana DAS APIs + - section: Solana DAS API + path: >- + api-reference/data/nft-api/alchemy-das-apis-for-solana.mdx contents: - - page: Solana DAS API Overview - path: >- - api-reference/data/nft-api/alchemy-das-apis-for-solana.mdx - api: Solana DAS API Endpoints api-name: solana-das - section: NFT API Endpoints @@ -807,26 +806,6 @@ navigation: slug: nft-api-endpoints - page: NFT API FAQ path: api-reference/data/nft-api/nft-api-faq.mdx - # - section: NFT API Tutorials - # contents: - # - page: How to Create NFT Token-Gated Communities - # path: >- - # tutorials/nfts/creating-nft-allowlists/how-to-create-nft-token-gated-communities-with-the-alchemy-nft-api.mdx - # - page: How to Filter Out Spam NFTs - # path: >- - # tutorials/nfts/nft-api-tutorials/how-to-filter-out-spam-nfts.mdx - # - page: How to Get NFT Owners at Specific Block - # path: >- - # tutorials/nfts/nft-api-tutorials/how-to-get-nft-owners-at-a-specific-block-height.mdx - # - page: How to Get All NFTs Owned by Address - # path: >- - # tutorials/nfts/nft-api-tutorials/how-to-get-all-nfts-owned-by-an-address.mdx - # - page: How to Get a List of NFT Holders for a Given Collection - # path: >- - # tutorials/nfts/nft-api-tutorials/how-to-get-a-list-of-nft-holders-for-a-given-collection.mdx - # - page: How to Resolve ENS Domains Given a Wallet Address - # path: >- - # tutorials/nfts/nft-api-tutorials/how-to-resolve-ens-domains-given-a-wallet-address.mdx slug: nft-api-tutorials slug: nft-api - section: Webhooks @@ -923,56 +902,6 @@ navigation: - api: Transactions Receipts Endpoints api-name: transactions-receipt slug: utility-apis - - section: Subgraphs - contents: - - page: Subgraphs Overview - path: api-reference/data/subgraphs/subgraphs-overview.mdx - - page: Subgraphs Quickstart - path: api-reference/data/subgraphs/subgraphs-quickstart.mdx - - page: Supported Subgraph Chains - path: api-reference/data/subgraphs/supported-subgraph-chains.mdx - - section: Developing a Subgraph - path: >- - api-reference/data/subgraphs/developing-a-subgraph/developing-a-subgraph.mdx - contents: - - page: Graph CLI - path: >- - api-reference/data/subgraphs/developing-a-subgraph/graph-cli.mdx - - page: Creating a Subgraph - path: >- - api-reference/data/subgraphs/developing-a-subgraph/creating-a-subgraph.mdx - - page: Project Structure - path: >- - api-reference/data/subgraphs/developing-a-subgraph/project-structure.mdx - - page: Data Sources - path: >- - api-reference/data/subgraphs/developing-a-subgraph/data-sources.mdx - - link: Writing Mappings - href: https://thegraph.com/docs/en/subgraphs/developing/creating/assemblyscript-mappings/ - slug: developing-a-subgraph - - section: Moving your Subgraph to Production - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/moving-to-production.mdx - contents: - - page: Deploying a Subgraph - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/deploying-a-subgraph.mdx - - page: Subgraph Versioning - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/subgraph-versioning.mdx - - page: Querying a Subgraph - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/querying-a-subgraph.mdx - - page: Deleting a Subgraph - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/deleting-a-subgraph.mdx - - page: Direct Database Access - path: >- - api-reference/data/subgraphs/moving-your-subgraph-to-production/direct-database-access.mdx - slug: moving-your-subgraph-to-production - - page: Community subgraphs - path: api-reference/data/subgraphs/community-subgraphs.mdx - slug: subgraphs - section: Beta APIs contents: - api: Beta API Endpoints @@ -1028,23 +957,10 @@ navigation: path: api-reference/node-api/mev-protection.mdx - section: Ethereum contents: - - page: Ethereum API Quickstart + - page: Overview path: api-reference/ethereum/ethereum-api-quickstart.mdx - - section: Ethereum API FAQ + - page: FAQ path: api-reference/ethereum/ethereum-api-faq/ethereum-api-faq.mdx - contents: - - page: Ethereum Developer Guide to the Merge - path: >- - api-reference/ethereum/ethereum-api-faq/ethereum-developer-guide-to-the-merge.mdx - - page: How to decode an eth_call response - path: >- - api-reference/ethereum/ethereum-api-faq/how-to-decode-an-eth-call-response.mdx - - page: >- - How do I distinguish between a contract address and a wallet - address? - path: >- - api-reference/ethereum/ethereum-api-faq/contract-address-vs-wallet-address.mdx - slug: ethereum-api-faq - api: Ethereum API Endpoints api-name: eth - api: Ethereum Beacon API Endpoints @@ -1060,13 +976,13 @@ navigation: href: https://solana-demo-sigma.vercel.app/ - page: Accounts DB Infrastructure path: api-reference/solana/accounts-db-infra.mdx - - section: Solana Tutorials + - section: Tutorials contents: - page: Hello World Solana Application path: api-reference/solana/hello-world.mdx - page: Set up Frontend for Solana Application path: api-reference/solana/hello-world-application.mdx - - page: Solana API FAQ + - page: FAQ path: api-reference/solana/solana-api-faq.mdx - api: Solana API Endpoints api-name: solana @@ -1075,14 +991,8 @@ navigation: slug: solana - section: Polygon PoS contents: - - section: Polygon PoS API Quickstart - path: >- - api-reference/polygon-pos/polygon-api-quickstart.mdx - contents: - - page: Polygon SDK Examples - path: >- - api-reference/polygon-pos/polygon-pos-api-quickstart/polygon-sdk-examples.mdx - slug: polygon-pos-api-quickstart + - page: Polygon PoS API Quickstart + path: api-reference/polygon-pos/polygon-api-quickstart.mdx - page: Polygon PoS API FAQ path: api-reference/polygon-pos/polygon-api-faq.mdx - api: Polygon POS API Endpoints @@ -3200,7 +3110,19 @@ redirects: destination: /docs/reference/arbitrum-api-quickstart permanent: true - source: /alchemy/apis/ethereum - destination: /docs/reference/ethereum-api-quickstart + destination: /docs/ethereum + permanent: true + - source: /docs/reference/ethereum-api-quickstart + destination: /docs/ethereum + permanent: true + - source: /reference/ethereum-api-quickstart + destination: /docs/ethereum + permanent: true + - source: /docs/reference/ethereum-developer-guide-to-the-merge + destination: /docs/ethereum-developer-guide-to-the-merge + permanent: true + - source: /reference/ethereum-developer-guide-to-the-merge + destination: /docs/ethereum-developer-guide-to-the-merge permanent: true - source: /alchemy/apis/optimism destination: /docs/reference/op-mainnet-api-quickstart @@ -3548,7 +3470,7 @@ redirects: destination: /docs/reference/arbitrum-api-quickstart permanent: true - source: /apis/ethereum - destination: /docs/reference/ethereum-api-quickstart + destination: /docs/ethereum permanent: true - source: /apis/optimism destination: /docs/reference/op-mainnet-api-quickstart @@ -3926,7 +3848,7 @@ redirects: destination: /docs/solana permanent: true - source: /alchemy/documentation/apis/ethereum-api - destination: /docs/reference/ethereum-api-quickstart + destination: /docs/ethereum permanent: true - source: /alchemy/documentation/alchemy-api-reference/transfers-api destination: /docs/reference/transfers-api-quickstart @@ -3992,7 +3914,7 @@ redirects: destination: /docs/reference/notify-api-quickstart permanent: true - source: /alchemy/documentation/apis/ethereum - destination: /docs/reference/ethereum-api-quickstart + destination: /docs/ethereum permanent: true - source: /docs/8-how-to-build-a-betting-game-on-optimism destination: /docs/how-to-build-a-betting-game-on-optimism @@ -4326,8 +4248,97 @@ redirects: destination: /docs/data/simulation-apis/transaction-simulation-endpoints/alchemy-simulate-execution permanent: true + # Subgraphs deprecation redirects - source: /docs/alchemy-subgraphs-overview - destination: /docs/reference/subgraphs-quickstart + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/data/subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/subgraphs-overview + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/subgraphs-quickstart + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/supported-subgraph-chains + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/developing-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/developing-a-subgraph/graph-cli + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/developing-a-subgraph/creating-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/developing-a-subgraph/project-structure + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/developing-a-subgraph/data-sources + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production/deploying-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production/subgraph-versioning + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production/querying-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production/deleting-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/moving-your-subgraph-to-production/direct-database-access + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/reference/community-subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/alchemy-subgraphs-overview + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/learn-subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/learn-subgraphs/introduction-to-subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/learn-subgraphs/how-to-query-a-subgraph + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/learn-subgraphs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice + permanent: true + + - source: /docs/tutorials/learn-subgraphs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs + destination: /docs/tutorials/alchemy-subgraphs/deprecation-notice permanent: true - source: /docs/how-to-send-a-private-transaction-on-ethereum diff --git a/fern/home/index.mdx b/fern/home/index.mdx index b1d1ba0d8..f3c798bb9 100644 --- a/fern/home/index.mdx +++ b/fern/home/index.mdx @@ -74,7 +74,7 @@ import { CodeConsole } from "../components/CodeConsole/index.tsx";

Blockchain basics

Get started by learning how to connect your app to Ethereum using Alchemy's JSON-RPC API.

-

Get started

+

Get started

diff --git a/fern/tutorials/alchemy-subgraphs/alchemy-subgraphs-overview.mdx b/fern/tutorials/alchemy-subgraphs/alchemy-subgraphs-overview.mdx deleted file mode 100644 index a5f588e19..000000000 --- a/fern/tutorials/alchemy-subgraphs/alchemy-subgraphs-overview.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Alchemy Subgraphs Overview -description: Learn about subgraphs, their uses cases and the Alchemy Subgraphs platform. -subtitle: Learn about subgraphs, their uses cases and the Alchemy Subgraphs platform. -slug: docs/alchemy-subgraphs-overview ---- - -Alchemy Subgraphs (formerly Satsuma) is a blockchain indexing platform with drop-in support for hosted subgraphs. - -## Understanding Subgraphs - -Alchemy Subgraphs allow developers to create specialized APIs, aka **subgraphs**, that define how to ingest, process, and store information from the blockchain, making it easier for apps to query blockchain data - -## Pain Points Addressed by Alchemy Subgraphs - -Alchemy Subgraphs offer a solution designed to mitigate the following pain points and streamline the process for developers: - -### **1. In-House Indexing System Limitations** - -The main alternative to subgraphs is developing an in-house indexing system, which is resource-intensive, and has considerable drawbacks: - -* **Engineering Time & Cost**: Engineering resources from product development are diverted in order to construct and maintain a custom indexing system. -* **Complexity & Expertise**: Building an indexing system requires specialized knowledge about blockchain intricacies, such as reorgs and data decoding. Companies often face a steep learning curve or need to hire additional, specialized staff. - -### **2. Limitations with *Existing* Subgraph Services** - -Using subgraphs with other current hosted services, also comes with its challenges: - -* **Performance Issues**: Slow initial sync times, reindexes, and query response can bottleneck development. -* **Reliability Concerns**: Downtime and inconsistent API performance, often due to operational inefficiencies, user abuse, or maintenance, can disrupt services. -* **Lack of Visibility**: Insufficient insights into indexing and query metrics lead to a lack of trust and additional time spent debugging. -* **Data Lag**: Delays in data updates can impede real-time functionality. -* **Customer Support**: Limited or no direct support hampers problem resolution. - -Current decentralized services introduce further complications: - -* **Operational Overhead**: Using this service entails complex processes such as acquiring and staking tokens, and signaling your subgraph to indexers. -* **Exposure and Privacy**: The necessity to make your subgraph publicly accessible. -* **Indexer Reliance**: No guarantee that indexers will prioritize or even process your subgraph. -* **Technical Support**: Lack of a direct line for technical support to indexers can prolong issue resolution. - -### **3. Self-Hosting Difficulties** - -Self-hosting subgraphs brings its own set of issues: - -* **Maintenance Burden**: Operators need to invest significant time and effort into system upkeep. -* **Performance Dependency**: Indexing speed is contingent on running personal RPC nodes. -* **Infrastructure Costs**: There are high costs associated with running the necessary graph node, database, and RPC nodes. - -## Alchemy Subgraphs APIs - -* [Subgraphs Quickstart](/reference/subgraphs-quickstart) - -* [Developing a Subgraph](/reference/developing-a-subgraph) - - * [Graph CLI](/reference/graph-cli) - * [Creating a Subgraph](/reference/creating-a-subgraph) - * [Project Structure](/reference/project-structure) - * [Data Sources](/reference/data-sources) - * [Writing Mappings](https://thegraph.com/docs/en/developing/creating-a-subgraph/#writing-mappings) - -* [Moving Your Subgraph to Production](/reference/moving-to-production) - - * [Deploying a Subgraph](/reference/deploying-a-subgraph) - * [Subgraph Versioning](/reference/subgraph-versioning) - * [Querying a Subgraph](/reference/querying-a-subgraph) - * [Deleting a Subgraph](/reference/deleting-a-subgraph) - * [Supported Subgraph Chains](/reference/supported-subgraph-chains) - * [Direct Database Access](/reference/direct-database-access) - -## Further Resources - -* [GraphQL explained in 100 seconds](https://www.youtube.com/watch?v=eIQh02xuVw4) (VIDEO) diff --git a/fern/tutorials/alchemy-subgraphs/deprecation-notice.mdx b/fern/tutorials/alchemy-subgraphs/deprecation-notice.mdx new file mode 100644 index 000000000..15e6ef4e8 --- /dev/null +++ b/fern/tutorials/alchemy-subgraphs/deprecation-notice.mdx @@ -0,0 +1,28 @@ +--- +title: Alchemy Subgraphs Deprecation Notice +description: Alchemy Subgraphs has been sunset. Learn how to migrate to Goldsky. +subtitle: Alchemy Subgraphs has been sunset. Learn how to migrate to Goldsky. +slug: docs/alchemy-subgraphs/deprecation-notice +--- + +Alchemy Subgraphs was sunset on December 8, 2025. All subgraph and query endpoints have been discontinued. + +We've partnered with [Goldsky](https://goldsky.com/?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) to offer you a more powerful indexing solution. + +## Migrate to Goldsky + +To continue using subgraphs, migrate to Goldsky — they support all Alchemy networks and subgraph features. + +1. [Sign up for Goldsky](https://app.goldsky.com/signup?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) +2. [Follow the migration guide](https://docs.goldsky.com/subgraphs/migrate-from-alchemy/guide?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) (takes less than 30 minutes) +3. [View feature & pricing comparison](https://docs.goldsky.com/subgraphs/migrate-from-alchemy/comparison?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) + +## Why Goldsky? + +We partnered with a provider that raises the bar for indexing performance: + +* **Products:** [Subgraphs](https://goldsky.com/products/subgraphs?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration), [Webhooks](https://docs.goldsky.com/subgraphs/webhooks?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) (subgraph events), and [Mirror](https://docs.goldsky.com/mirror/introduction?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration) (data streaming) +* **Features:** Every network and feature from Alchemy Subgraphs included +* **Reliability:** 99.99%+ uptime SLAs and real-time support + +For questions about migration, contact [Goldsky support](https://goldsky.com/?utm_source=alchemy\&utm_medium=email\&utm_campaign=alchemy_migration). diff --git a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs.mdx b/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs.mdx deleted file mode 100644 index 8876e8706..000000000 --- a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs.mdx +++ /dev/null @@ -1,205 +0,0 @@ ---- -title: How to Build and Deploy a Subgraph for Polygon zkEVM using Alchemy Subgraphs -description: Learn how to build and depoy a subgraph for Polygon zkEVM that indexes ERC-721 transfer events using Alchemy Subgraphs. -subtitle: Learn how to build and depoy a subgraph for Polygon zkEVM that indexes ERC-721 transfer events using Alchemy Subgraphs. -slug: docs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs ---- - -## Introduction - -In this guide, we will walk you through the process of creating a simple subgraph hosted on the Alchemy Subgraphs platform and deployed for Polygon zkEVM. The subgraph will be a simple one that indexes an ERC-721 contract's [Transfer](https://docs.openzeppelin.com/contracts/2.x/api/token/erc721#IERC721-Transfer-address-address-uint256-) events - feel free to copy this same exact flow with a contract of your choice. - -## Developer Environment - -Before proceeding with the guide, ensure you meet the following requirements: - -* **Node.js**: You must have Node.js version 18 or higher installed on your system. If you do not have Node.js installed, or if your version is lower than 18, you can download the latest version from the official website. -* Run `node -v` to verify. -* Install the [Graph CLI (graph-cli) NPM package](https://www.npmjs.com/package/@graphprotocol/graph-cli) globally by running `npm i -g @graphprotocol/graph-cli`. - -## Step 1: Run the Subgraph CLI Wizard - -Let's set up a local project to put together all the files that will be used to build and deploy our subgraph: - -1. Navigate to a directory where you want to initialize your project - -2. Make sure you have the [Graph CLI (graph-cli) NPM package](https://www.npmjs.com/package/@graphprotocol/graph-cli) installed globally. Run `npm i -g @graphprotocol/graph-cli` - - 1. Run `graph` to verify you have this package installed - -3. Create an `abis` folder in your project directory - -4. Copy the contract ABI on [Etherscan](https://zkevm.polygonscan.com/address/0x5a3b2e7f335be432f834b3f1bfef19b44d1f310c) for the CrossChain NFT contract. Paste the ABI into a file called `cross-chain.json` within the `abis` folder - -5. Run `graph init --from-contract 0x5A3b2E7f335be432f834b3F1bfEf19B44d1f310C --abi 'abis/cross-chain.json'` to initialize the package's CLI wizard and select the following options: - - 1. **Protocol**: `ethereum` - 2. **Product for which to initialize**: `hosted-service` - 3. **Subgraph name**: `alchemy/zkevm-erc721-transfers` - 4. **Directory to create the subgraph in**: `zkevm-subgraphs` - 5. **Ethereum network**: `polygon-zkevm` - 6. **Contract address**: [0x5A3b2E7f335be432f834b3F1bfEf19B44d1f310C](https://zkevm.polygonscan.com/address/0x5a3b2e7f335be432f834b3f1bfef19b44d1f310c) - 7. **Start Block**: `409341` (manually fetched the block number from Polygonscan in which this contract was deployed) - 8. **Contract name**: `ERC721` - 9. **Index contract events as entities (Y/n)**: `y` (press Enter) - 10. Once the wizard process begins, you will be asked if you want to add another contract: `n` - -The wizard will now finish the local subgraph build process. Once done, your terminal should look like this: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180106/docs/tutorials/alchemy-subgraphs/learn-subgraphs/264c6f4-image.png) - -## Step 2: Set Up Your Local Files - -> If you don't want to create a simplified version of this subgraph below, you are ready to deploy your subgraph to the Alchemy Subgraphs platform. Go to Step #4 if you want to skip the deep dive into the files of the project below. - -First of all, make sure to navigate to the newly created project you just set up with Step #1: - -1. Run `cd zkevm-subgraphs` -2. Open the folder in your preferred IDE and get familiar with the project files: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180107/docs/tutorials/alchemy-subgraphs/learn-subgraphs/0641fb3-Screenshot_2023-10-30_at_10.45.26_AM.png) - -When building subgraphs, there are **three main files** you want to focus on before everything works properly: - -1. **`schema.graphql` **: This file defines the GraphQL schema for your subgraph. The GraphQL schema is basically the data blueprint of what you want to index from the blockchain and in what format. The schema is used to define **entities**, which are used to generate the database and the GraphQL API, enabling developers to perform queries on the indexed data. **In blockchain subgraph land, typically entities are just what contract Events you want to index and how.** - -> Entities are simply interfaces for the data you want to index. For example, if you are indexing NFT transfers, you can have an entity named `Transfer` with fields such as id, fromAddress, toAddress, tokenId, and timestamp. - -2. **`subgraph.yaml`**(also referred to as the *subgraph manifest*): This file contains all of the key data regarding how the subgraph should be built. It references the entities defined in the `schema.graphql`. If you open the file in your local project, you'll notice it contains a lot of what you filled in during the wizard process like the contract `address` and `startBlock`. The manifest basically aggregates all of of your subgraph's most important data into one file. -3. **the `.ts` file inside `/src` that was auto-generated by the wizard process** (if you are following this guide, it is called `pudgy-penguins.ts`): This file contains the function handlers for your entities. When your subgraph indexes a new event, it will run the function, defined in this file, (and mapped to the entity in the `subgraph.yaml` file) to that entity. - - - Notice: the wizard process creates a `/abis` folder and automatically - populates the contract `abi`, which you'll need. The file is called - `PudgyPenguins.json` in this guide project. - - -Ok, now that we've defined what the most important files in our project are, let's continue with the steps from above... - -The wizard process, by default, sets you up with a fully loaded project correspondent to the smart contract you loaded. This means it will read the contract's ABI and create an entity for each of the contract's defined events. If you open the project's `schema.graphql` file, you'll notice all of the Pudgy Penguin NFT contract events defined as entities. This is great if you're building a wide-range app specific to Pudgy Penguins, but for our purposes let's keep things simple and only work with one entity: the `Transfer` entity. - -3. Open the `schema.graphql` file and remove every entity except the `Transfer` entity. You can overwrite the file and copy-paste the following: - - - ```typescript Typescript - type Transfer @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - to: Bytes! # address - tokenId: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - ``` - - -4. Save and close the file. -5. Now, open the `subgraph.yaml` file. - -We want to remove everything that is not specific to the `Transfer` event of the Pudgy Penguins smart contract. - -6. Remove any mentions of entities that aren't Transfer or overwrite the file and copy-paste the following: - - - ````typescript yaml specVersion: 0.0.5 schema: file: ./schema.graphql - dataSources: - kind: ethereum name: ERC721 network: polygon-zkevm source: - address: "0x5A3b2E7f335be432f834b3F1bfEf19B44d1f310C" abi: ERC721 startBlock: - 409340 mapping: kind: ethereum/events apiVersion: 0.0.7 language: - wasm/assemblyscript entities: - Transfer abis: - name: ERC721 file: - ./abis/ERC721.json eventHandlers: - event: Transfer(indexed address,indexed - address,indexed uint256) handler: handleTransfer file: ./src/erc-721.ts - ```` - - -> Notice, these are the same exact file contents as the boilerplate but we are just removing anything not specific to the `Transfer` entity. - -7. Save and close the file. -8. Now, open the `erc-721.ts` file in the `/src` folder. Remove any function handlers non-specific to the `Transfer` event or overwrite the file and copy-paste the following: - - -````Text Typescript -import { Transfer as TransferEvent } from "../generated/ERC721/ERC721"; -import { Transfer } from "../generated/schema"; - -export function handleTransfer(event: TransferEvent): void { -let entity = new Transfer( -event.transaction.hash.concatI32(event.logIndex.toI32()) -); -entity.from = event.params.from; -entity.to = event.params.to; -entity.tokenId = event.params.tokenId; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - - entity.save(); -} - ```` - - -9. Save and close the file. If you manually removed the function handlers, make sure to also remove any of the unused imports. - -## Step 3: Build Your Subgraph - -Now that we've got all of the important files sorted out, let's build our subgraph artifacts in order to get them ready to be deployed to the Alchemy Subgraphs platform! 🕺 - -1. In your project's root folder, run `graph codegen` (this will re-build and overwrite all of the boilerplate build files with our more refined and efficient subgraph specs specific to our NFT Transfers) - -Your terminal should output the following: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180108/docs/tutorials/alchemy-subgraphs/learn-subgraphs/a1d040c-image.png) - -When you run the command `graph codegen` and see the message `Types generated successfully` in your terminal, it means that The Graph CLI has successfully generated the necessary code based on your subgraph's GraphQL schema (defined in the `schema.graphql` file) and the ABIs of the smart contracts specified in your subgraph manifest (defined in the `subgraph.yaml` file). Overall, the command ensures that your mapping functions (defined in `src/erc-721.ts`) can interact with entity types in a type-safe manner. - -2. Finally, run `graph build` - -Your terminal should now output the following: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180109/docs/tutorials/alchemy-subgraphs/learn-subgraphs/34fa087-image.png) - -When you run the command `graph build`, your subgraph files are compiled, essentially acting as a final build check making sure that your schemas, manifest, and mappings are all correct and compatible. Without this final step, you will not be able to deploy your subgraph to the Alchemy Subgraphs platform. - -## Step 4: Deploy Your Subgraph to Alchemy Subgraphs - -This step is the easiest. 🥞 You'll now deploy the subgraph you built and compiled locally to be hosted on the [Alchemy Subgraphs](https://dashboard.alchemy.com/subgraphs) platform: - -1. Acquire your unique `deploy-key` from the [Alchemy Subgraphs Dashboard](https://subgraphs.alchemy.com/dashboard) (you will need to log in with your Alchemy account) -2. You can use the `default` key provided to you or hit `+ Create Query Key` to create a new one. -3. Plug in your `deploy-key` where it says `COPY_PASTE_YOUR_DEPLOY_KEY_HERE` and then run the following in your terminal (paste it all as one command!): - - - ```shell Bash - graph deploy zkevm-erc721-transfers \ - --version-label v0.0.1-new-version \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key COPY_PASTE_YOUR_DEPLOY_KEY_HERE \ - --ipfs https://ipfs.satsuma.xyz - ``` - - - - Note: If you followed this guide exactly, you might get an output that - indicates this subgraph has already been deployed! - - -Your terminal should output the following: 👀 - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180109/docs/tutorials/alchemy-subgraphs/learn-subgraphs/ca3b775-image.png) - -The key line you want to see in your terminal is: **[Deployed to link](https://subgraphs.alchemy.com/subgraphs/2695/versions/8572)**. - -> You will need to sign in using your Alchemy account to view the subgraph dashboard! - -When you visit the link (which you can share with your community or team of developers), you will get a dashboard loaded with all of the details you'll need about your newly-deployed subgraph: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180110/docs/tutorials/alchemy-subgraphs/learn-subgraphs/282bd7f-image.png) - - - If you get a "Network not supported" error please [reach out to us](/cdn-cgi/l/email-protection#2b585e5b5b44595f6b4a4748434e465205484446) to get Polygon zkEVM enabled for your account. - - ![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180111/docs/tutorials/alchemy-subgraphs/learn-subgraphs/2a63e7c-image.png) - - -Congrats! 🎉 You've just fully built a customized subgraph project and used it to deploy a live subgraph onto the Alchemy Subgraphs platform! ✅ diff --git a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs.mdx b/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs.mdx deleted file mode 100644 index 0df1cff02..000000000 --- a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs.mdx +++ /dev/null @@ -1,212 +0,0 @@ ---- -title: How to Build and Deploy a Subgraph for Mainnet using Alchemy Subgraphs -description: Learn how to build and depoy a subgraph for Ethereum Mainnet that indexes ERC-721 transfer events using Alchemy Subgraphs. -subtitle: Learn how to build and depoy a subgraph for Ethereum Mainnet that indexes ERC-721 transfer events using Alchemy Subgraphs. -slug: docs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs ---- - -## Introduction - -In this guide, we will walk you through the process of creating a simple subgraph hosted on the Alchemy Subgraphs platform and deployed for Ethereum Mainnet. The subgraph will be a simple one that indexes an ERC-721 contract's [Transfer](https://docs.openzeppelin.com/contracts/2.x/api/token/erc721#IERC721-Transfer-address-address-uint256-) events - feel free to copy this same exact flow with a contract of your choice. - -## Developer Environment - -Before proceeding with the guide, ensure you meet the following requirements: - -* **Node.js**: You must have Node.js version 18 or higher installed on your system. If you do not have Node.js installed, or if your version is lower than 18, you can download the latest version from the official website. -* Run `node -v` to verify. -* Install the [Graph CLI (graph-cli) NPM package](https://www.npmjs.com/package/@graphprotocol/graph-cli) globally by running `npm i -g @graphprotocol/graph-cli`. - -## Step 1: Run the Subgraph CLI Wizard - -Let's set up a local project to put together all the files that will be used to build and deploy our subgraph: - -1. Navigate to a directory where you want to initialize your project - -2. Make sure you have the [Graph CLI (graph-cli) NPM package](https://www.npmjs.com/package/@graphprotocol/graph-cli) installed globally. Run `npm i -g @graphprotocol/graph-cli` - - 1. Run `graph` to verify you have this package installed - -3. Create an `abis` folder in your project directory - -4. Copy the contract ABI on [Etherscan](https://etherscan.io/address/0xbd3531da5cf5857e7cfaa92426877b022e612cf8#code) for the Pudgy Penguins contract. Paste the ABI into a file called `pudgy-penguins.json` within the `abis` folder - -5. Run `graph init --from-contract 0xBd3531dA5CF5857e7CfAA92426877b022e612cf8 --abi 'abis/pudgy-penguins.json'` to initialize the package's CLI wizard and select the following options: - - 1. **Protocol**: `ethereum` - 2. **Product for which to initialize**: `hosted-service` - 3. **Subgraph name**: `alchemy/my-subgraph` - 4. **Directory to create the subgraph in**: `my-subgraph` - 5. **Ethereum network**: `mainnet` - 6. **Contract address**: [0xBd3531dA5CF5857e7CfAA92426877b022e612cf8](https://etherscan.io/address/0xbd3531da5cf5857e7cfaa92426877b022e612cf8) - 7. **Start block**: The wizard should fill in a start block automatically, `12876179`, press Enter! (this is the start block where the Pudgy Penguins NFT contract was first deployed - indexing from block `0` would be unnecessary and wasteful) - 8. **Contract name**: `PudgyPenguins` - 9. **Index contract events as entities (Y/n)**: `y` (press Enter) - 10. Once the wizard process begins, you will be asked if you want to add another contract: `n` - -The wizard will now finish the local subgraph build process. Once done, your terminal should look like this: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180112/docs/tutorials/alchemy-subgraphs/learn-subgraphs/aae39be-Screenshot_2023-10-30_at_10.40.39_AM.png) - -## Step 2: Set Up Your Local Files - -> If you don't want to create a simplified version of this subgraph below, you are ready to deploy your subgraph to the Alchemy Subgraphs platform. Go to Step #4 if you want to skip the deep dive into the files of the project below. - -First of all, make sure to navigate to the newly created project you just set up with Step #1: - -1. Run `cd my-subgraphs` -2. Open the folder in your preferred IDE and get familiar with the project files: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180107/docs/tutorials/alchemy-subgraphs/learn-subgraphs/0641fb3-Screenshot_2023-10-30_at_10.45.26_AM.png) - -When building subgraphs, there are **three main files** you want to focus on before everything works properly: - -1. **`schema.graphql` **: This file defines the GraphQL schema for your subgraph. The GraphQL schema is basically the data blueprint of what you want to index from the blockchain and in what format. The schema is used to define **entities**, which are used to generate the database and the GraphQL API, enabling developers to perform queries on the indexed data. **In blockchain subgraph land, typically entities are just what contract Events you want to index and how.** - -> Entities are simply interfaces for the data you want to index. For example, if you are indexing NFT transfers, you can have an entity named `Transfer` with fields such as id, fromAddress, toAddress, tokenId, and timestamp. - -2. **`subgraph.yaml`**(also referred to as the *subgraph manifest*): This file contains all of the key data regarding how the subgraph should be built. It references the entities defined in the `schema.graphql`. If you open the file in your local project, you'll notice it contains a lot of what you filled in during the wizard process like the contract `address` and `startBlock`. The manifest basically aggregates all of of your subgraph's most important data into one file. -3. **the `.ts` file inside `/src` that was auto-generated by the wizard process** (if you are following this guide, it is called `pudgy-penguins.ts`): This file contains the function handlers for your entities. When your subgraph indexes a new event, it will run the function, defined in this file, (and mapped to the entity in the `subgraph.yaml` file) to that entity. - - - Notice: the wizard process creates a `/abis` folder and automatically - populates the contract `abi`, which you'll need. The file is called - `PudgyPenguins.json` in this guide project. - - -Ok, now that we've defined what the most important files in our project are, let's continue with the steps from above... - -The wizard process, by default, sets you up with a fully loaded project correspondent to the smart contract you loaded. This means it will read the contract's ABI and create an entity for each of the contract's defined events. If you open the project's `schema.graphql` file, you'll notice all of the Pudgy Penguin NFT contract events defined as entities. This is great if you're building a wide-range app specific to Pudgy Penguins, but for our purposes let's keep things simple and only work with one entity: the `Transfer` entity. - -3. Open the `schema.graphql` file and remove every entity except the `Transfer` entity. You can overwrite the file and copy-paste the following: - - - ```Text Typescript - type Transfer @entity(immutable: true) { - id: Bytes! - from: Bytes! # address - to: Bytes! # address - tokenId: BigInt! # uint256 - blockNumber: BigInt! - blockTimestamp: BigInt! - transactionHash: Bytes! - } - ``` - - -4. Save and close the file. -5. Now, open the `subgraph.yaml` file. - -We want to remove everything that is not specific to the `Transfer` event of the Pudgy Penguins smart contract. - -6. Remove any mentions of entities that aren't Transfer or overwrite the file and copy-paste the following: - - - ```Text yaml specVersion: 0.0.5 schema: file: ./schema.graphql dataSources: - - kind: ethereum name: PudgyPenguins network: mainnet source: address: - "0xBd3531dA5CF5857e7CfAA92426877b022e612cf8" abi: PudgyPenguins startBlock: - 12876179 mapping: kind: ethereum/events apiVersion: 0.0.7 language: - wasm/assemblyscript entities: - Transfer abis: - name: PudgyPenguins file: - ./abis/PudgyPenguins.json eventHandlers: - event: Transfer(indexed - address,indexed address,indexed uint256) handler: handleTransfer file: - ./src/pudgy-penguins.ts - ``` - - -> Notice, these are the same exact file contents as the boilerplate but we are just removing anything not specific to the `Transfer` entity. - -7. Save and close the file. -8. Now, open the `pudgy-penguins.ts` file in the `/src` folder. Remove any function handlers non-specific to the `Transfer` event or overwrite the file and copy-paste the following: - - - ```Text Typescript - import { Transfer as TransferEvent } from "../generated/PudgyPenguins/PudgyPenguins"; - import { Transfer } from "../generated/schema"; - - export function handleTransfer(event: TransferEvent): void { - let entity = new Transfer( - event.transaction.hash.concatI32(event.logIndex.toI32()) - ); - entity.from = event.params.from; - entity.to = event.params.to; - entity.tokenId = event.params.tokenId; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - - entity.save(); - } - ``` - - -9. Save and close the file. If you manually removed the function handlers, make sure to also remove any of the unused imports. - -## Step 3: Build Your Subgraph - -Now that we've got all of the important files sorted out, let's build our subgraph artifacts in order to get them ready to be deployed to the Alchemy Subgraphs platform! 🕺 - -1. In your project's root folder, run `graph codegen` (this will re-build and overwrite all of the boilerplate build files with our more refined and efficient subgraph specs specific to Pudgy Penguin Transfers) - -Your terminal should output the following: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180113/docs/tutorials/alchemy-subgraphs/learn-subgraphs/c457ec8-Screenshot_2023-10-30_at_11.58.14_AM.png) - -When you run the command `graph codegen` and see the message `Types generated successfully` in your terminal, it means that The Graph CLI has successfully generated the necessary code based on your subgraph's GraphQL schema (defined in the `schema.graphql` file) and the ABIs of the smart contracts specified in your subgraph manifest (defined in the `subgraph.yaml` file). Overall, the command ensures that your mapping functions (defined in `src/pudgy-penguings.ts`) can interact with entity types in a type-safe manner. - -2. Finally, run `graph build` - -Your terminal should now output the following: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180114/docs/tutorials/alchemy-subgraphs/learn-subgraphs/1219b33-Screenshot_2023-10-30_at_12.04.15_PM.png) - -When you run the command `graph build`, your subgraph files are compiled, essentially acting as a final build check making sure that your schemas, manifest, and mappings are all correct and compatible. Without this final step, you will not be able to deploy your subgraph to the Alchemy Subgraphs platform. - -## Step 4: Deploy Your Subgraph to Alchemy Subgraphs - -This step is the easiest. 🥞 You'll now deploy the subgraph you built and compiled locally to be hosted on the [Alchemy Subgraphs](https://dashboard.alchemy.com/subgraphs) platform: - -1. Acquire your unique `deploy-key` from the [Alchemy Subgraphs Dashboard](https://subgraphs.alchemy.com/dashboard) (you will need to log in with your Alchemy account) - -2. Click the Add subgraph button - -3. Choose Deploy via Command Line - -4. Copy the `deploy-key` - -5. Plug in your `deploy-key` where it says `COPY_PASTE_YOUR_DEPLOY_KEY_HERE` and then run the following in your terminal (paste it all as one command!): - - - ```Text Bash - graph deploy pudgy-penguins-transfers \ - --version-label v0.0.1-new-version \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key COPY_PASTE_YOUR_DEPLOY_KEY_HERE \ - --ipfs https://ipfs.satsuma.xyz - ``` - - - - Note: If you followed this guide exactly, you might get an output that - indicates this subgraph has already been deployed! - - -Your terminal should output the following: 👀 - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180114/docs/tutorials/alchemy-subgraphs/learn-subgraphs/072b0a3-Screenshot_2023-10-30_at_12.12.45_PM.png) - -The key line you want to see in your terminal is: **[Deployed to link](https://subgraphs.alchemy.com/subgraphs/1911/versions/6380)**. - -> You will need to sign in using your Alchemy account to view the subgraph dashboard! - -When you visit the link (which you can share with your community or team of developers), you will get a dashboard loaded with all of the details you'll need about your newly-deployed subgraph: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180115/docs/tutorials/alchemy-subgraphs/learn-subgraphs/5d27a94-Screenshot_2023-10-30_at_12.15.44_PM.png) - -Congrats! 🎉 You've just fully built a customized subgraph project and used it to deploy a live subgraph onto the Alchemy Subgraphs platform! ✅ - -*** - -What’s Next - -Follow the next guide in order to learn how to query your subgraph! diff --git a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-query-a-subgraph.mdx b/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-query-a-subgraph.mdx deleted file mode 100644 index 046f10faf..000000000 --- a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/how-to-query-a-subgraph.mdx +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: How To Query a Subgraph -description: See examples on how to query subgraphs deployed on Alchemy Subgraphs. -subtitle: See examples on how to query subgraphs deployed on Alchemy Subgraphs. -slug: docs/how-to-query-a-subgraph ---- - -## Introduction - -In this guide, we will walk you through the process of querying an already-deployed subgraph on the Alchemy Subgraphs platform. We will include a couple of simple queries to help you get an idea on the type of data you can get using subgraphs. - -There are a couple of ways you can query a subgraph, we will cover using: - -1. [Alchemy Subgraphs](https://subgraphs.alchemy.com/dashboard) GraphQL Playground -2. [Postman](https://www.postman.com/) - -## 1. Using the Alchemy Subgraphs GraphQL Playground - -1. Go to one of your deployed subgraphs in the [Alchemy Subgraphs Dashboard](https://subgraphs.alchemy.com/dashboard) and go to the `Playground` URL at the center-top of the page -2. Check out the GraphiQL interface. This playground let's you type in GraphQL-formatted queries and send them as a data request to the loaded subgraph. - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180116/docs/tutorials/alchemy-subgraphs/learn-subgraphs/a02e8b8-Screenshot_2023-10-30_at_1.11.14_PM.png) - -3. Delete all of the comments so you have a clean input space to play with. -4. Copy-paste one of the following queries into the playground, then hit the Play button or press Ctrl + Enter (or Cmd + Enter on Mac) to execute the query: - -## Sample Queries - -If you are using the Pudgy Penguins Transfers subgraph you built in the previous guides, here are some queries you can make: - -## Query to get the first 100 Pudgy Penguin transfers: - - - ```Text GraphQL - { - transfers(first: 100) { - id - from - to - tokenId - blockNumber - blockTimestamp - transactionHash - } - } - ``` - - -## Query to get all transfers from a specific address - - - ```Text GraphQL - { - transfers(where: { from: "0xSpecificAddress" }) { - id - from - to - tokenId - blockNumber - blockTimestamp - transactionHash - } - } - ``` - - -> You can try `0x29469395eAf6f95920E59F858042f0e28D98a20B` for the above query. - -## Query to get all transfers related to a specific tokenId - - - ```Text GraphQL - { - transfers(where: { tokenId: "SPECIFIC_TOKEN_ID" }) { - id - from - to - tokenId - blockNumber - blockTimestamp - transactionHash - } - } - ``` - - -> You can try tokenId `3389` for the above query. - -## 2. Using Postman - -Postman is a great way to quickly test your subgraph and how a simple query looks like when the subgraph responds. - -1. [Download](https://www.postman.com/downloads/) and open the Postman application -2. Select 'New' and select 'HTTP' from the query options. -3. Enter your subgraph's URL endpoint into the URL field. -4. In the 'Headers' tab, set the `Key` to `Content-Type` and the `Value` to `application/json` -5. In the 'Body' tab, select the `raw` radio button -6. Finally, enter your query as a JSON object in the `query`, you can use this one, for example, to get all the transfers on Pudgy Penguin 100: - - - ```Text JSON - { - "query": "query { transfers(where: { tokenId: \"100\" }) { id from to tokenId blockNumber blockTimestamp transactionHash } }" - } - ``` - - -7. Hit 'Send' - -You should now see the data print in the Postman console! ✅ diff --git a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/introduction-to-subgraphs.mdx b/fern/tutorials/alchemy-subgraphs/learn-subgraphs/introduction-to-subgraphs.mdx deleted file mode 100644 index 4d43de4d2..000000000 --- a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/introduction-to-subgraphs.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Introduction to Subgraphs -description: Alchemy Subgraphs allow developers to create specialized APIs, aka subgraphs , that define how to ingest, process, and store information from the blockchain, making it easier for apps to query blockchain data. What is a subgraph? Subgraphs aggregate application-specific blockchain data for quick acc... -subtitle: Alchemy Subgraphs allow developers to create specialized APIs, aka subgraphs , that define how to ingest, process, and store information from the blockchain, making it easier for apps to query blockchain data. What is a subgraph? Subgraphs aggregate application-specific blockchain data for quick acc... -slug: docs/introduction-to-subgraphs ---- - -Alchemy Subgraphs allow developers to create specialized APIs, aka **subgraphs**, that define how to ingest, process, and store information from the blockchain, making it easier for apps to query blockchain data. - -## What is a subgraph? - -**Subgraphs aggregate application-specific blockchain data for quick access to frontend developers.** - -Subgraph are exposed to developers via GraphQL APIs, allowing users to query the transaction data happening on their contract in real time. Subgraphs are especially beneficial for developers of complex, custom smart contracts that need to have robust frontend interfaces. - -For example, to query all transactions within a single Uniswap v3 liquidity pool over the last 24 hours, Uniswap simply needs to define their schema, index the event data to create the subgraph, and then use the generated GraphQL API to query their subgraph for flexible and efficient blockchain data. - -Subgraphs allow developers to filter and sort data based on their needs, letting them extract only the information important to their dapp. Subgraphs also enable more efficient data querying by precompiling and indexing data to speed up the querying process instead of requesting data directly from full nodes or archive nodes. Let's dive in further... 🤿 - -## Why Do We Need Subgraphs & What Problem Do They Solve? - -Before we dive deeper into subgraphs, let's first quickly analyze blockchains as data structures. It's helpful to view blockchains simply as databases that are distributed and decentralized. Blockchain databases grow by perpetually adding new blocks, each full of data. - -The thing about blockchains is, if viewed as databases, they mainly optimize for: - -* **Immutability**: once data is added, it is really difficult to change that data, so data integrity and historical accuracy is excellent. -* **Transparency**: all data is public, verifiable and accessible by all. -* **Decentralization**: blockchains deliver trustless and censorship-resistant server environments for all to use, given there is no central operator. -* **Security**: all transactions must be independently verified by all network participants, which makes fraudulent transactions virtually impossible. - -All of the above properties are **awesome** for a database to have! They enable applications built on blockchain databases to be really powerful, as developers can lace these properties into the user experience. - -*However*, while blockchains optimize for all of the above properties in great ways, they are not so great for complex data querying. When you need to find a specific piece of data in the blockchain, you need to read through *every single block ever* and attempt to find your specific piece of data - this is obviously not very efficient! Modern databases (ie, SQL, MongoDB, Postgres DB) are a great solution for complex data querying; **subgraphs** will help us set up and maintain one such database to help us perform quick and efficient complex data queries to the blockchain. - -Say, for example, you are writing a blockchain analytics app and you want to get all of the latest transfers on the $USDC smart contract at `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`. Without a subgraph, you'd need to brute force the last 10 or so blocks on the chain, each containing ~150 transactions. In each block, you'd have to check each transaction to see if there was any interaction with the relevant contract address. That's a lot of brute-force searching and that's just for 10 blocks! Here's how a subgraph can help make this query more efficient: - -![](https://alchemyapi-res.cloudinary.com/image/upload/v1764180117/docs/tutorials/alchemy-subgraphs/learn-subgraphs/becfea4-image_10.png) - -As seen in the diagram above, subgraphs are helpful for indexing complex blockchain data into easily queryable formats, unlocking faster speed and data reliability for end-user and developers alike. The subgraph will consume all of our wanted data for us and set it up in easy-to-query format for us to enjoy as application developers. This subgraph solution becomes even more needed when you need to calculate some aggregate data across all historical blocks, like total inflows ever for a pool. - -Want to dive deeper? Check out [this comprehensive Alchemy blog post on subgraphs](https://www.alchemy.com/overviews/what-is-a-subgraph#what-is-a-subgraph)! diff --git a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/learn-subgraphs.mdx b/fern/tutorials/alchemy-subgraphs/learn-subgraphs/learn-subgraphs.mdx deleted file mode 100644 index 17a7551c8..000000000 --- a/fern/tutorials/alchemy-subgraphs/learn-subgraphs/learn-subgraphs.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Learn Subgraphs -description: A series of tutorials designed to teach you about the Alchemy Subgraphs platform and how to build dapps powered by subgraphs on our hosted service. -subtitle: A series of tutorials designed to teach you about the Alchemy Subgraphs platform and how to build dapps powered by subgraphs on our hosted service. -slug: docs/learn-subgraphs ---- - -Welcome to the "Learn Subgraphs" tutorial series. In this series, we aim to provide a quick start understanding of the Alchemy Subgraphs platform and how you can streamline your application's blockchain data querying using subgraphs. - -### **1. [Introduction to Subgraphs](/docs/introduction-to-subgraphs)** - -Learn the high-level general and technical overview of subgraphs. Why do blockchain developers use and need them? What problems do the subgraphs on the Alchemy Subgraphs specifically solve, given alternatives to subgraphs and current providers? - -*** - -### **2. [How to Build and Deploy a Subgraph using Alchemy Subgraphs](/docs/how-to-build-and-deploy-a-subgraph-using-alchemy-subgraphs)** - -Learn how to build a subgraph project locally, compile and then deploy it to be hosted on the Alchemy Subgraphs platform. - -*** - -### **3. [How to Query a Subgraph](/docs/how-to-query-a-subgraph)** - -Once you have a deployed subgraph, learn the various ways you can test and query it to get data in the GraphQL format defined in the subgraph's schema. diff --git a/fern/tutorials/alchemy-university/ethereum-basics/what-is-proof-of-stake.mdx b/fern/tutorials/alchemy-university/ethereum-basics/what-is-proof-of-stake.mdx index 15dd642bf..8d2ec10b2 100644 --- a/fern/tutorials/alchemy-university/ethereum-basics/what-is-proof-of-stake.mdx +++ b/fern/tutorials/alchemy-university/ethereum-basics/what-is-proof-of-stake.mdx @@ -53,7 +53,7 @@ There are several methods that take in a **block number** or **block tag** as a * [Proof of stake (POS)](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/) * [The Merge](https://www.alchemy.com/the-merge) -* [The Ethereum Developer Guide to the Merge](/reference/ethereum-developer-guide-to-the-merge) +* [The Ethereum Developer Guide to the Merge](/docs/ethereum-developer-guide-to-the-merge) ## Learn More About Proof of Stake diff --git a/src/openapi/portfolio/portfolio.yaml b/src/openapi/portfolio/portfolio.yaml index 031e84cfd..6ff15abed 100644 --- a/src/openapi/portfolio/portfolio.yaml +++ b/src/openapi/portfolio/portfolio.yaml @@ -194,32 +194,6 @@ paths: # $ref: "#/components/schemas/ErrorResponse" # operationId: blocks-by-timestamp # #################################################### - # # Subgraphs - # #################################################### - # # NOTE: This should be hidden from the user. - # "/{apiKey}/subgraphs": - # post: - # summary: Placeholder for Subgraphs - # description: > - # Placeholder for the Subgraphs - in order to update this you'll need to move it back and forth. - # tags: ["🍊 Subgraphs"] - # parameters: - # - $ref: "#/components/parameters/apiKey" - # requestBody: - # required: true - # content: - # application/json: - # schema: - # $ref: "#/components/schemas/ByAddressRequest" - # responses: - # "200": - # description: Successful response! - # content: - # application/json: - # schema: - # $ref: "#/components/schemas/TokenPricesResponse" - # operationId: subgraphs-placeholder - # #################################################### # # Webhooks # #################################################### # # NOTE: This should be hidden from the user.