fund-agent
v0.0.1
Published
Initialize git config nostr.privkey with funds from a voucher
Downloads
114
Maintainers
Readme
fund-agent
Initialize git config nostr.privkey with funds from a TXO voucher.
Install
npm install -g fund-agentOr use directly with npx:
npx fund-agentUsage
CLI
# Initialize from default faucet (~/.gitmark/faucet.txt)
npx fund-agent
# Initialize from voucher file
npx fund-agent /path/to/voucher.txt
# Initialize from voucher URI
npx fund-agent "txo:tbtc4:abc123:0?amount=5000000&key=deadbeef..."
# Generate key only (no funding)
npx fund-agent --no-fund
# Use global git config
npx fund-agent --global
# Dry run (show plan without broadcasting)
npx fund-agent --dry-runProgrammatic
import { fundAgent, generateKeypair, parseVoucher } from 'fund-agent';
// Fund from voucher
const result = await fundAgent({
voucher: '~/.gitmark/faucet.txt',
global: true,
});
console.log(result.publicKey); // Your new public key
console.log(result.txid); // Funding transaction ID
// Generate keypair only
const { privateKey, publicKey } = generateKeypair();
// Parse a voucher URI
const voucher = parseVoucher('txo:tbtc4:abc:0?amount=1000000&key=xyz');
console.log(voucher.amount); // 1000000API
fundAgent(options)
Fund an agent wallet from a voucher.
Options:
voucher- Voucher URI or file pathglobal- Use global git config (default: false)force- Overwrite existing key (default: false)
Returns:
privateKey- Generated private keypublicKey- Derived public keytxid- Funding transaction IDamount- Funded amount in satoshisfunded- Whether funding was performed
generateKeypair()
Generate a new secp256k1 keypair.
parseVoucher(uri)
Parse a TXO voucher URI.
createVoucher(options)
Create a TXO voucher URI.
gitConfig(key, value, global)
Get or set git config values.
Voucher Format
txo:<chain>:<txid>:<vout>?amount=<sats>&key=<privkey>Example:
txo:tbtc4:abc123def456:0?amount=5000000&key=0123456789abcdef...Files Created
git config nostr.privkey- Your private key.well-known/txo/txo.json- Your TXO (spendable output)
Networks
tbtc4- Bitcoin Testnet4 (default)btc- Bitcoin Mainnetsignet- Bitcoin Signet
Related
- gitmark - Anchor git commits to Bitcoin
- blocktrails - State anchoring protocol
- btctx - Transaction building
- sendtx - Transaction broadcasting
License
MIT
