A Node.js tool for permanently burning Bitcoin by sending UTXOs to OP_RETURN outputs.
This utility allows users to permanently remove Bitcoin from circulation by creating transactions that send the entire value of a UTXO (minus network fees) to an OP_RETURN output. This effectively makes the Bitcoin unspendable, "burning" it permanently.
USE AT YOUR OWN RISK: Burning Bitcoin is irreversible. Once a transaction is confirmed, the funds cannot be recovered. This tool should only be used by users who fully understand the implications and have verified the code thoroughly.
- Burn an entire UTXO to an OP_RETURN output
- Customize the burn message
- Automatically calculates and deducts network fees
- Produces raw transaction hex that can be broadcast through various services
- Pure JavaScript implementation for easy testing with no external dependencies
- Node.js (v18.0.0 or higher)
- npm (v6.0.0 or higher)
# Clone the repository
git clone https://github.com/jrobinfo/Bitcoin_UTXO_Burner.git
cd Bitcoin_UTXO_Burner
# Install dependencies
npm install
This tool includes a pure JavaScript implementation for testing the Bitcoin burning process without requiring any external Bitcoin infrastructure:
# Run the JavaScript regtest implementation
npm test
This simulates:
- Creating Bitcoin addresses
- Funding a test wallet
- Creating a burn transaction with an OP_RETURN output
- Broadcasting the transaction to a simulated network
- Confirming and verifying the transaction
To use this tool in your own application:
const { burnBitcoin } = require('./bitcoin-utxo-burner');
// Parameters:
// 1. Private key in WIF format
// 2. Transaction ID of the UTXO to burn
// 3. Output index of the UTXO to burn
// 4. Fee rate in satoshis per byte
burnBitcoin('YOUR_PRIVATE_KEY_WIF', 'TX_ID', 0, 2)
.then(txHex => {
console.log('Transaction created successfully');
console.log('Raw transaction hex:', txHex);
// Broadcast the transaction using a service like Blockstream.info
})
.catch(err => console.error('Burn failed:', err));
After generating the transaction hex, you can broadcast it using:
- A Bitcoin node with the
sendrawtransaction
RPC command - A block explorer's API service like Blockstream.info
- Any other Bitcoin transaction broadcasting service
- Never share your private keys
- Test with minimal amounts before burning significant funds
- Verify all transaction details before broadcasting
- Consider running the code on an air-gapped computer for extra security
- The script takes a transaction input (UTXO) owned by the provided private key
- It creates a transaction with an OP_RETURN output (with zero value)
- Network fees are calculated and subtracted from the input amount
- The remaining amount is effectively burned as it becomes unspendable
You can customize the burn message by modifying the burnMessage
variable in the burnBitcoin
function:
const burnMessage = Buffer.from('Your custom message here', 'utf8');
You can also pass options to the burnBitcoin function to customize the behavior:
const options = {
network: bitcoin.networks.testnet, // Use testnet instead of mainnet
burnMessage: 'Custom burn message', // Set a custom message
};
burnBitcoin(privateKeyWIF, txId, vout, feeRate, options)
.then(txHex => console.log('Burn transaction:', txHex))
.catch(err => console.error('Error:', err));
- bitcoinjs-lib - For Bitcoin transaction creation
- axios - For API requests to fetch UTXO data
- ecpair - For key pair management in testing
- tiny-secp256k1 - Cryptographic library for Bitcoin
MIT
This software is provided "as is", without warranty of any kind. Use at your own risk. The author(s) disclaim all liability for any loss of Bitcoin resulting from the use of this tool.