TANOS is a library implementing atomic swaps between Bitcoin and Nostr, using Taproot and Schnorr adaptor signatures, developed for the MIT Bitcoin Hackathon.
TANOS allows atomic swaps between: - Bitcoin transactions using Taproot P2TR addresses - Nostr events with Schnorr signatures
The protocol uses adaptor signatures to ensure atomicity: the buyer only gets the signed Nostr event if they pay with Bitcoin, and the seller only gets the Bitcoin if they reveal the secret from the Nostr signature.
This project is inspired by NIP 455: Atomic Signature Swaps, which proposes a standard for performing atomic swaps of cryptographic signatures over Nostr.
The project is organized into the following packages:
pkg/adaptor - Adaptor signature implementation using Schnorrpkg/bitcoin - Bitcoin-related functionality (Taproot, transactions)pkg/crypto - Common cryptographic utilitiespkg/nostr - Nostr-related functionalitypkg/tanos - High-level swap protocol implementationexamples/swap - Example implementation of a complete swapgit clone https://github.com/GustavoStingelin/tanos.git
cd tanos
go mod download
go run examples/swap/main.go
Buyer has Bitcoin
Commitment:
Seller computes the commitment T = R + e*P
Locking:
Buyer sends the adaptor signature to the seller
Revealing:
Seller broadcasts the Bitcoin transaction with the completed signature
Verification:
TANOS carefully implements BIP340 parity rules for Schnorr signatures. According to the specification:
This implementation automatically handles these parity adjustments, ensuring that: 1. Generated Bitcoin signatures are valid according to BIP340 2. Secrets extracted from signatures are correctly recovered, even after parity adjustments
For enhanced security, the library uses BIP340-style tagged hashes for all signature challenges, ensuring signatures from different contexts cannot be reused.
This project is licensed under the MIT License - see the LICENSE file for details.
$ claude mcp add tanos \
-- python -m otcore.mcp_server <graph>