Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
OWS Overview
Using the same wallet from administrative commands and an agent requires both tools to read its stored files, select the same account, and sign with it. Creating a separate wallet for each tool would require transferring funds or handing over private keys every time. Open Wallet Standard (OWS) standardizes wallet storage and signing operations so that an existing wallet can be used from different tools.
Consider an owner who creates a wallet named agent-treasury and uses it from an administrative CLI and a Node.js application. A CLI is a program that lets users operate the wallet by entering commands in a terminal. The owner creates the wallet and issues an authentication token for the agent. The application uses that token to request a signature, and the signing library checks the applicable conditions before returning a result.
Both tools refer to the same stored data through a wallet ID. If they support the storage format and signing operations, changing tools does not require moving funds to another address solely for that purpose.
The figures retain their original Japanese labels, and code samples retain their original placeholders.

OWS consists of a specification defining storage formats and signing semantics, together with libraries implementing it. Version v1.4.4 of the reference implementation exposes signing logic written in Rust through the CLI and language bindings. A binding connects an application's language to functions in the signing library.
The specification standardizes wallet records, account identifiers, signing operations, and their conditions. It does not require every implementation to use identical language-specific function names or server architectures for receiving signing requests. In particular, the language bindings in v1.4.4 run the application and signing logic in the same process. When choosing an implementation, distinguish protection of the code that uses keys from isolation in a separate process.
Wallet Data
When another tool opens agent-treasury, it resolves the display name to a wallet ID and reads the data stored under that ID. A wallet file records encrypted secret data and information about the public accounts derived from it. The structure separates information used to inspect addresses from information that must be decrypted for signing.
Storage locations are also separated according to the purpose of the data.
| Storage location | Contents |
|---|---|
wallets |
Original wallets opened by their owners |
keys |
Agent-token configuration and token-specific encrypted copies |
policies |
Operational conditions evaluated before signing |
logs |
Audit records of operations |
Token-specific secret copies are stored in wallet_secrets under keys and associated with wallet IDs. Using wallet IDs as common references allows multiple tokens to be associated with a single wallet. A token's policy_ids identifies the stored conditions to read when signing with that token. Different conditions can be assigned to different tokens without recreating the address itself.
Chains with an execution environment compatible with Ethereum are called EVM chains. For example, the agent-treasury wallet file records an EVM public account and ciphertext as follows.
{
"ows_version": 2,
"id": "<ウォレットのID>",
"name": "agent-treasury",
"key_type": "mnemonic",
"accounts": [{
"chain_id": "eip155:1",
"address": "<EVMの公開アドレス>",
"account_id": "eip155:1:<EVMの公開アドレス>",
"derivation_path": "m/44'/60'/0'/0/0"
}],
"crypto": {
"cipher": "aes-256-gcm",
"kdf": "scrypt",
"ciphertext": "<暗号文>",
"auth_tag": "<認証タグ>"
}
}The accounts array records multiple public accounts derived from the wallet. The example element associates the Ethereum network with the address used on that network and the derivation path used to generate its key. The crypto field contains the encrypted secret data, which is decrypted only when signing.
| Field | Information provided |
|---|---|
chain_id |
Network on which the operation takes place |
address |
Public address used on that network |
account_id |
Identifier combining the network and address |
derivation_path |
Path specifying which key to derive from the same secret data |
ciphertext |
Encrypted secret data |
auth_tag |
Authentication tag used to detect ciphertext tampering during decryption |
The actual encrypted data also stores a random salt and computational parameters used with the passphrase to derive the decryption key. The initialization vector (IV) used for encryption is read during decryption as well. Storing the conditions for decryption and key derivation alongside the ciphertext allows the stored data to be transferred to another tool.
Format versions are another condition for reading data. The wallet file's ows_version: 2 and the policy file's version: 1, discussed later, refer to separate data formats. The specification requires rejection of unsupported versions or unknown mandatory data; an implementation must not discard fields it cannot read and continue signing. Sharing a directory is not enough: both implementations must understand the required formats and the semantics of the operations.

