Skip to main content

Wallet supportati

WalletInstallazioneCustodia autonomaNote
Blinkintegrato❌ custodialConfigurazione più semplice, GraphQL API
Alby Hubintegrato✅ opzione self-hostedREST API, supporta Hub proprio
Personalizzatointerfaccia L402WalletUsa il tuo wallet

BlinkWallet

Configurazione

  1. Registrati su blink.sv
  2. Vai su Dashboard → API Keys → crea una chiave
  3. Copia il tuo Wallet ID dalla dashboard
export BLINK_API_KEY="your-api-key"
export BLINK_WALLET_ID="your-wallet-id"

Node.js

import { BlinkWallet } from "l402-kit";

const wallet = new BlinkWallet(
  process.env.BLINK_API_KEY!,
  process.env.BLINK_WALLET_ID!,
);

Python

from l402kit.wallets import BlinkWallet

wallet = BlinkWallet(
    api_key=os.environ["BLINK_API_KEY"],
    wallet_id=os.environ["BLINK_WALLET_ID"],
)

Come funziona

Chiama la Blink GraphQL API con la mutation lnInvoicePaymentSend. Restituisce il preImage dalla transazione completata.

AlbyWallet

Configurazione

  1. Crea un account su getalby.com
  2. Vai su Settings → Access Tokens → crea un token con scope payments:send
  3. (Opzionale) Esegui il tuo Alby Hub per la custodia autonoma
export ALBY_TOKEN="your-access-token"
# Opzionale — necessario solo per Hub self-hosted:
export ALBY_HUB_URL="https://your-hub.example.com"

Node.js

import { AlbyWallet } from "l402-kit";

// Alby cloud
const wallet = new AlbyWallet(process.env.ALBY_TOKEN!);

// Hub self-hosted
const wallet = new AlbyWallet(
  process.env.ALBY_TOKEN!,
  process.env.ALBY_HUB_URL,  // optional base URL
);

Python

from l402kit.wallets import AlbyWallet

# Alby cloud
wallet = AlbyWallet(os.environ["ALBY_TOKEN"])

# Hub self-hosted
wallet = AlbyWallet(
    access_token=os.environ["ALBY_TOKEN"],
    base_url=os.environ.get("ALBY_HUB_URL", "https://api.getalby.com"),
)

Come funziona

Chiama POST /payments/bolt11 sulla REST API di Alby Hub con un token Bearer. Restituisce il payment_preimage dalla risposta.

Wallet personalizzato

Implementa l’interfaccia L402Wallet per utilizzare qualsiasi wallet Lightning:
import type { L402Wallet } from "l402-kit";

class PhoenixWallet implements L402Wallet {
  async payInvoice(bolt11: string): Promise<{ preimage: string }> {
    const res = await fetch("http://localhost:9740/payinvoice", {
      method: "POST",
      body: new URLSearchParams({ invoice: bolt11 }),
    });
    const data = await res.json();
    return { preimage: data.paymentPreimage };
  }
}
L’interfaccia richiede un singolo metodo:
MetodoTypeScriptPython
Paga una fattura BOLT11payInvoice(bolt11): Promise<{ preimage: string }>pay_invoice(bolt11: str) -> str

Scegliere un wallet

  • Test / prototipazione → Blink (custodial, configurazione immediata, piano gratuito)
  • Agente in produzione, massimo controllo → Alby Hub self-hosted (non-custodial, REST API)
  • Alta elaborazione / commissioni basse → Phoenix tramite L402Wallet personalizzato (non-custodial, ACINQ)
  • Enterprise → LNbits self-hosted tramite wallet personalizzato