---
title: Using the SDK
description: Get started building with Intuition in minutes.
url: https://docs.intuition.systems/docs/v1/quick-start/using-the-sdk
markdown_url: https://docs.intuition.systems/docs/v1/quick-start/using-the-sdk.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

## Intuition SDK Quick Start

Get started building with Intuition in minutes. 

This guide provides direct code snippets to create atoms, triples, and signal on them.

Before starting development, we recommend adding the Intuition Testnet and Mainnet networks to your preferred wallet. You can find the networks in the [Network Details](https://docs.intuition.systems/docs/v1/quick-start/network-details) page.

## Installation
In most cases, you will only need to install the `@0xintuition/sdk` package. This package provides a high-level API for interacting with the Intuition protocol, plus exports the core `@0xintuition/protocol` and `@0xintuition/graphql` functionality.

**Primary dependencies:**

The `@0xintuition/sdk` package is the only required package to get started.

### npm

```bash
npm install @0xintuition/sdk@3.0.1
```

### pnpm

```bash
pnpm add @0xintuition/sdk@3.0.1
```

### yarn

```bash
yarn add @0xintuition/sdk@3.0.1
```

### bun

```bash
bun add @0xintuition/sdk@3.0.1
```

If you're starting a new project entirely, be sure to install the required peer dependencies as well.

### npm

```bash
npm install @0xintuition/sdk@3.0.1 viem@latest
```

### pnpm

```bash
pnpm add @0xintuition/sdk@3.0.1 viem@latest
```

### yarn

```bash
yarn add @0xintuition/sdk@3.0.1 viem@latest
```

### bun

```bash
bun add @0xintuition/sdk@3.0.1 viem@latest
```

**Secondary dependencies:**

If you need to interact with the Intuition contracts directly, you will need to install the `@0xintuition/protocol` package.

### npm

```bash
npm install @0xintuition/protocol@2.0.3 @0xintuition/graphql@3.0.1
```

### pnpm

```bash
pnpm add @0xintuition/protocol@2.0.3 @0xintuition/graphql@3.0.1
```

### yarn

```bash
yarn add @0xintuition/protocol@2.0.3 @0xintuition/graphql@3.0.1
```

### bun

```bash
bun add @0xintuition/protocol@2.0.3 @0xintuition/graphql@3.0.1
```

## Prerequisites

- Node.js 18+ and npm/pnpm/bun
- An Ethereum wallet (MetaMask, Coinbase Wallet, etc.)
- Basic knowledge of React and TypeScript

This guide uses the v2 contract architecture and requires the following package versions:
- [`@0xintuition/sdk@^3.0.0`](https://www.npmjs.com/package/@0xintuition/sdk)
- [`@0xintuition/protocol@^2.0.0`](https://www.npmjs.com/package/@0xintuition/protocol)
- [`@0xintuition/graphql@^3.0.0`](https://www.npmjs.com/package/@0xintuition/graphql)

### Setup A Public and Wallet Provider
The Intuition SDK is designed to work with the [viem](https://viem.sh/) library. You will need to setup a public client and a wallet client to interact with the Intuition contracts via the `@0xintuition/sdk` and `@0xintuition/protocol` packages.

### Setup a Public Client

Testnet
```typescript
import { intuitionTestnet } from '@0xintuition/sdk' // or `@0xintuition/protocol`
import { createPublicClient, http } from 'viem'

export const publicClient = createPublicClient({
  chain: intuitionTestnet,
  transport: http(),
})
```

Mainnet
```typescript
import { intuitionMainnet } from '@0xintuition/sdk' // or `@0xintuition/protocol`
import { createPublicClient, http } from 'viem'
export const publicClient = createPublicClient({
  chain: intuitionMainnet,
  transport: http(),
})
```

### Setup a Wallet Client
If you are using wagmi, you can use the `useWalletClient` hook and do not need to set up a wallet client manually. The snippets below show Node/server clients using an RPC transport and a local account.

Use only a disposable development key in a literal placeholder like this; never hardcode or commit a real private key. Production applications should load signing credentials from a secure secret manager.

#### Testnet (Node/server)
When developing an application use the `intuitionTestnet` chain.
```typescript
import { intuitionTestnet } from '@0xintuition/sdk' // or `@0xintuition/protocol`
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...')
export const walletClient = createWalletClient({
  chain: intuitionTestnet,
  account,
  transport: http(),
})
```

#### Mainnet (Node/server)
When deploying to production remember to use the `intuitionMainnet` chain.

```typescript
import { intuitionMainnet } from '@0xintuition/sdk' // or `@0xintuition/protocol`
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...')
export const walletClient = createWalletClient({
  chain: intuitionMainnet,
  account,
  transport: http(),
})
```

### Pair SDK Reads with the Selected Network

SDK read helpers use the mainnet GraphQL API by default. Because the examples below write to Intuition Testnet, configure the testnet read endpoint once during application startup so newly created data is queried from the same network:

```typescript
import { configureSdk } from '@0xintuition/sdk'
import { API_URL_DEV } from '@0xintuition/graphql'

configureSdk({ apiUrl: API_URL_DEV })
```

Use `API_URL_PROD` instead when your public and wallet clients target `intuitionMainnet`.

## Adding Data to the Knowledge Graph
Data in the Intuition protocol is represented as atoms and triples. As a developer you will help users create atoms and triples in the protocol via onchain smart contracts, and retrieving data from the knowledge graph via offchain services.

## Create Atoms

Atoms are the foundational building blocks of Intuition's knowledge graph – the words in our global dictionary. Think of Intuition as a vast, collaborative dictionary where anyone can create a new word, and each word has its own globally persistent, unique digital identifier that can be used to reference it across the entire internet!

[Learn more about Atoms →](https://docs.intuition.systems/docs/v1/intuition-concepts/primitives/Atoms/fundamentals)

The SDK dynamically fetches and forwards the required atom base cost. Any optional amount passed to `createAtomFromString` or its sibling helpers is an additional TRUST/tTRUST deposit (signal), not the required base cost.

### Create an Atom from a String

```typescript
import { createAtomFromString } from '@0xintuition/sdk'
import { getMultiVaultAddressFromChainId } from '@0xintuition/protocol'
import { useWalletClient, usePublicClient, useChainId } from 'wagmi'

function CreateAtom() {
  const chainId = useChainId()
  const publicClient = usePublicClient()
  const { data: walletClient } = useWalletClient()

  const handleCreate = async () => {
    const address = getMultiVaultAddressFromChainId(chainId)

    const result = await createAtomFromString(
      { walletClient, publicClient, address },
      'My First Atom'
    )

    console.log('Atom created:', result.transactionHash)
    console.log('Atom ID:', result.state.termId)
  }

  return <button onClick={handleCreate}>Create Atom</button>
}
```

### Create an Atom from a Thing (with metadata)

```typescript
import { createAtomFromThing } from '@0xintuition/sdk'

const result = await createAtomFromThing(
  { walletClient, publicClient, address },
  {
    url: 'https://example.com',
    name: 'Example Project',
    description: 'A cool Web3 project',
    image: 'https://example.com/image.png',
  }
)
```

### Create an Atom from Ethereum Account

```typescript
import { createAtomFromEthereumAccount } from '@0xintuition/sdk'

const result = await createAtomFromEthereumAccount(
  { walletClient, publicClient, address },
  {
    address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    chainId: 1, // Mainnet
  }
)
```

## Reading Data

### Get Atom Details

Retrieve detailed information about an atom using its ID:

```typescript
import { getAtomDetails } from '@0xintuition/sdk'

const atomData = await getAtomDetails(
  '0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769'
)

console.log('Atom data:', atomData)
// Returns atom information including metadata, vault details, and more
```

### Get Triple Details

Retrieve information about a triple relationship:

```typescript
import { getTripleDetails } from '@0xintuition/sdk'

const tripleData = await getTripleDetails(
  '0xc4e64dbc3d69293d28259653d9b15d2ab3f6aa1aa0b1a489e5250974cd089730'
)

console.log('Triple data:', tripleData)
// Returns subject, predicate, object atoms and relationship metadata
```

### Search the Knowledge Graph

Perform a global search across atoms, triples, accounts, and collections:

```typescript
import { globalSearch } from '@0xintuition/sdk'

const results = await globalSearch('ethereum', {
  atomsLimit: 10,
  accountsLimit: 5,
  triplesLimit: 10,
  collectionsLimit: 5,
})

console.log('Search results:', results)
```

### Read On-Chain Atom Data

Read atom data directly from the smart contract:

```typescript
import { getAtom } from '@0xintuition/protocol'

const atomOnChain = await getAtom(
  { publicClient, address },
  { args: [BigInt(atomId)] }
)

console.log('On-chain atom:', atomOnChain)
// Returns [walletAddress, vaultId, atomData]
```

## Creating Triples

If Atoms are the words in Intuition's global dictionary, Triples are the sentences we create from those words. A Triple connects three Atoms to assert a relationship or fact in the form **[Subject] – [Predicate] – [Object]**. You can string these sentences together to express any arbitrarily-complex concept, all while retaining a discrete, referenceable structure!

[Learn more about Triples →](https://docs.intuition.systems/docs/v1/intuition-concepts/primitives/Triples/fundamentals)

```typescript
import { createAtomFromString, createTripleStatement } from '@0xintuition/sdk'

// First create three atoms
const subject = await createAtomFromString(
  { walletClient, publicClient, address },
  'Alice'
)

const predicate = await createAtomFromString(
  { walletClient, publicClient, address },
  'knows'
)

const object = await createAtomFromString(
  { walletClient, publicClient, address },
  'Bob'
)

// Create the triple: "Alice knows Bob"
const triple = await createTripleStatement(
  { walletClient, publicClient, address },
  {
    args: [
      subject.state.termId,
      predicate.state.termId,
      object.state.termId
    ],
    value: 1000000000000000000n, // 1 TRUST deposit in wei
  }
)

console.log('Triple created:', triple.transactionHash)
```

## Signaling (Staking on Atoms/Triples)

Signals represent the trust, confidence, or relevance that the community assigns to Atoms and Triples in the Intuition knowledge graph. Think of the knowledge graph as a weighted graph where Signal is the weight on each node (Atom) or edge (Triple), indicating how strongly people believe in or care about this information.

[Learn more about Signals →](https://docs.intuition.systems/docs/v1/intuition-concepts/primitives/Signals/fundamentals)

### Deposit (Signal Support)

```typescript
import { deposit } from '@0xintuition/protocol'

// Deposit on an atom or triple vault
const txHash = await deposit(
  { walletClient, publicClient, address },
  {
    args: [
      BigInt(vaultId), // The vault ID (atom or triple)
      BigInt(depositAmount), // Amount in wei
      walletClient.account.address // Receiver address
    ],
    value: BigInt(depositAmount),
  }
)

console.log('Deposited:', txHash)
```

### Redeem (Remove Signal)

```typescript
import { redeem } from '@0xintuition/protocol'

// Redeem from a vault
const txHash = await redeem(
  { walletClient, publicClient, address },
  {
    args: [
      BigInt(vaultId), // The vault ID
      BigInt(sharesToRedeem), // Amount of shares to redeem
      walletClient.account.address, // Receiver address
      walletClient.account.address, // Owner address
    ]
  }
)

console.log('Redeemed:', txHash)
```

### Preview Redeem

Preview how many assets you'll receive when redeeming shares:

```typescript
import { previewRedeem } from '@0xintuition/protocol'

// Preview redeem to see assets received
const assetsToReceive = await previewRedeem(
  { walletClient, publicClient, address },
  { args: [BigInt(vaultId), BigInt(sharesToRedeem)] }
)

console.log('Assets you will receive:', assetsToReceive)
```

## Complete Example Component

```typescript
import { useState } from 'react'
import { useWalletClient, usePublicClient, useChainId } from 'wagmi'
import {
  configureSdk,
  createAtomFromString,
  createTripleStatement,
} from '@0xintuition/sdk'
import { API_URL_DEV } from '@0xintuition/graphql'
import { getMultiVaultAddressFromChainId, deposit } from '@0xintuition/protocol'

// SDK reads default to mainnet; pair reads with the testnet write chain.
configureSdk({ apiUrl: API_URL_DEV })

function IntuitionQuickstart() {
  const chainId = useChainId()
  const publicClient = usePublicClient()
  const { data: walletClient } = useWalletClient()
  const [atomId, setAtomId] = useState<string>('')

  const address = getMultiVaultAddressFromChainId(chainId)

  const createAtom = async () => {
    const result = await createAtomFromString(
      { walletClient, publicClient, address },
      'My Cool Idea'
    )
    setAtomId(result.state.termId)
    console.log('Created atom:', result.state.termId)
  }

  const signalAtom = async () => {
    if (!atomId) return

    const depositAmount = 100000000000000000n // 0.1 TRUST
    await deposit(
      { walletClient, publicClient, address },
      {
        args: [BigInt(atomId), depositAmount, walletClient.account.address],
        value: depositAmount,
      }
    )
    console.log('Signaled support!')
  }

  return (
    <div>
      <h1>Intuition Quickstart</h1>
      <button onClick={createAtom}>Create Atom</button>
      {atomId && (
        <button onClick={signalAtom}>Signal Support</button>
      )}
    </div>
  )
}
```

## Advanced Concepts

### Batch Create Atoms

Create multiple atoms in a single transaction for efficiency and gas savings:

```typescript
import { batchCreateAtomsFromThings } from '@0xintuition/sdk'

// Batch create multiple atoms at once
const atomData = [
  {
    url: 'https://example.com/project1',
    name: 'Project 1',
    description: 'First amazing project',
    image: 'https://example.com/project1.png',
  },
  {
    url: 'https://example.com/project2',
    name: 'Project 2',
    description: 'Second amazing project',
    image: 'https://example.com/project2.png',
  },
  {
    url: 'https://example.com/project3',
    name: 'Project 3',
    description: 'Third amazing project',
    image: 'https://example.com/project3.png',
  },
]

const result = await batchCreateAtomsFromThings(
  { walletClient, publicClient, address },
  atomData,
  1000000000000000000n // Optional: additional 1 TRUST signal per atom
)

console.log('Created atoms:', result.state)
console.log('Transaction:', result.transactionHash)
```

### Batch Create Triples

Create multiple triple relationships in a single transaction:

```typescript
import { batchCreateTripleStatements } from '@0xintuition/sdk'

// Assuming you have atom IDs already created
const tripleData = [
  [subjectId1, predicateId1, objectId1], // Triple 1
  [subjectId2, predicateId2, objectId2], // Triple 2
  [subjectId3, predicateId3, objectId3], // Triple 3
]

const result = await batchCreateTripleStatements(
  { walletClient, publicClient, address },
  tripleData,
  1000000000000000000n // Optional: 1 TRUST deposit
)

console.log('Created triples:', result.state)
```

### Batch Deposit

Deposit on multiple vaults (atoms or triples) in a single transaction:

```typescript
import { batchDepositStatement } from '@0xintuition/sdk'

// Deposit on multiple vaults at once
const depositData = [
  [vaultId1, vaultId2, vaultId3], // Vault IDs
  [amount1, amount2, amount3], // Amounts in wei
  [receiverAddress, receiverAddress, receiverAddress], // Receiver addresses
]

const result = await batchDepositStatement(
  { walletClient, publicClient, address },
  depositData
)

console.log('Batch deposit completed:', result.transactionHash)
```

Batch operations significantly reduce gas costs when working with multiple atoms or triples. Instead of paying gas fees for each individual transaction, you pay once for the entire batch.

## Use Cases

Now that you know the basics, explore what you can build:

- **[List Curation & Ranking](https://docs.intuition.systems/docs/v1/getting-started/use-cases#list-curation--ranking-systems)** - Create curated lists and reputation systems
- **[Verification & Fraud Protection](https://docs.intuition.systems/docs/v1/getting-started/use-cases#verification-and-fraud-protection)** - Build trust and safety mechanisms
- **[Social Platforms](https://docs.intuition.systems/docs/v1/getting-started/use-cases#community-owned-social-platforms)** - Portable identities and attestations
- **[Reputation Scores](https://docs.intuition.systems/docs/v1/getting-started/use-cases#reputation-scores)** - Context-aware trust scoring
- **[Q&A Platforms](https://docs.intuition.systems/docs/v1/getting-started/use-cases#qa-platforms)** - Knowledge sharing with proof
- **[Oracles](https://docs.intuition.systems/docs/v1/getting-started/use-cases#oracles)** - Decentralized data feeds

[View all use cases →](https://docs.intuition.systems/docs/v1/getting-started/use-cases)

## Next Steps

- **[Build Your First App](https://docs.intuition.systems/docs/v1/tutorials/overview)** - Complete tutorial for a full application
- **[Network Configuration](https://docs.intuition.systems/docs/v1/quick-start/network-details)** - Detailed network setup
- **[Explore the SDK](https://docs.intuition.systems/docs/v1/intuition-sdk/quick-start)** - Deep dive into SDK capabilities
- **[Smart Contracts](https://docs.intuition.systems/docs/v1/protocol/getting-started/overview)** - Contract architecture and ABIs
- **[GraphQL API](https://docs.intuition.systems/docs/v1/graphql-api/overview)** - Query the knowledge graph
- **[Join the Community](https://docs.intuition.systems/docs/v1/resources/community-and-support)** - Get help and share ideas

Check out [Choose Your Path](https://docs.intuition.systems/docs/v1/getting-started/choose-your-path) to find the best starting point for your project.