Seeds and Accounts
To create accounts on multiple chains, a mnemonic wallet starts with a recovery phrase. When creating a wallet, it generates 12 or 24 words and derives chain-specific keys from the seed obtained from that phrase. The seed is the source data used to reproduce the same keys under the same conditions.
A derivation path such as m/44'/60'/0'/0/0 specifies which key to select. Even with the same phrase, changing the path changes the account being used. For example, when selecting the first account with index: 0, the EVM and Solana paths differ.
| Account | Derivation path for index: 0 |
Signing key and address |
|---|---|---|
EVM |
m/44'/60'/0'/0/0 |
Address beginning with 0x, derived from a secp256k1 signing key |
Solana |
m/44'/501'/0'/0' |
ed25519 signing key and a Base58-encoded address |
secp256k1 and ed25519 are the types of keys used for signing by the respective chains. Base58 is a format for representing Solana addresses as strings. If index changes to 1, the last component of the EVM path becomes 1, while the account-number component within the Solana path becomes 1. The signing library selects the path and derivation method corresponding to the target chain.

After deriving a key, the implementation also specifies the network on which the address is used. Under CAIP-2, which identifies networks, Ethereum is represented as eip155:1 and Base as eip155:8453. Solana mainnet is solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.
CAIP-10 further associates an address with a network identifier. The earlier account_id takes the form eip155:1:<EVM public address> because it specifies both the address and where it is used. Even when multiple accounts are derived from the same wallet, balances and transactions on each network are processed separately.
Signing and Authorization
To delegate signing with agent-treasury to an agent, the owner separates the owner-specific decryption path from the token-based path. The original data remains accessible through the owner's passphrase, while the agent receives a separate authentication token. This token refers to the wallets and pre-signing conditions available to it and also serves to decrypt its own dedicated secret copy.
The original wallet is encrypted using a key derived from the passphrase entered by the owner. The reference implementation passes the passphrase and a random salt to the scrypt key derivation function to obtain a 32-byte encryption key. Brute-force attempts against a human-chosen passphrase must incur this derivation cost for every guess.
The resulting key encrypts the recovery secret data using AES-256-GCM. Because this mode attaches an authentication tag to the ciphertext, decryption verification fails if the wrong key is used or if the ciphertext has been modified. The salt and IV are recorded alongside the ciphertext, but the original passphrase is required to recover the secret data.
When issuing an agent token, the owner first decrypts the original secret data using their passphrase. The reference implementation creates a token containing 256 bits of randomness and derives a separate encryption key from it using the HKDF-SHA256 key derivation function. It re-encrypts the same secret data with that key and stores a token-specific copy under keys. This does not replace the original owner file, so the owner can continue to open the original wallet with their passphrase.
The inputs to scrypt, used for human passphrases, and HKDF, used for random tokens, have different properties. Random tokens use sufficiently unpredictable values, which HKDF transforms into keys for encrypting signing secret copies. Creating a separate encrypted copy per token allows multiple access grants to be issued for the same wallet.

