Skip to main content

Building an AI Agent with Secure Wallet Management

This guide walks through a simple agent setup that uses Open Wallet Standard (OWS) for wallet storage and SKALE CLI for transaction prep and BITE encryption. The result is an agent that can generate wallets, prepare transactions, and submit encrypted transactions on SKALE Base.

In This Guide

You’ll build an agent that:
  • Creates a secure, encrypted wallet using OWS
  • Generates a new Ethereum address for SKALE transactions
  • Prepares transaction data using SKALE CLI
  • Encrypts transactions using BITE encryption
  • Operates without exposing private keys to the agent

Prerequisites

  • Node.js 18+ and npm
  • SKALE CLI installed: npm install -g @skalenetwork/cli
  • Open Wallet Standard CLI: npm install -g @open-wallet-standard/core
  • Access to SKALE Base (BITE-enabled chain)

Architecture Overview

The agent never sees private keys. OWS handles all signing operations with AES-256-GCM encryption.

Step 1: Install Dependencies

Install both CLIs globally:
Verify installations:

Step 2: Create Agent Wallet

Create a new wallet for your agent using OWS:
You’ll be prompted to set a password. This encrypts the wallet with AES-256-GCM.
The wallet is stored encrypted at ~/.ows/wallets/skale-agent. The agent never has direct access to the private key.

Get the Wallet Address

Retrieve the Ethereum address for SKALE:
Look for the eip155:1 entry under your skale-agent wallet. The address will be formatted like:
Extract just the address part (after the last colon):

Step 3: Fund the Wallet

Fund the wallet on your target chain before preparing the transaction. For skale-base-sepolia, you can use the SKALE Base Sepolia faucet or transfer test funds from another wallet. Verify the balance:

Step 4: Prepare Transaction Data

Use SKALE CLI to build the unsigned transaction data. OWS handles secure key storage and signing, but it does not prepare the transaction payload for you. In this example, we build a simple ETH transfer:
This creates an unsigned transaction object with the target chain ID and fee fields. If your flow requires a specific nonce or gas limit, set those explicitly when you build the transaction.

Step 5: Encrypt with BITE

Now encrypt the transaction using BITE. The SKALE CLI can encrypt transactions for BITE-enabled chains:
BITE transactions require a manually set gas limit since estimateGas doesn’t work with encrypted payloads. SKALE CLI automatically sets a default of 300000 gas if not specified.

Step 6: Sign with OWS

Use OWS to sign the encrypted transaction. At this stage, the transaction has already been prepared and encrypted; OWS is only responsible for signing with the wallet in its secure vault:
OWS returns the signed transaction without exposing the private key.

Step 7: Submit Transaction

Submit the signed transaction to SKALE Base through the chain RPC:

Complete Agent Script

Here is a complete bash script for the full flow:

Security Benefits

JSON Output for Agents

Both CLIs support JSON output for programmatic use:
This makes it easy to parse results in any programming language.

References