# transacton fees for raw transactions

I'm building a merchant system for a client that will accept payments in bitcoin and send all coins to a cold storage wallet once a week (or month). The system is using a deterministic wallet to create one wallet for each client and it is very unlikely that one "receiving" wallet will have more than 2 inputs.

This system will run on a vps and the client does not want a bitcoin client running so I will create and relay all transactions through Push TX at blockr.io

This should work fine, but I'm having some problems with the size of the transaction and the transaction fee.

1. According to this answer if the value I'm trying to send is bigger than 1BTC I don't need a fee

1. A fee may not be required at all, if the priority of the transaction is high enough. Generally 1 BTC, one day old, is enough age and balance that you can send without a fee.
2. If any of the individual payments are below 0.01 BTC, a minimum fee will always be required.
3. The minimum fee, when required, is 0.0005 BTC per 1000 bytes of total transaction.
4. The contribution of each input and each output to the total size is somewhat consistent, it only varies largely if there are compressed keys (standard for newly generated addresses on a recent client version)
2. According to this answer the value will increase a lot based on the size of transaction

0.01 BTC fee per kilobyte of transaction, but: If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free. If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc.

3. According to bitcoinfees.21.co I should use their api to get the best transaction fee dynamically

``````{ "fastestFee": 40, "halfHourFee": 20, "hourFee": 10 }
``````

So my questions here are:

1. What is the best way to calculate the transaction fee? Given that I will be doing calculations by hand (script) and not using a bitcoin client
2. What is the maximum number of inputs that can I send on a transaction?
3. What can I do if the transaction gets stuck because of small transaction fee?
• 1 and 2 are from very old answers which do not apply in the current market. You will have to look at the real-time "going rate" for transactions as suggested in 3. May 27 '17 at 17:23
• Also, you're asking three different questions at the end; Stack Exchange works best when you ask one question per post. But the other two have already been asked and answered: see maximum inputs/outputs and unconfirmed transactions. May 27 '17 at 17:25
• Number 2 just to see if you are interpreting it correctly, means if all pending transactions combined is less than 27kb then there are no fees. So it would be during least active times of day if at all. May 29 '17 at 10:03