Protecting Bitcoin Wallet Credentials from AI Agents
Research scope
This is Stage 01, study 03, of Bitcoin for AI Agents. It is an educational reference design, not a live-tested integration or production SDK. The WAB Engine remains independent; wallet creation belongs to the Factory.
Architecture and rationale
Wallet credentials belong to a trusted execution environment, not a prompt. BTC KEY authorizes wallet access; recovery material must remain outside ordinary agent tools. BTC ID is a public identifier but can still reveal wallet associations.
Reference implementation
The example constructs a restricted health request for a fixed loopback origin. It deliberately does not send the request. A production transport must disable redirects and proxies and avoid logging authorization headers.
1package architecture
2
3import (
4 "context"
5 "net/http"
6)
7
8// HealthRequest has no model-controlled destination or credential.
9func HealthRequest(ctx context.Context) (*http.Request, error) {
10 return http.NewRequestWithContext(ctx, http.MethodGet,
11 "http://127.0.0.1:7070/api/v5/btc/health", nil)
12}Security and limitations
Environment variables are not a security boundary against arbitrary code execution. A coding agent with access to the executor environment may read them. Use a separate restricted process and avoid sharing credentials with the model runtime.
Applying the pattern
Keep the model-facing interface separate from trusted execution. Review the current engine API before mapping fields or response data. Use a dedicated test wallet and explicit network configuration for any future live evaluation. The example does not change the engine, its signed fee law, or Bitcoin Core.
