Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

sendtx

npm versionnpm downloadslicensenode

Broadcast raw transactions to Bitcoin, Litecoin, Vertcoin and testnets.

Installation

npm install sendtx

Usage

As a module

importsendtxfrom'sendtx';// Broadcast to Bitcoin testnet4 (default)consttxid=awaitsendtx(rawTxHex);// Broadcast to specific networkconsttxid=awaitsendtx(rawTxHex,'btc');// With custom optionsconsttxid=awaitsendtx(rawTxHex,'vtc',{endpoint: 'https://your-vertcoin-node/api/tx',timeout: 60000});

As CLI

# Broadcast to testnet4 (default)
sendtx 0200000001...
# Broadcast to mainnet
sendtx 0200000001... btc
# Show help
sendtx --help
# List networks
sendtx --networks

Supported Networks

NetworkDescriptionEndpoint
btcBitcoin Mainnetmempool.guide/api/tx
tbtc3Bitcoin Testnet3mempool.guide/testnet/api/tx
tbtc4Bitcoin Testnet4mempool.guide/testnet4/api/tx
signetBitcoin Signetmempool.guide/signet/api/tx
ltcLitecoin Mainnetlitecoinspace.org/api/tx
vtcVertcoinRequires custom endpoint

API

sendtx(rawTx, network?, options?)

Broadcast a raw transaction.

  • rawTx (string) - Raw transaction hex
  • network (string) - Network identifier (default: 'tbtc4')
  • options (object)
    • endpoint (string) - Custom endpoint URL
    • timeout (number) - Request timeout in ms (default: 30000)

Returns: Promise<string> - Transaction ID

getNetworks()

Returns object with all supported network configurations.

isSupported(network)

Check if a network is supported.

License

MIT

About

send transaction to bitcoin networks

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages