BIP Proposal For New Opcode OP_SECURETHEBAG

OP_SECURETHEBAG is a new proposed opcode that uses a simple covenant to enable a set of valuable use cases like congestion controlled transactions, wallet vaults, CoinJoin and channel factories.

Congestion Controlled Transactions

In a blockchain, congestion is when there is a high demand for block space making transactions more expensive and no one likes that, it often gets unreasonable to send transactions due to obscenely high fees, by using OP_SECURETHEBAG a large volume processor, like an exchange, could bundle up all their payments for the time being and send them as a single transaction for confirmation purposes, then when the block space gets less congested these payments can be expanded out of that transaction. The sender of this congestion controlled transaction can choose from different transaction structures, the most simple being a straight 1 to N expansion when the block space is cheaper.

Channel Factories

Channel factories are an intermediate layer between Bitcoin’s blockchain and the Lightning network, it is designed to reduce the number of transactions needed to operate Lightning channels. OP_SECURETHEBAG can also work for channel factories like it does for congestion controlled transactions, except leaf nodes should be set up as channels instead of regular payment transactions.

Wallet Vaults

Greater security for cold storage solutions can be achieved through default tapscript paths that move pre-set amounts from one target to another, so a customer support desk can move a portion of the funds from the cold storage into a lukewarm wallet operated by their support desk, this support desk can then send some if it to a hot wallet and send the remainder back to a cold wallet, all without any further authorization. This can currently be done but with the use of OP_SECURETHEBAG, the need for coordination and online signers is eliminated and the ability of the support desk to improperly move funds is reduced.


OP_SECURETHEBAG makes it much easier to set up a trustless CoinJoin, all participants fund an agreed upon UTXO with whatever inputs they like then the transaction is confirmed.


Support us and the authors of this article by donating to the following address:


Comments powered by Talkyard.