Submit an undo transaction to bitundo to be included in the blockchain. Can be POSTd via urlencoding or JSON (just make sure you're sending a proper Content-Type header)
| Parameter | Description |
|---|---|
| transaction = <hex_string> | The transaction in bitcoin's hex format (Note: must be already signed) (See below, on how to create a proper undo transaction). |
| private_key = <string> | The private key of where the above transaction would pay the undo payment (See below, for more information). |
| is_secret = <boolean> | If true, the transaction will be published only in BuPool |
| affiliate = <bitcoin_address> | Option. The affiliate payment address. Who we will give commissions to, for giving us this transaction. |
You will need the following information:
Pseudo-code:
# All calculations are done in satoshis
for output in outputs:
totalOutput += output.value
for input in inputs:
totalInput += input.value
miningFee = totalInput - totalOutput
For every output that you want to remove, or reduce (aka amount you want to undo). Add the value you are reducing to the "undo amount"
The new fee you will need to pay is 10% of the undo amount, plus the original mining fee. Note: If you are sending a secret transaction, you must then double this fee
bitundoFee = round(undoAmount * 0.1 + miningFee) # rounded to the nearest satoshi
if (secret)
bitundoFee = bitundoFee * 2
Create a new transaction with at least one of the same inputs as the original, and update the outputs by reducing the value by the amount you wanted to undo. Note: If the value is 0, remove the output completely. Now you will need to pay bitundo, this is not done via mining fees but rather by generating a completely new address. The fees must be paid to this new address (and you will be giving us the private key, to this address). At this point, you will have change (normally 90% of the undo amount). You can do what ever you like with this change. Either add to an existing output, or add a new output. If you are feeling generous, you can add it to the bitundoFee. It is a bad idea to attach any mining fees to this transaction. And finally submit the signed hex raw transaction to our API (and don't forget to also send the private key of the fee address) .
You can check our web application to understand a bit more how the process works.
You are an affiliate if you help us to include BitUndo as part of your wallet software. All you have to do is to implement the logic to submit an undo transaction to our service. You will get paid immediately, and part of the "pay transaction" if the transaction get included in the blockchain. We currently give 10% of the bitundoFee to affiliates (and 90% to miners)
No problem! Simply open a websocket to ws.bitundo.com Commands:
| ping | Keep the connection alive. You will receive a 'pong'. Make sure to do this every 20 seconds of idleness or so, as we aggressively close idle sockets. |
| public |
Start listening to all (public, non-secret) undo transaction. They will come in the format:
"undo_transaction <HexOfUndoTransaction> <HexOfPaymentTransaction>" Where UndoTransaction is the undo transaction PaymentTransaction is a transaction that spends from UndoTransaction, giving you a payment (as mining fees) and paying the affiliate (if applicable). |
This gives us the flexibility to dynamically generate payment transactions. As an example, miners that want to make extra money, but are using a pool that doesn't support bitundo transactions, will be able to opt-in to have the fees paid *directly* to them, as opposed to the mining pools transaction fee.