Skip to content

Hosted Environment

This guide explains how to use Amp’s hosted service maintained by Edge & Node. It provides actionable steps for querying published datasets, migrating from local to hosted development, and publishing your own dataset.

Edge & Node maintains real-time indexed blockchain datasets containing blocks, transactions, and logs. These datasets are queryable with SQL.

  • No infrastructure: Skip node management, indexing, and database setup.
  • Instant queries: Access mainnet data with SQL immediately.
  • Production ready: Build applications on reliable, continuously updated datasets.
  • Composable: Combine multiple published datasets in a single query.
  • ethereum-mainnet
  • arbitrum-one
  • base-mainnet
  • base-sepolia

More networks are planned.

  1. Query existing datasets
  2. Transition from local to hosted
  3. Publish your dataset

Use published blockchain datasets without running local infrastructure.

Visit the Amp Playground to validate data availability: https://playground.amp.thegraph.com

Terminal window
pnpm amp auth token --duration "3 days"

Save the token for CLI queries or environment variables.

Terminal window
pnpm amp query \
--flight-url https://gateway.amp.staging.thegraph.com \
--bearer-token YOUR_TOKEN_HERE \
'SELECT block_num, hash FROM "edgeandnode/ethereum_mainnet@0.0.1".blocks ORDER BY block_num DESC LIMIT 5'
Terminal window
pnpm amp query \
--flight-url https://gateway.amp.staging.thegraph.com \
--bearer-token YOUR_TOKEN_HERE \
'SELECT block_num, tx_hash FROM "edgeandnode/ethereum_mainnet@0.0.1".logs WHERE address = 0xYOUR_CONTRACT_ADDRESS LIMIT 10'

Add credentials:

Terminal window
VITE_AMP_QUERY_URL=https://gateway.amp.staging.thegraph.com
VITE_AMP_QUERY_TOKEN=amp_your_token_here

Example client usage:

Terminal window
import { ArrowFlight } from "@edgeandnode/amp";
import { Effect, Stream } from "effect";
const query = Effect.gen(function* () {
const arrow = yield* ArrowFlight.ArrowFlight;
const sql = `
SELECT block_num, hash, gas_used
FROM "edgeandnode/ethereum_mainnet@0.0.1".blocks
WHERE gas_used > 0
ORDER BY block_num DESC
LIMIT 100
`;
return yield* arrow.query([sql] as any).pipe(Stream.runCollect);
});

Migrate your local dataset to a hosted network.

  • Contract deployed to the target network
  • ABI matches the deployed contract

Amp handles indexing when your dataset depends on a published raw dataset.

“bash cp .env.example .env

Enable the target network:
```bash
VITE_AMP_RPC_DATASET=edgeandnode/ethereum_mainnet@0.0.1
VITE_AMP_NETWORK=ethereum-mainnet
import { defineDataset, eventTables } from "@edgeandnode/amp";
// @ts-ignore
import { abi } from "./app/src/lib/abi.ts";
export default defineDataset(() => ({
name: "counter",
network: "ethereum-mainnet",
dependencies: {
rpc: "edgeandnode/ethereum_mainnet@0.0.1",
},
tables: eventTables(abi, "rpc"),
}));

Validate Build

Terminal window
pnpm amp build -o /tmp/test-manifest.json

Generate Token

Terminal window
pnpm amp auth token --duration "3 days"

Verify Connectivity

Terminal window
pnpm amp query \
--flight-url https://gateway.amp.staging.thegraph.com \
--bearer-token YOUR_TOKEN_HERE \
'SELECT block_num, hash FROM "edgeandnode/ethereum_mainnet@0.0.1".blocks ORDER BY block_num DESC LIMIT 5'

Verify Contract Events

Terminal window
pnpm amp query \
--flight-url https://gateway.amp.staging.thegraph.com \
--bearer-token YOUR_TOKEN_HERE \
'SELECT block_num, tx_hash FROM "edgeandnode/ethereum_mainnet@0.0.1".logs WHERE address = 0xYOUR_CONTRACT_ADDRESS LIMIT 10'

If results appear, your configuration is correct.

Terminal window
just dev

Publish your dataset to the Amp registry for public querying.

  • Queries return expected data
  • Contract deployed
  • Dataset defined in amp.config.ts

Add recommended metadata to amp.config.ts for discoverability:

import { defineDataset, eventTables } from "@edgeandnode/amp";
// @ts-ignore
import { abi } from "./app/src/lib/abi.ts";
export default defineDataset(() => ({
name: "counter",
network: "ethereum-mainnet",
dependencies: {
rpc: "edgeandnode/ethereum_mainnet@0.0.1",
},
tables: eventTables(abi, "rpc"),
namespace: "your_namespace",
description: "Counter dataset tracking increment/decrement events",
keywords: ["Ethereum", "Counter", "Events"],
}));
Terminal window
pnpm amp auth login

This opens a browser for wallet or social authentication.

Terminal window
pnpm amp publish --tag "0.0.1" --changelog "Initial release"
  • --tag (REQUIRED) - Semantic version: {major}.{minor}.{patch}
  • --changelog (optional) - Describe changes in this version

Dataset URL:

your_namespace/counter@0.0.1

Generate a long-lived token for your application:

Terminal window
pnpm amp auth token --duration "30 days"

Copy the token and update your .env:

Terminal window
VITE_AMP_QUERY_TOKEN=amp_your_token_here

In your application code, update queries to reference the published version:

// Before (local dev)
const query = 'SELECT * FROM "_/counter@dev".incremented LIMIT 10';
// After (published)
const query =
'SELECT * FROM "your_namespace/counter@0.0.1".incremented LIMIT 10';

Or use @latest to always query the most recent published version:

const query =
'SELECT * FROM "your_namespace/counter@latest".incremented LIMIT 10';

Your dataset is now publicly available. Anyone can query it:

Terminal window
pnpm amp query \
--flight-url https://gateway.amp.staging.thegraph.com \
--bearer-token YOUR_TOKEN \
'SELECT * FROM "your_namespace/counter@0.0.1".incremented LIMIT 10'

View in registry: https://playground.amp.thegraph.com/

To publish a new version:

  1. Update your amp.config.ts
  2. Increment the version: pnpm amp publish --tag "0.0.2" --changelog "Added new derived table"
  3. Users can query @0.0.2 for the new version or @latest to automatically use it
  • @dev - Local development (unpublished)
  • @0.0.1, @1.2.3 - Specific published versions
  • @latest - Most recent published version (updates automatically)