Skip to content
Agentmart
Submit a tool

arkiv-first-write

Set up @arkiv-network/sdk on a verified Arkiv testnet and make a first entity write with funding, safe key custody, explicit expiration, seed reconciliation…

Skill by Arkiv-Network

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying arkiv-first-write?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/arkiv-network-arkiv-first-write

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Set up @arkiv-network/sdk on a verified Arkiv testnet and make a first entity write with funding, safe key custody, explicit expiration, seed reconciliation and query read-back. Tiramisu is the default. Use for a first write, quickstart or minimal SDK example; use arkiv-app-integration for authenticated application endpoints.

Use cases: writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Nov 1, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/arkiv-first-write

What's inside

Skill name
arkiv-first-write
Description
Set up @arkiv-network/sdk on a verified Arkiv testnet and make a first entity write with funding, safe key custody, explicit expiration, seed reconciliation and query read-back. Tiramisu is the default. Use for a first write, quickstart or minimal SDK example; use arkiv-app-integration for authenticated application endpoints.
License
MIT
Metadata
network: tiramisu · verified: 2026-10-08 · arkiv-sdk: >=0.8.1 <0.9
Instructions
188 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (3)

  • SKILL.md
  • estimate.md · references/
  • testing.md · references/

SKILL.md (first lines)

# First Arkiv write

Target **SDK 1.0.0, Rabdi, chain 7794095 (`0x76edaf`)**. Inspect the application's manifest, lockfile and installed declarations before giving executable SDK code. If evidence is unavailable, obtain it first. Read write-safety before bulk work or an uncertain submission.

## Prepare inputs and authorization

Use the app's package manager and explain an SDK upgrade before doing it. The SDK requires viem as a peer; do not force peer requirements. Get a free RPC key at [Hub access keys](https://hub.arkiv.network/access-keys) and fund a dedicated development EOA through the [Hub faucet](https://hub.arkiv.network/faucet). Never request a private key in chat. Keep locally held signing keys in the server's secret store.

Configure `rabdi({ accessKey })` and `http()` from viem. The SDK places the encoded access key in the URL path. Missing or non-string keys raise `MissingAccessKeyError`; an explicitly empty key opts into a heavily limited endpoint that can return HTTP 429. Keep operator keys server-side, sanitize transport errors and never expose keyed URLs in logs. Browser wallets use the RPC configured by their user.

Announce network, signer, entity and spend scope before broadcasting. Verify RPC chain ID and signer balance; compare an unsigned exact gas estimate plus current fee cap and margin with both available funds and the approved budget. An access key does not pay gas or authenticate app users. SDK 1.0.0 has no public create-estimator method: use [the guarded estimator](references/estimate.md), which blocks signing and broadcast.

## Define and create a note

This module exports helpers and performs no write on import. The caller supplies an authorized wallet, matching reader and explicit retention choice. A `recordIntent` callback must durably register this operation before entry; for process-crash recovery use [the importer](../arkiv-write-safety/references/resumable-import.md), which also captures signed bytes before forwarding.