A token's stored file associates the data it can decrypt with the conditions it must read.
| Field | Information used by the signing process |
|---|---|
token_hash |
Value used to locate the file from the SHA-256 hash of the presented token |
wallet_ids |
List of wallet IDs authorized for use |
policy_ids |
List of policy IDs evaluated before signing |
wallet_secrets |
Encrypted secret copies associated with wallet IDs |
The raw token is returned to the caller only once, when issued. The stored hash is used for file lookup and comparison, but cannot by itself decrypt the secret copy. The raw token received by the agent and the hash stored on disk therefore serve different purposes.
Token-based signing first checks the target wallet and expiration. It also evaluates policies specifying when signing is permitted, and decrypts the secret copy for authorized requests. By contrast, the reference implementation does not evaluate policies when using the owner's passphrase directly. Giving an owner's passphrase to an agent intended to operate under restrictions prevents access from being confined to the path that enforces the token's conditions.
An adversary who obtains both the raw token and the encrypted copy may also be able to decrypt the copy without going through OWS signing functions. In addition to condition checks inside the signing functions, delegation therefore depends on an execution environment in which the agent cannot freely modify storage or policy evaluation code. The token must be kept as a secret used to unlock the secret copy.
Pre-Signing Policy Evaluation
Issuing a token alone does not define the content an agent may sign. The owner stores pre-signing conditions as policies and associates their IDs with the token's policy_ids. The signing library reads these conditions for every request using the token.
Suppose we want agent-treasury to sign only the message hello for Ethereum. The network and expiration can first be specified using declarative rules, in which the values are expressed as data.
{
"id": "<メッセージ署名の条件を定めるポリシーID>",
"name": "Ethereum message policy",
"version": 1,
"created_at": "<ポリシーの作成時刻>",
"rules": [
{"type": "allowed_chains", "chain_ids": ["eip155:1"]},
{"type": "expires_at", "timestamp": "<署名を許可する期限>"}
],
"action": "deny"
}The rules array contains the conditions evaluated by the policy. The first element compares the request's chain identifier with eip155:1; the other checks whether the specified expiration has passed. In addition, a custom program discussed below checks the signing operation and the message contents.
| Setting | Effect on evaluation |
|---|---|
allowed_chains |
Reject requests for chains other than those allowed |
expires_at |
Reject requests after the specified expiration |
action: "deny" |
Treat a condition violation as a denial |
On receiving a request, the signing library locates the stored file using the token hash, then checks the token's own expiration and wallet scope. If the requested wallet is included in wallet_ids, it evaluates the associated declarative policy rules and then executes the custom program. If any evaluation denies the request, it does not proceed to decryption. Only requests satisfying all conditions reach signing.

The wallet ID check determines which secret data may be used. The chain check determines which network's operations are permitted with that secret data. Evaluating the two separately allows each token to have a different network scope even for accounts derived from the same wallet.
Different Inputs for Different Operations
Signing conditions must be interpreted together with the operations to which they apply. For example, allowed_typed_data_contracts, used when signing structured data, compares the data's domain.verifyingContract against an allowlist. The verifying contract is the contract specified in the data as the signature verification destination; it is distinct from the recipient of an ordinary transaction.
For typed-data signing, the condition passes if the address is on the allowlist and rejects the request if the verifying contract is missing. However, signMessage and signTransaction requests do not contain that typed data. In these cases the reference implementation returns an allow result for allowed_typed_data_contracts. Attaching this condition alone therefore does not prohibit message or transaction signing.
A custom rule restricting operations first reads request_type, which identifies the type of request. Both message-signing and transaction-signing requests contain a field named transaction, so field presence alone cannot distinguish them. Check the operation type first, then examine the corresponding data.
request_type |
Data read by the custom rule |
|---|---|
sign_message |
Message bytes in transaction.raw_hex |
sign_transaction |
Serialized transaction in transaction.raw_hex |
sign_typed_data |
Typed data in typed_data.raw_json |

Custom Rules and Failure-Based Denial
To allow only hello, associate a custom program with the policy to run after the declarative rules. The program receives JSON describing the request on standard input and returns an allow or deny result on standard output. Its input contains request information needed for evaluation, not the signing key.
When requesting a signature for hello on Ethereum, the context passed to the program contains the following values.
{
"chain_id": "eip155:1",
"wallet_id": "<ウォレットのID>",
"api_key_id": "<トークンの保存ID>",
"request_type": "sign_message",
"transaction": {"effects": [], "raw_hex": "68656c6c6f"}
}68656c6c6f is the hexadecimal representation of the UTF-8 bytes of hello. The custom program checks both this value and request_type: "sign_message". For example, an implementation can return {"allow":true} only if both match, and {"allow":false,"reason":"message not permitted"} otherwise, thereby denying other messages and operations.
| Field | Information used for evaluation |
|---|---|
chain_id |
Target network; also checked by declarative rules |
wallet_id |
Wallet associated with the request |
api_key_id |
Token associated with the request |
request_type |
Type of signing operation requested |
transaction.raw_hex |
Bytes of hello in this example |
Because the network and expiration have already been checked by declarative rules, the custom program adds restrictions on the message and operation. Separating which checks are performed where lets applications reuse existing rules while adding application-specific conditions.
For an EVM transaction, parsing the transaction format is also the responsibility of the custom program. In v1.4.4, the supplied effects is empty, and the recipient and amount are not necessarily provided as parsed to and value fields. The program must therefore parse raw_hex and evaluate the amount of native tokens being transferred separately from token amounts in contract call arguments.
A daily spending limit also requires more than parsing an individual request. The reference implementation supplies 0 as spending.daily_total in the context, so simply reading this value cannot enforce a cumulative limit. The custom rule must be designed to record actual spending and update the total, including concurrently arriving requests.
If the evaluation program fails to execute, the request is denied. The same applies if the program cannot start, exits abnormally, returns a response that cannot be parsed as JSON, or exceeds the 5-second timeout. Provide a way to correct the program or input and retry, rather than bypassing signing conditions by switching to the owner's passphrase when evaluation fails.

