Author

Topic: Specifying transaction fee with omnicored (Read 623 times)

hero member
Activity: 602
Merit: 500
July 08, 2017, 05:39:09 AM
#3
@HCP,

Thank you very much!

Best,

Jian
HCP
legendary
Activity: 2086
Merit: 4361
With Bitcoin, you technically don't directly specify the fee as such... You specify the inputs and outputs and the fee is just the difference between total inputs and total outputs. That is to say:

Transaction Fee = Total Inputs - Total Outputs.

Quote from: createrawtransaction()
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime )

Create a transaction spending the given inputs and creating new outputs.
Outputs can be addresses or data.
Returns hex-encoded raw transaction.
Note that the transaction's inputs are not signed, and
it is not stored in the wallet or transmitted to the network.

Arguments:
1. "inputs"                (array, required) A json array of json objects
     [
       {
         "txid":"id",    (string, required) The transaction id
         "vout":n,         (numeric, required) The output number
         "sequence":n      (numeric, optional) The sequence number
       }
       ,...
     ]
2. "outputs"               (object, required) a json object with outputs
    {
      "address": x.xxx,    (numeric or string, required) The key is the bitcoin address, the numeric value (can be string) is the BTC amount
      "data": "hex"      (string, required) The key is "data", the value is hex encoded data
      ,...
    }
3. locktime                  (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs

Result:
"transaction"              (string) hex string of the transaction

Most wallets calculate the fee (or let the user specify the fee) and then just adjust the "change" output such that the difference between inputs and outputs equals the calculated fee. NOTE: this may mean adding additional inputs to cover the fee and/or making the change = 0 and not having a "change" output.

Not sure how this works with the Omni Core Fork tho... given that it is a fork of Bitcoin Core, I would assume it works the same way...
hero member
Activity: 602
Merit: 500
Hi all,

I am unable to find a way to specify the transaction fee myself. Any help is appreciated.

https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md

Thanks,

Jian
Jump to: