Initialize git config nostr.privkey with funds from a voucher
npm install fund-agentInitialize git config nostr.privkey with funds from a TXO voucher.
``bash`
npm install -g fund-agent
Or use directly with npx:
`bash`
npx fund-agent
`bashInitialize from default faucet (~/.gitmark/faucet.txt)
npx fund-agent
$3
`javascript
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); // 1000000
`API
$3
Fund an agent wallet from a voucher.
Options:
-
voucher - Voucher URI or file path
- global - Use global git config (default: false)
- force - Overwrite existing key (default: false)Returns:
-
privateKey - Generated private key
- publicKey - Derived public key
- txid - Funding transaction ID
- amount - Funded amount in satoshis
- funded - Whether funding was performed$3
Generate a new secp256k1 keypair.
$3
Parse a TXO voucher URI.
$3
Create a TXO voucher URI.
$3
Get or set git config values.
Voucher Format
`
txo:::?amount=&key=
`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 Mainnet
- signet` - Bitcoin Signet- gitmark - Anchor git commits to Bitcoin
- blocktrails - State anchoring protocol
- btctx - Transaction building
- sendtx - Transaction broadcasting
MIT