FAQs
Some common questions we get about Arkiver.
If there's something that we are not addressing here, feel free to hop on to our Discord and let us know.
Who is Arkiver designed for?
Arkiver was built to help any individual, company or DAO, easily access onchain data. We believe that onchain data is the future of data and we want to make it easy for anyone to access it. Some typical use-cases include:
- DAOs / dApp : Arkiver is ideal for serving data to a dApp front-end.
- Public & Internal Analytics : Every blockchain project needs analytics. Arkiver makes it easy to build analytics dashboards.
- Data Scientists : Arkiver makes it easy to access onchain data for data scientists to run backtests, build models, etc.
- Researchers : Arkiver makes it easy to access onchain data for researchers to run analysis, build reports, etc.
- Alerts & Notifications : Arkiver makes it easy to build alerts and notifications based on onchain data using the 'live' datasource feature.
How can I install Arkiver?
You can install the Arkiver CLI by running the following command:
deno install -A --unstable -n arkiver https://deno.land/x/robo_arkiver/cli.ts
If you want to update the Arkiver CLI to the latest version, you can run the following commands:
deno uninstall arkiver
deno install --reload -A --unstable -n arkiver https://deno.land/x/robo_arkiver/cli.ts
Whats an Entity and how does it relate to the GraphQL endpoint?
Arkiver Entities are how you describe the structure of your data. Here's an example:
import { createEntity } from "https://deno.land/x/robo_arkiver/mod.ts";
export const Transfer = createEntity("Transfer", {
timestamp: { type: Number, index: true },
block: { type: Number, index: true },
account: String,
amount: Number,
token: String,
});
Then once the entity is reference in the manifest, the GraphQL will automatically generate a query for the entity. This means, and data you write to this entity will be queryable via GraphQL.
How do you create & delete records?
A record is a single entry in an entity. Arkiver currently users the Mongoose ORM to manage records. Here's an example of how to create a record:
import { Sync } from "./entities/sync.ts";
export const syncHandler: EventHandlerFor<typeof LPAbi, "Sync"> = async ({
event,
client,
store,
}) => {
const { reserve0, reserve1 } = await Sync.create({
address: event.address,
block: Number(event.blockNumber), // Convert from Big Int
reserve1: Number(reserve0), // Convert from Big Int
reserve1: Number(reserve1), // Convert from Big Int
});
};
Can arkiver index multiple contracts? Can arkiver index multiple chains?
Yes and Yes!
To subscribe multiple contracts simple add the additional contracts to the sources:
manifest
.addEntity(Transfer)
.chain("mainnet", { blockRange: 100n })
.addContract({
abi: erc20,
name: "ERC20",
sources: {
"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f": 17736650n,
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": 17756461n,
},
eventHandlers: {
Transfer: transferHandler,
},
});
...
To index multiple chains concurrently, simply add the additional chains to the manifest:
const ethereum = manifest.chain("mainnet");
const arbitrum = manifest.chain("arbitrum");
ethereum.addContract({
abi: erc20,
name: "ERC20",
sources: { "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f": 17736650n },
eventHandlers: { Transfer: transferHandler },
});
arbitrum.addContract({
abi: erc20,
name: "ERC20",
sources: { "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": 17736650n },
eventHandlers: { Transfer: transferHandler },
});
...
Does Arkiver support bigints?
Arkivers uses the mongoose API which doesn't currently support bigints. To maintain accuracy with big ints, it's recommended to convert bigints to and from hex string as required. viem has some nice utility functions for this:
import { formatUnits } from 'npm:viem'
...
const record = new Transfer({
token: address,
hash: event.transactionHash,
block,
from,
to,
value: formatUnits(value, Number(decimals)),
})
Does Arkiver support factory contracts?
Yes! This is particularly useful for indexing DEX pairs, such as Uniswap pairs. Please see this factory example
Why am I getting a "Default RPC trie error" when indexing?
This is an annoying error! And it's because you're using a node that isn't a full archive node. To rememdy this please specify the url(s) of a full archive node(s):
arkiver start . --rpc-urls="arbitrum=ENTER_URL_HERE,ethereum=ENTER_URL_HERE"
Why is my Arkive syncing so slowly?
Usually the reason an Arkive is taking a long time to sync is because there are too many RPC requests or Database requests which are not being executed synchronously. In addition you can use caching to get additional speed. See Best Practices & Optimizing Handlers.
How can I explore the data created by Arkiver
For now the primary way to explore data is through the GraphQL explorer. The link to the explorer is given when you start your Arkive or when you deploy it to arkiver.net. GraphQL Explorer is a no-code query builder. On the left side you can toggle the builder. Once the builder is showing you can click on the available fields to add them to your query.
When you're ready you can click the play button in the center of the screen to execute your query. Results should be shown on the right.
What chains are supported by Arkiver
- Arbitrum
- Avalanche
- Fuji
- Ethereum
- Fantom
- Polygon
- Optimism
- Mumbai
- Sepolia
- PolygonZkEvm
- Localhost