I have just started an app for bitcoin trading and the wallet which I am using is block.io. I have made the mining fees as low in the system but then also I am not being able to get exact amount what to send to the miners. Please help to setup something which will help me to send custom mining fees and so I can charge the users. I got to know that in big companies setup there RPC and then they charge using that. Please help me to solve it.
You can get the recommended fee in two ways:
https://bitcoinfees.21.co/api
You can also call estimatefee from rpc:
https://bitcoin.org/en/developer-reference#estimatefee
Then you can set the fee via rpc (example):
settxfee 0.00320227
Don't ask how to calculate the bytes of a transaction, it's a fools errand that will send you into a downward spiral of doom and dispair where you have to do a create raw transaction and sign it, get the hex code in bytes. Many have been down this path from an RPC standpoint and you can't there. Maybe one day someone will create andultra useful rpc command of GetBytesFromSendToAddress but it's just a pipe dream