Files
timmy-tower/attached_assets/Pasted-mplementation-Spike-Taproot-Asset-Token-L402-Payment-Ga_1773841029889.txt
alexpaynex 332d54d82d Transitioned from Plan to Build mode
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: e5bf8c58-7ab0-405e-accb-3ec634dd9b7f
Replit-Helium-Checkpoint-Created: true
2026-03-18 13:38:27 +00:00

44 lines
4.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
mplementation Spike: Taproot Asset Token + L402 Payment Gate on FastAPI/Lightning
You are writing a technical implementation guide, not a market report. I need working architecture and code paths, not opinions.
I am building a local AI agent (Timmy) on FastAPI that accepts paid work requests over Lightning Network. The payment architecture:
1. User submits a request
2. A small non-refundable Lightning invoice (evaluation fee) must be paid before the agent reads the request
3. Agent evaluates the request using a cheap local model
4. If accepted, agent quotes a price and issues a second Lightning invoice
5. User pays, work is delivered
6. Optionally, users can prepay a session (batch of N requests) via a single invoice and receive a macaroon with a usage meter
I want to issue a custom Taproot Asset token (“TIMMY”) that represents one unit of the agents labor. This token should be transferable over Lightning channels instantly. The token is consumed on use — it is a labor credit, not an investment.
Research the following and provide concrete implementation details:
1. Taproot Asset Minting
∙ What are the exact steps to mint a custom fungible Taproot Asset on mainnet using tapd + LND?
∙ What version of LND is required? What flags/tags must be compiled?
∙ What does the gRPC call look like to mint? Provide the actual protobuf message or CLI command.
∙ What is the on-chain cost of the minting transaction?
∙ Can the entire supply be minted in a single transaction?
∙ How do you verify the asset was minted correctly?
2. Taproot Assets on Lightning Channels
∙ How do you deposit a Taproot Asset into a Lightning channel?
∙ Can a Taproot Asset channel coexist alongside a BTC channel in the same UTXO?
∙ How does routing work — can a TIMMY token payment route over existing BTC Lightning channels via edge nodes, or does it require dedicated Taproot Asset channels end-to-end?
∙ What happens if no direct Taproot Asset route exists — does the protocol fall back to BTC conversion at edge nodes?
∙ What is the current state of Taproot Asset channel support in LND (v0.20+)?
3. L402 Payment Gate with Taproot Assets
∙ Can Aperture (Lightning Labs L402 reverse proxy) gate access using Taproot Asset payments, or only BTC sats?
∙ If Aperture only supports sats, what is the minimum custom code needed to accept Taproot Asset payments as L402 credentials?
∙ How would a macaroon encode that payment was made in TIMMY tokens vs. sats?
∙ Is there a way to implement the “session pass” pattern (prepay N requests, get a metered macaroon) using Taproot Assets?
4. FastAPI Integration
∙ What is the most production-ready Python path to interact with tapd (Taproot Assets daemon)? gRPC stubs? REST? LNbits extension?
∙ Does LNbits support Taproot Assets as of March 2026?
∙ Provide a minimal FastAPI endpoint that: creates a Taproot Asset invoice, checks payment status, and issues a macaroon on confirmation.
∙ How do you query a users TIMMY token balance programmatically?
5. Hybrid Architecture: Sats + TIMMY Token
∙ If Taproot Asset Lightning support is not yet production-ready, what is the cleanest hybrid? Users pay in sats via standard Lightning, but the internal ledger tracks TIMMY credits?
∙ How do you peg TIMMY credits to sats? Fixed rate set by operator, or floating based on demand?
∙ When Taproot Asset channels mature, what is the migration path from the hybrid model to native token payments?
6. What Breaks
∙ What are the known failure modes of Taproot Assets on Lightning as of March 2026?
∙ What is NOT yet implemented in tapd that this design requires?
∙ Are there any mainnet Taproot Asset channels in production, or is this still testnet-only for asset channels?
∙ What is the risk of building on Taproot Assets today given the protocol is still evolving?
Deliverable: A structured implementation guide with exact commands, library versions, gRPC/REST call examples, and a clear flag on anything that is not yet production-ready. Prioritize what works today over what is promised. If something requires waiting, say so and provide the interim workaround