Module

Wallets — 0–5 credits

Manage server-side custodial wallets. Private keys are stored encrypted on the server. Creating a new wallet costs 5 credits; listing and deleting wallets are free.

⚠️
Security note: privateKey() requires an API Key (not JWT). This ensures private key retrieval is only possible from your authenticated server environment, never from a browser session.
create()
POST 5 credits JWT

Create a new managed wallet. The private key is generated server-side and stored encrypted. The address is returned immediately. Costs 5 credits.

Parameters

None.

Example

$wallet = Web3Api::wallets()->create();

// $wallet['address']    => "0x4e9ce36E442e55EcD9025B9a6E0D88485d628A67"
// $wallet['id']         => "550e8400-e29b-41d4-a716-446655440000"
// $wallet['created_at'] => "2024-06-01T12:00:00"

Response

{
  "address":    "0x4e9ce36E442e55EcD9025B9a6E0D88485d628A67",
  "id":         "550e8400-e29b-41d4-a716-446655440000",
  "created_at": "2024-06-01T12:00:00"
}
list()
GET 0 credits JWT

List all managed wallets belonging to the authenticated user.

Example

$wallets = Web3Api::wallets()->list();

foreach ($wallets as $wallet) {
    echo $wallet['address'];    // "0x4e9ce36..."
    echo $wallet['id'];         // "uuid"
    echo $wallet['label'];      // null or custom label
    echo $wallet['created_at']; // "2024-06-01T12:00:00"
}

Response

[
  {
    "id":         "550e8400-e29b-41d4-a716-446655440000",
    "address":    "0x4e9ce36E442e55EcD9025B9a6E0D88485d628A67",
    "label":      null,
    "created_at": "2024-06-01T12:00:00"
  }
]
privateKey()
GET 0 credits API Key only

Retrieve the private key for a managed wallet. This endpoint requires API Key authentication — JWT is not accepted. This restriction ensures the private key is never accessible from browser-based sessions.

Parameters

NameTypeRequiredDescription
$addressstringYesEVM wallet address (0x-prefixed)

Example

$result = Web3Api::wallets()->privateKey(
    address: '0x4e9ce36E442e55EcD9025B9a6E0D88485d628A67',
);

// $result['address']     => "0x4e9ce36..."
// $result['private_key'] => "0xabcdef1234567890..."

Response

{
  "address":     "0x4e9ce36E442e55EcD9025B9a6E0D88485d628A67",
  "private_key": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
delete()
DELETE 0 credits JWT

Remove a managed wallet by its UUID. This permanently deletes the stored private key.

Parameters

NameTypeRequiredDescription
$walletIdstringYesInternal wallet UUID (from list() or create())

Example

$result = Web3Api::wallets()->delete(
    walletId: '550e8400-e29b-41d4-a716-446655440000',
);
// $result['message'] => "Wallet removed"