```typescript
import { createPublicClient, createWalletClient, ExpirationTime, type Expiry, type TxParams } from '@arkiv-network/sdk';
import { defineSchema, str, bytes, u64 } from '@arkiv-network/sdk/schema';
import { eq } from '@arkiv-network/sdk/query';
import { rabdi } from '@arkiv-network/sdk/chains';
import { http, type LocalAccount } from 'viem';
import { getGasPrice } from 'viem/actions';

// Diagnostics contain only fixed messages and validated local transaction identifiers.
type SafeDetails = { txHash?: string; entityKey?: string; expiresAt?: bigint };
const safeErrors = new WeakMap<object, { message: string; details: SafeDetails }>();
function safeError(message = 'Arkiv operation failed', details: SafeDetails = {}): Error & SafeDetails {
  const allowed: SafeDetails = {};
  for (const field of ['txHash', 'entityKey'] as const) {
    const value = details[field];
    if (typeof value === 'string' && /^0x[0-9a-fA-F]{64}$/.test(value)) allowed[field] = value;
  }
  if (typeof details.expiresAt === 'bigint' && details.expiresAt >= 0n && details.expiresAt < 2n ** 64n) allowed.expiresAt = details.expiresAt;
  const result = Object.assign(new Error(message), allowed);
  safeErrors.set(result, { message, details: { ...allowed } });
  return result;
}
function sanitizedFailure(error: unknown, fallback = 'Arkiv request failed; reconcile any admitted write before retrying'): Error & SafeDetails {
  const own = error !== null && typeof error === 'object' ? safeErrors.get(error) : undefined;
  if (own) return safeError(own.message, own.details);
  // Preserve this exact cross-recipe preflight verdict, never any attached diagnostics.
  try { if (error instanceof Error && error.message === 'Unsigned preparation/estimate failed') return safeError('Unsigned preparation/estimate failed'); } catch {}
  return safeError(fallback);
}



export const Notes = defineSchema('example_first_note', {
  seed_id: str().indexed(), created_at: u64(), body: bytes(),
  media_type: str().default('application/json'),
});
export function clients(account: LocalAccount, accessKey: string) {
  try {
    const chain = rabdi({ accessKey });
    const transport = http(undefined, { retryCount: 0, timeout: 10000,
      fetchOptions: { cache: 'no-store', redirect: 'error' } });
    return { reader: createPublicClient({ chain, transport, cacheTime: 0 }),
      wallet: createWalletClient({ account, chain, transport, cacheTime: 0 }) };
  } catch (error) {
    throw sanitizedFailure(error);
  }
}
export function firstNoteParameters(expiration: Expiry = ExpirationTime.fromDays(1)) {
  return { schema: Notes, values: { seed_id: 'welcome_v1', created_at: u64(Date.now()),
    body: new TextEncoder().encode(JSON.stringify({ text: 'Hello, Arkiv' })) },
    expiration, flags: { readonly: true, permissionlessExtension: false } };
}
type Clients = ReturnType<typeof clients>;
type Wallet = ReturnType<typeof createWalletClient>;
type EstimateLatest = (prepare: (unsigned: Wallet) => Promise<unknown>) => Promise<bigint>;
export async function rabdiTxParams(reader: Clients['reader'], address: LocalAccount['address'],
  approvedMaximumCost: bigint, estimate: bigint, operations = 1): Promise<TxParams> {
  try {
    if (estimate <= 0n || !Number.isSafeInteger(operations) || operations < 1) throw safeError('Valid unsigned estimate and operation count required');
    const floor = 1000000n + 400000n * BigInt(operations - 1);
    const gas = floor > 2n * estimate ? floor : 2n * estimate;
    const block = await reader.getBlock({ blockTag: 'latest' });
    if (typeof block.gasLimit !== 'bigint' || block.gasLimit <= 0n) throw safeError('Latest block gas limit required');
    if (gas > block.gasLimit / 2n) throw safeError('Gas exceeds half the latest block limit; split unprepared work');
    const latest = await reader.getTransactionCount({ address, blockTag: 'latest' });
    if (await reader.getTransactionCount({ address, blockTag: 'pending' }) !== latest) throw safeError('Reconcile pending nonce first');
    const gasPrice = await getGasPrice(reader);
    if (gas * gasPrice > approvedMaximumCost || gas * gasPrice > await reader.getBalance({ address })) throw safeError('Gas cap exceeds budget/balance');
    return await { nonce: latest, gas, gasPrice };
  } catch (error) {
    throw sanitizedFailure(error);
  }
}
export async function ensureFirstNote({ reader, wallet }: Clients,
  recordIntent: (txParams: TxParams) => Promise<void>, expiration: Expiry, approvedMaximumCost: bigint,
  estimateLatest: EstimateLatest) {
  try {
    if (await reader.getChainId() !== 7794095 || wallet.chain?.id !== 7794095) throw safeError('Wrong chain');
    const prior = await reader.select({ $key: true, $creator: true, $creationFlags: true, body: true, media_type: true })
      .from(Notes, { onMismatch: 'throw' }).createdBy(wallet.account.address)
      .where(eq('seed_id', 'welcome_v1')).limit(2).fetch();
    if (prior.entities.length > 1) throw safeError('Duplicate seed; reconcile');
    const expected = new TextEncoder().encode(JSON.stringify({ text: 'Hello, Arkiv' }));
    const existing = prior.entities[0];
    if (existing) {
      const expectedHex = '0x' + Array.from(expected, b => b.toString(16).padStart(2, '0')).join('');
      if (!existing.$creationFlags.readonly || existing.$creationFlags.permissionlessExtension ||
        existing.media_type.value !== 'application/json' || existing.body.value !== expectedHex) throw safeError('Seed differs; reconcile');
      return await { entityKey: existing.$key, reused: true as const };
    }
    // Precondition: exclusive writer, sufficient funding, successful unsigned estimate,
    // and no unresolved earlier seed attempt in the durable operation registry.
    const input = { ...firstNoteParameters(expiration), salt: 1n };
    const options = { expiration: input.expiration, flags: input.flags, salt: input.salt };
    const estimate = await estimateLatest(unsigned => unsigned.createEntity(input.schema, input.values, options));
    const txParams = await rabdiTxParams(reader, wallet.account.address, approvedMaximumCost, estimate);
    await recordIntent(txParams);
    const result = await wallet.createEntity(input.schema, input.values,
      options, txParams);
    // Persist returned hash/key immediately in the caller's durable writer.
    try {
      const receipt = await reader.getTransactionReceipt({ hash: result.txHash });
      const entity = await reader.getEntity(result.entityKey, Notes);

From Arkiv-Network/skills, MIT.

More from Arkiv-Network/skills

Signals

Stars
1
Forks
1
Open issues
9
Last commit (this folder)
Oct 16, 2026 (16 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Arkiv-Network

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get arkiv-first-write running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying arkiv-first-write?

CallGet help
Cite this page

arkiv-first-write skill. Agent Mart. https://agentmart.dev/skills/arkiv-network-arkiv-first-write (last updated 2026-10-24)