Wallet
// This is a duplicate of features/wallets.md. Please keep only one copy in the future.
Wallets
JuliaOS provides robust wallet integration features, allowing users and agents to interact with various blockchain networks.
Concept
In the context of blockchains, a "wallet" is typically software or hardware that manages a user's cryptographic keys (public and private keys). The public key derives the blockchain address (where assets are held), and the private key is required to authorize transactions (sending assets, interacting with contracts).
Wallet Functionality in JuliaOS
JuliaOS offers wallet capabilities through two main components:
Client-Side Wallet Management (
@juliaos/wallets
package):Purpose: To allow end-users interacting with JuliaOS (e.g., via a web interface or potentially the CLI in some modes) to connect their existing browser extension wallets (like Metamask, Phantom, Rabby).
Functionality: Provides a
WalletManager
class (in Node.js/TypeScript) that handles:Detecting and connecting to installed browser wallets.
Retrieving the user's connected address and current chain.
Requesting the wallet to sign messages.
Requesting the wallet to sign and send transactions (The private key never leaves the user's wallet).
Handling events like account or chain changes.
Security: This is generally secure as the user maintains control of their private keys within their own wallet software.
Use Case: User-initiated actions, managing personal portfolios connected to JuliaOS.
Backend Wallet Management (
Wallet.jl
module):Purpose (Intended): To allow the JuliaOS backend or automated agents to manage wallets directly, potentially for executing trades or other actions without direct user interaction for each step.
Functionality (Currently Mock): Includes functions to
create_wallet
,import_wallet
(from private key),export_wallet
,get_wallet_info
.Security: Currently mock. A real implementation handling private keys directly on the backend would require extreme security precautions (see Security Best Practices) and is generally not recommended for significant funds without specialized infrastructure (HSMs, MPC).
Use Case (Intended): Automated agent operations, system-controlled accounts (use with caution).
Key Distinction: Signing
The Client-Side (
@juliaos/wallets
) approach relies on the user's existing wallet (e.g., Metamask) to perform the actual cryptographic signing of transactions. JuliaOS prepares the transaction, but the user's wallet signs it.The Backend (
Wallet.jl
) approach (if implemented) would involve the backend potentially holding private keys and signing transactions directly. This gives agents full autonomy but carries significant security risks.
Supported Wallets (Client-Side)
The @juliaos/wallets
package aims to support popular browser extension wallets:
Metamask (and other EVM-compatible browser wallets)
Phantom (for Solana)
Rabby (Multi-chain)
Using Wallets
CLI: The Managing Wallets (CLI) guide covers connecting user wallets via the CLI.
Programmatic (JS/TS): Use the
WalletManager
from@juliaos/wallets
. See Wallets API (Frontend) and Node.js API.Programmatic (Python): The Python wrapper might offer limited backend wallet interaction via
client.connect_wallet
, but client-side signing is typically handled outside the Python wrapper in a web context. See Python API.
See also: Adding New Wallet Integrations