Integrating into a Dapp

Eliza Okto Plugin Setup

A plugin that connects Eliza AI with Okto's Web3 infrastructure for natural language blockchain interactions.

Quick Start Template Available!

Get started quickly with our pre-configured example that demonstrates the Okto Eliza Plugin in action. This implementation includes authentication setup, basic Web3 operations, and example conversations.

Getting Started

This guide assumes you have an existing Eliza project where you want to add Web3 capabilities. If you're new to Eliza, you can either:

Warning:Essential Setup Required
Show

Before you begin, set up your developer dashboard by making sure you have :

If you need help, reach out to us on our troubleshooting form and we will contact you.

Prerequisites

Before getting started, ensure you have the following:

  • Node.js (v23+) and pnpm: Download Node.js
  • Existing Eliza Project: A working Eliza project where you want to add Web3 capabilities
  • Okto API Keys: You need your OKTO_CLIENT_PRIVATE_KEY and OKTO_CLIENT_SWA. Obtain these from the Okto Developer Dashboard.
  • Google OAuth Credentials: Create OAuth 2.0 credentials in the Google Cloud Console.
  • LLM Provider Account (Optional): Access to OpenAI, Anthropic, or another supported LLM provider.

Installation

Install the Okto Eliza Plugin package in your project:

npm install @okto_web3/eliza-plugin

Environment Setup

Create a .env file in your project root:

.env
# Okto specific settings
OKTO_ENVIRONMENT=                # Optional. Defaults to "sandbox". Options: sandbox, staging, production.
OKTO_CLIENT_PRIVATE_KEY=         # Required. Your client private key provided by Okto.
OKTO_CLIENT_SWA=                 # Required. Your client SWA provided by Okto.
 
# Google OAuth settings
GOOGLE_CLIENT_ID=                # Required. Get from https://console.cloud.google.com/
GOOGLE_CLIENT_SECRET=            # Required. Get from https://console.cloud.google.com/
 
# Note: You also need to set the environment variable for the LLM you want to use.

Get your OKTO_CLIENT_PRIVATE_KEY and OKTO_CLIENT_SWA from the Okto Dashboard.

Tip:Setting up Google OAuth
Show
  1. Go to Google Cloud Console
  2. Create OAuth 2.0 credentials for your project
  3. Set the redirect URI to: http://localhost:5000
  4. Save your Client ID and Client Secret in the .env file

Need detailed instructions? Check our Google Console Setup Guide.

Basic Implementation

Initialize the Okto Plugin in your application:

src/index.ts
import { OktoPlugin } from "@okto_web3/eliza-plugin";
 
const oktoPlugin = new OktoPlugin();
 
 return new AgentRuntime({
    databaseAdapter: db,
    token,
    modelProvider: character.modelProvider,
    evaluators: [],
    character,
    plugins: [
      bootstrapPlugin,
      nodePlugin,
      oktoPlugin,
    ].filter(Boolean),
    providers: [],
    actions: [],
    services: [oktoPlugin.oktoService],
    managers: [],
    cacheManager: cache,
  });

Verify Installation

Test your setup by running your agent and trying a basic Web3 command:

bash
pnpm run start

Try these example commands to test the integration:

  • "Show me my wallet balance"
  • "What chains are supported?"
  • "Help me transfer some tokens"

Available Actions

The Okto Eliza Plugin provides the following actions:

ActionDescriptionExample Prompt
OKTO_GET_PORTFOLIOGet user's token portfolio"Show me my portfolio"
OKTO_GET_ACCOUNTGet wallet accounts"What's my wallet address?"
OKTO_GET_CHAINSList supported networks"What chains are supported?"
OKTO_GET_NFT_COLLECTIONSGet NFT collections"Show my NFT collections"
OKTO_GET_ORDERS_HISTORYView transaction history"Show my transaction history"
OKTO_GET_PORTFOLIO_NFTGet NFT portfolio"Display my NFT portfolio"
OKTO_GET_TOKENSList supported tokens"What tokens are supported?"
OKTO_TRANSFERTransfer tokens"Send 0.1 ETH to 0x123..."
OKTO_NFT_TRANSFERTransfer NFTs"Transfer my NFT to 0x456..."
OKTO_SWAPExecute token swaps"Swap ETH for USDC"

Quick Start Template Available!

Get started quickly with our pre-configured example that demonstrates the Okto Eliza Plugin in action. This implementation includes authentication setup, basic Web3 operations, and example conversations.

Need help or have questions? Join our Discord community for support and discussions!

On this page