Execution Environment for Key Decryption
Once the signing request for hello passes every condition, the signing library reads the token-specific encrypted copy. It recomputes the decryption key using the raw token and stored salt with HKDF, then decrypts the secret data using AES-GCM. It derives the target account's key from this data and signs, eliminating the need to enter the owner's passphrase for every request.
Decrypted secret data is present in memory during signing. The reference implementation uses types that protect secret data and clears buffers after use. In addition to storing ciphertext on disk, it protects data during and after decryption and use.
| Mechanism | Protection |
|---|---|
mlock |
Helps prevent memory from being written to disk as swap in supported environments |
zeroize |
Clears memory contents after use, reducing the time secret data remains in memory |
However, the signing logic called through the Node.js bindings in v1.4.4 runs in the same process as the caller. Even with mlock and zeroize, the application and signer are not guaranteed to be isolated in separate address spaces. Protection against process-memory inspection or theft of stored files must be considered separately from the condition checks performed by ordinary signing functions.
Deployment architectures using separate processes or dedicated isolated environments are also possible, but these are choices about the execution environment. One cannot assume that every implementation bearing the OWS name provides the same isolation mechanism. When evaluating an implementation and its deployment, examine where secret data is decrypted and whether the caller can access that memory or those files.

Signing Requests and Submission to the Chain
Once the owner has created agent-treasury and associated the token with network and expiration conditions and a custom rule checking hello, the application can request a signature. The Node.js application retrieves the token from its storage location and passes it to the signing function. There is no need to expose the token in text sent to the language model or in execution logs.
The signMessage function in @open-wallet-standard/core accepts the wallet name, chain, message, and credentials, in that order.
import { signMessage } from "@open-wallet-standard/core";
const token = process.env.OWS_AGENT_TOKEN;
if (!token) throw new Error("OWS_AGENT_TOKEN is required");
const result = signMessage("agent-treasury", "eip155:1", "hello", token);
console.log(result.signature);
console.log(result.recoveryId);The first argument resolves to the wallet ID, and the account corresponding to eip155:1 signs hello. The fourth parameter is named passphrase in the implementation, but credentials beginning with ows_key_ select the token authorization and decryption path. This is a synchronous function call in which the Node.js binding calls the Rust signing library. The computer running it must have access to the same wallet storage location, and the corresponding binding must work in that environment.
| Argument | Value specified by this request |
|---|---|
"agent-treasury" |
Wallet resolved by name |
"eip155:1" |
Network of the EVM account used for signing |
"hello" |
Message to sign |
token |
Value used for conditional authorization and secret-copy decryption |
The application's request first passes token verification, expiration checks, and wallet scope checks. The declarative rules then check the chain and expiration, while the custom program checks that the operation is message signing and that the message is hello. A signing key is derived from the encrypted copy only for an authorized request.
For message signing, the signer prepends a prefix containing the message length to hello, hashes the result using Keccak-256, and signs the hash. This is the EIP191 rule used for EVM message signatures. Unlike sending the five-character string hello as a transaction, the operation returns a signature for that message.
In the EVM implementation of v1.4.4, the value used to recover the public key from the signature is converted to 27 or 28, and that value is also returned in recoveryId. The transaction field for this call is undefined, and the result does not include the private key or raw token. Changing hello to a different string causes the custom rule to deny the request; changing the chain to Base causes the declarative rule to deny it.
When requesting a transaction signature with signTransaction, the caller supplies serialized data. For EVM, the returned value is a signature, so signature alone cannot be submitted as a transaction. Distinguish the complete serialized transaction used for submission from the signature incorporated into it. Submission uses an RPC to send a request to a node over the network.
signAndSend, which combines signing and submission, is a separate operation. The txHash returned after submission identifies the transaction for tracking; it does not guarantee successful execution or finality at that point. The application checks the transaction's execution result before completing business operations such as a payment.

