No, according to the bitcoin network, the system generates a different digital signature for each transaction. Because the sender generates a digital signature from a transaction message and his private key. That’s why you can create a new public key and private key for each transaction.
I want to have multiple procedure call and one transaction commit, for example:
call CreateRestaurant(?, ?, ?); call CreateMenu(?, ?, ?, ?, ?); call CreateMenuItem(?, ?, ?, ?);
but I want to wrap all these call procedure in one place, is there anyway to achieve this goal?
Does bitcoin core have a flag to allow creating a transaction with multiple outputs to the same address?
Here is a guide for as many wallets as I could figure out how to perform an RBF with. This is adapted from my bitcointalk post: https://bitcointalk.org/index.php?topic=1802212.0
A “stuck” transaction is a transaction which has remained unconfirmed for period of time which either the receiver or the sender is uncomfortable with. Stuck transactions can be annoying as it means that recipients often consider the senders to not have paid yet, or the recipient needs the money as soon as possible.
Stuck transactions are typically caused by low transaction fee rates. However other things can cause stuck transactions such as spending from an unconfirmed transaction, having dust outputs in the transaction, or being a double spend of another transaction. If a transaction has a double spending transaction and the double spend confirms, then the transaction will be “stuck” forever as it can never confirm.
There are several options for confirming stuck transactions:
For both the recipient and the sender of the transaction, you can:
- Wait for the transaction to confirm
- Wait for the network to “forget” about the transaction
- Ask a miner to confirm it for you
For the sender of a transaction, you can also:
- Attempt an Replace-By-Fee double spend transaction
- If you have a change output, you can attempt a Child-Pays-For-Parent transaction
For the recipient of a transaction, you can also:
- Attempt a Child-Pays-For-Parent transaction
Waiting for a confirmation
If you are incapable of performing any of the other options or are too afraid to do so, you can simply wait and hope that the transaction will eventually confirm. To ensure the network is constantly being reminded of the transaction, you can rebroadcast the transaction periodically. Most wallets will rebroadcast automatically, so simply leaving your wallet open will allow rebroadcasting to happen.
Waiting for the network to “forget” about the transaction
If a transaction remains unconfirmed for too long, it can be eventually “forgotten” by most nodes on the Bitcoin network if no one rebroadcasts the transaction. This happens due to node restarts, mempool expiry times, or mempool eviction because the minimum mempool fee has increased. This process typically takes a few days (usually 3). Once a transaction has been “forgotten”, you may not see it in your wallet and you probably will not see the transaction in most block explorers. Once the transaction has been “forgotten”, you can simply send the Bitcoin again but include a higher transaction fee. If you still see the transaction in your wallet but don’t find it on any block explorers, you will need to follow the instructions in the next Replace-By-Fee Section.
Note that some wallets will continuously rebroadcast the transaction while the wallet is on, so you either have to remove the transaction from the wallet using the instructions in the RBF section, or shut down the wallet and keep it off for several days.
Ask a miner for help
Some mining pools and miners offer services to allow you to prioritize your transaction in their mempool so that it is chosen sooner for inclusion in a block. One such service is https://pool.viabtc.com/tools/txaccelerator/. Note that ViaBTC does have a limit the accelerator to 100 transactions every hour and requires that it pays a minimum fee rate of 10 satoshis/byte, so their accelerator may not necessarily work. Another such service is https://pushtx.btc.com/#/. Not that BTC.com does require another form of payment in order to “accelerate” your transaction.
Also note that if you attempt a Replace-By-Fee transaction, both the original transaction and the RBF transaction will be considered double spends. Miners will likely not help with any transactions marked as double spends.
Attempting a Replace-By-Fee (RBF) double spend transaction
What is an RBF transaction
A Replace-By-Fee transaction is a transaction that is nearly identical to your stuck transaction but pays a higher transaction fee. Since the original transaction most likely does not use Opt-in RBF, the RBF transaction that we will be creating will be considered a double spend and marked as such. The transaction uses Full-RBF and thus may still take a little bit longer to confirm as it is technically a double spend.
The difference between the types of RBF transactions
Replace-By-Fee transactions have 3 different types, First-Seen-Safe(FSS) RBF, Full RBF, and Opt-in RBF. FSS RBF requires that the RBF transaction include the same outputs as the transaction it replaces and consumes the same inputs. Full RBF means that the transaction is simply a double spend of another transaction but pays a higher transaction fee than the one(s) it replaces. Opt-in RBF means that the RBF transaction can only replace a transaction that has Opted-in to allowing itself to be replaced. Opt-in RBF follows BIP 125.
The instructions given in this section will be for making Full RBF transactions. Opt-in RBF transactions will be described in the “Avoiding Stuck Transactions In The Future” section.
How to make a Full RBF transaction
Making a Full RBF transaction depends entirely on the wallet that you are using. Some wallets support the advanced functionality required to make a Full RBF transaction, others do not. The following will be guides for each wallet on how to make a Full RBF transaction with that wallet. In general the procedure is to remove the unconfirmed transaction from the wallet and then resend the Bitcoin but with a higher transaction fee.
When making a Full RBF transaction, the transaction should include the recommended fee rate effective at the time of creating the transaction. See the “Avoiding this issue in the future” section for help with that.
Bitcoin Core makes making Full RBF transactions very easy. Simply go to the transactions list, right click the transaction that is stuck, and choose the
Abandon Transaction option.
If that option is greyed out, go to the Bitcoin Core
datadir and delete the
mempool.dat file. Then restart Bitcoin Core with the
-walletbroadcast=0 option and then you should be able to use
If the above two options fail for some reason, start Bitcoin Core with the
-zapwallettxes option to clear all unconfirmed transactions from your wallet.
Once the transaction is either Abandoned or cleared from the wallet, you can simply go to the Send tab and send the Bitcoin again but make sure that you include a sufficient transaction fee.
Bitcoin Armory also makes making Full RBF transactions very easy. Go to
Help > Clear All Unconfirmed Transactions and restart Armory. This will clear all of the unconfirmed transactions from the wallet and thus allow you to create the Full RBF transaction. Once Armory has restarted, simply send the Bitcoin again as you normally would but be sure to include a sufficient transaction fee.
MultiBit HD allows for making Full RBF transactions fairly easy as well. Go to
Manage Wallet and click on
Repair Wallet and follow the wizard. This process will clear all of the unconfirmed transactions from your wallet much like Bitcoin Core and Armory do. Once repair wallet has completed, simply send the Bitcoin again as you normally would. Note that some users have had trouble with this method in the past and it may not always work. You may need to wait for the transaction to be “forgotten” in order for this method to work.
Wallets that do not allow you to or ones that I don’t know how to make Full RBF transactions
Not all wallets support the creation of Full RBF transactions. Many wallets do not allow clearing all unconfirmed transactions to allow for making Full RBF transactions. The following is a list of wallet software which do not support Full RBF transactions. If a wallet on this list does support FullRBF transactions, please let me know and provide instructions for that so I can add it above.
- Blockchain.info and web wallets in general
- Electrum (supports Opt-in RBF, but not Full RBF)
- MultiBit Classic
- Bitcoin Wallet for Android
Attempting a Child-Pays-For-Parent transaction
What is a Child-Pays-For-Parent transaction?
A Child-Pays-For-Parent (CPFP) transaction is exactly as the name implies, a child transaction spends from an unconfirmed parent transaction and includes a transaction fee which covers both the fee of the child and the parent. However creating CPFP transactions are much more difficult as it requires spending from an unconfirmed transaction, something that many wallets do not allow.
Using Dynamic Fees
The best way to avoid having stuck transactions is to make sure that you are not spending from an unconfirmed transaction, and include a sufficient transaction fee. If your wallet supports dynamic transaction fees, you should use those. If you want very fast confirmations, set the dynamic fees to choose the fastest fee possible. Dynamic fees are calculated by the wallet by analyzing the current state of the network and determining an optimal transaction fee from there. Since the state of the network constantly changes, the optimal transaction fee calculated one day may not necessarily be the best fee for the next day.
If your wallet does not support dynamic fees but does support setting a custom transaction fee rate for each transaction, you can look up the optimal fee rate on sites like http://bitcoinfees.21.co/ and https://bitcoinfees.github.io/ and set the fee rate for each transaction based on those sites. You must do this for each transaction you make otherwise you may end up paying a sub-optimal fee.
If your wallet does not support any sort of fee rate or does not allow setting custom transaction fees, you should upgrade to a new wallet. Using a fixed fee or fixed fee rate is no longer a good idea as the network constantly changes. You can use this formula:
<in>*148 + <out>*34 + 10 where
<in> is the number of inputs and
<out> is the number of outputs to estimate the size of your transaction and determine the optimal fee for it.
Note that some wallets (e.g. blockchain.info), even though they use dynamic fees, set an upper limit to the transaction fee. If you notice that your transactions are constantly being stuck even though you are using dynamic fees, you should check the settings of your wallet and perhaps even switch to a new wallet which has no limit to the transaction fee.
Use Opt-In RBF
Opt-In RBF is a feature that allows for an RBF transaction to be more easily created as these transactions will not be rejected by nodes supporting Opt-In RBF.
Currently few wallets support creating Opt-In RBF transactions
To create a transaction that can be replaceable, go to Tools > Preferences and check the box “Enable Replace-By-Fee”. Then when you want to send some Bitcoin, next to the Fee slider is a box labeled “Replaceable”. Check that box so that while the transaction is still unconfirmed you can replace the transaction with one that pays a higher fee.
To increase the fee of a transaction that uses Opt-In RBF, right click the transaction in the history list and choose the “Increase Fee” option.
Armory also allows for the creation of RBF transactions. When sending a transaction, choose the checkbox “Enable RBF”.
To increase the fee of a transaction that uses Opt-In RBF, right click the transaction in the transactions list and choose the “Bump Fee” option. Transactions whose fee can be increased are labeled clearly in the transactions list.
I am using Payfort extension to process credit Card Payments online for Payfort Payment Gateway. For Website it’s working Fine and Placing an order after successful payment.
But when i am trying to place an order via API after successful payment via it’s iOs/Android SDK.
It’s giving me this Error.
Transaction has been declined. Please try again later.
This is How i am passing each information i received from Payfort after Successful Payment in this API.
“Street 44, Oud Maitha”
“card_holder_name”: “Test User “,
I am getting “True” in the response of this API call.
Then, I am using Create Order API of Magento to Place an Order.
After debug, i found that this error is coming from this file.
And it’s because the “execute” method in this class is sending the Payment request again to Payfort and they recieve the “Signature mismatch” error from Payfort because of the unauthorized request. It should not send the Payment request again to Payfort.
I am not able to figure out how to prevent Magento to make this Payment request and just Place the Order.
If anyone can help me out to solve this problem and place an order successfully would be really appreciated.
Preface this with the following: I am not a DBA. I see this is a fairly common issue, but everything points back to the transaction log backups. I’ve been tasked with something well outside my wheelhouse.
I set up our SQL DB (Roughly 20gb in size,) in FULL recovery mode with a nightly FULL backup that occurs every weekday at 4:30AM. This task checks integrity, reorganizes index, updates statistics, history cleanup, backup the full db, shrinks the db, and then maintenance clean up.
I then set another subplan for Transaction Logs. This backs up the Transaction Log every 3 hours during business hours (8am, 11am, 2pm, 5pm), also during weekdays. There are not that many transactions that occur really; in the years I’ve been here the actual DB has increased less than a gb.
The .LDF file for the server exploded over night on Saturday and with no monitoring or warning, the server is now at capacity. This had been running fine from the looks of the data usage report (and random eyeballing) for months. It looks like shortly after the backup started, at 4:36AM, the transaction log file kept growing to the point where it is sitting at 90gb, with a whopping 5MB free on the drive.
My initial thought was to move one of the older db backups off the server to alleviate space constraints; This worked for a few minutes before the .LDF file gobbled that up also.
Is the only real option I had to switch the DB to SIMPLE, shrink the transaction log, and then swap to FULL, take a backup, and resume where I left off? I attempted to do a compressed transaction log backup to the other drive on the machine and it still would not allow me to do a DBCC SHRINKFILE. It errored out saying the transaction log for the DB is full due to ‘log_backup’. I attempted three transaction log backups and trying the DBCC SHRINKFILE each time.
In my testing environment the FULL->SIMPLE->FULL method seemed to work, but I am unsure why, or how this happened to begin with. Am I missing something? I realize that this method is not ideal since it can break the log chain..
I have an unsigned raw transaction:
I have read these threads:
How to redeem a basic Tx?
Redeeming a raw transaction step by step example required
These threads explain signing a raw transaction with 1 input.
Do I understand correctly that both inputs are to signed separately?
So first, we sign the first one, then the second one. To sign an input we replace scriptSig for this input with the scriptPubKey, that locks this input. ScriptSig for the other one remains blank.
It this correct?
But in both threads in step 13 something is appended at the end of transaction. It is called hash code type
What is this? Is this has anything to do with sighash type byte the one that is appended to the signature? If not how to determine this value?
What is the correct sighash type for the scenario I described above (signing inputs separately)?
Is this: 0x81 (SIGHASH_ALL | SIGHASH_ANYONECANPAY)?
Or should this be 0x01 (SIGHASH_ALL)?
I don’t know which one is correct as transaction to be signed contains the other input (without scriptSig set but still, it contains it).
Is there an easy to understand step by step guide
No. There is no easy to understand guide if you do not understand the underlying processes.
I can execute to create a double spend and get the unconfirmed
transaction reversed back into the original wallet
The transactions can not be “reversed back” and are not going “to/from the wallet”.
so I can resend it with a higher fee and get it delivered?
The doublespending transaction is the transaction which uses the same input set, but has another outputs/fees. You do not need to do two steps (a) reverse original transaction (b) send another transaction with higher fees, because this is one step.
As far as I know, some wallets contain Replace-By-Fee features, but I use my own program. It is not “easy-to-understand”, but it works
The businesses have incentives to split checks because they are used to aggressive expense optimization. In Ukraine this has been an edge case, which outside viewer sees as inability of government to collect taxes properly.
So it is about taxes (it is a rule of thumb to follow the money, so it is about cutting seller expenses anyway), but not in the way described in the earlier answer (annual limit for income per low taxation entity is above $50,000 and the threshold is high enough to not abuse customers by bill splitting per plate!).
The article I linked in comment earlier explains (in Russian) details how businesses are cheating in their sales and provision of services. One of the cases is check splitting in particular.
… Almost always you are charged twice in a restaurant of a cafe. You get one bill for the bar beverages, and the other for the snacks. The first receipt has a name of certain LLC on it, as alcohol seller license is expensive and can only be given to companies…
In most countries these methods might be considered illegal, but it has been working absolutely fine for years in Ukraine. It is massively used nowadays too, and even more to that: you cannot run a business otherwise because competition would then throw you out of business very quickly.
The typical reason why you would get two bills is that certain products cannot be sold by legal entities with low taxation. Then you are billed for such food (esp. alcohol) by one entity and then you get another bill for the rest of your purchase from another entity. At certain cases the split is less clear because it might be not only about alcohol. I suppose that in your example hot chocolate is sold by the part of the shop known as “bar”, and the cake is sold by the part of the shop which sales complete products.
That is, it is not per plate billing as you supposed. It is rather a different kind of optimization when technically your purchase is provided by different “departments”. In most cases it is a sort of internal procedure of the seller and your asking to combine the bill just cannot help. The seller splits the bill not because they want to add fun of entering PIN twice but because they split goods and services for their own reasons, which cannot be changed on your request. More to that, waiters and people at the counter are not even necessarily aware of actual reasons behind the splitting.
Optimization goes way beyond the scope of cafes. In Ukraine you can find even a supermarket, which structured the business so that departments, that are obvious integral parts of the facility, are run as separate low taxation legal entities. If you buy stuff from different departments you can ask to combine the purchased goods as a single transaction, but it is obviously impossible: the sellers have their own goods to sell and neither of them could sell you goods from peer department.
UPD. By coincidence, there is a fresh (today’s) publication on check splitting: Two receipts in a restaurant // Два чека в ресторане:
… hence there are two businesses under the same roof: LLC sells alcohol and (low tax) individual entrepreneur serves food.
… if you happen to visit the same place frequently, you can also notice occasional business name changes. Is it a mistery? One individual entrepreneur approaches its annual limit on revenue, then he is replaced by a new one.
The article mentions various aspects of the expense optimization as well as the fundamental reason behind two bills. Interesting part is that the source of the comment is an ex-deputy finance minister. That is, everyone out there is aware of what is going on but there is insufficient motivation to stop the farce.
Error (when sending)
error code: -26
64: non-mandatory-script-verify-flag (Non-canonical DER signature)
What is wrong with the signatures here?
My thoughts and a bit of context
So basically we have two inputs here. Both are from multisig addresses. The difference is that the second one is just P2WSH.
The first one is mostlikely fine. The second one is my concern. So let’s look at witness signatures for the second input.
We have three signatures:
First two are generated by hardware wallets. The third one is created by Bitcoin Core.
So basically each of these signatures claims to be 0x45 (69 bytes long). But the third one has additional 01 at the end.
Is this the reason of the error?
If not what is this additional byte?
Any clues what is wrong with this transaction?