If the response is interrupted, the initial submission may already have progressed. Rather than unconditionally creating a new transfer, inspect any available identifiers and the result on the network before resuming. Balance queries, submission, and payments using x402 to call paid APIs involve network communication. Processing a message signature locally on the host is not the same as completing the entire payment without network communication.
Wallet Operations
After signing is in use, manage revocation of an agent's access separately from recovery of secret data. Issuing a new token for the same wallet changes neither its address nor the location of its assets. If secret data is leaked or lost, the response depends on what must be stopped and what has been lost.
revokeApiKey, which terminates an agent's access, deletes the token's stored file. The signing library can no longer locate that file using the hash of the presented token, so new requests cannot proceed to signing. The original wallet and other token files remain; this does not require recreating the owner's access or the access of other agents.
Issuing a new token re-encrypts the original secret data using a key derived from the new token. Because the account's signing key remains the same, the new token can use the same public address. Token reissuance is distinct from replacing the wallet's key.
However, if both the raw token and encrypted copy have already been stolen, deleting files on the host does not erase the stolen data. Although ordinary signing functions can reject that token, they cannot revoke the ability to decrypt a leaked token-and-copy pair. If the key itself may have been compromised, consider moving assets to an account using a different private key.
Recovery after file loss depends on what was backed up. Restoring the encrypted original wallet file also requires the passphrase that unlocks it. If the recovery phrase was explicitly exported and stored, accounts can be reconstructed from that phrase. Because the phrase is secret information governing the derived accounts, its export destination must also be protected as secret storage.
The OWS lifecycle specification defines the meaning of backup and asset migration operations as well. However, the CLI in v1.4.4 does not implement every command for automatic backup, recovery, and key replacement. During recovery, check which operations are actually available. After restoring files, verify that the signing keys, tokens, and operational conditions form the intended combination.

To investigate operations retrospectively, the specification also describes appending wallet IDs and operation details to audit logs. Recording token IDs, allow or deny results, target chains, and timestamps makes it possible to determine which requests were handled under which conditions. Private keys and raw tokens are excluded from the logs.
Because the logs are stored on the user's own host, they are not tamper-proof against the host owner or an attacker capable of modifying its files. Check who is authorized to read or modify the logs according to the purpose of the audit.
When to Choose a Local Architecture
OWS is suitable when you want to store wallets on your own host and use the same formats and signing operations from multiple tools. If another tool supports the required storage format and chain-specific signing, it can reuse the same encrypted data and account information. Maintaining control over storage and being able to inspect key derivation methods are conditions for continued use of the wallet.
When outsourcing signing to an external service, the environment holding secret data and the location where operational conditions are enforced move to the service provider. When running the reference implementation yourself, you are responsible for protecting stored files and execution processes, distributing tokens, and maintaining policy programs. Operations that submit data to a network also require an RPC connection.

What the agent-treasury example shares is the wallet's stored data and the process that evaluates conditions and signs using that data. Agent tool calls and payment protocols connect to this signing process. Checking where secrets reside, who evaluates conditions, and who performs recovery after a failure helps determine which operational responsibilities your application must assume.
Conclusion
OWS standardizes wallet storage formats and chain-specific signing operations, allowing different tools to use the same wallet. Delegation through per-token encrypted copies and pre-signing conditions allows operational scopes to differ while using the same address. Maintaining those conditions requires protecting not only the tokens but also the location of the secret copies and the host running the signing logic.
For details of storage formats, signing operations, and the reference implementation, see the official OWS repository.
