fee value computed by appendrawchange

+1 vote

Dear MC team,

I used createrawtransaction to build a raw permission tx and I used appendrawchange  to attach a fee. The transaction is the following:

createrawtransaction '[{"txid":"2a60592ca898c2f889a0ea36ed90753ea0292d67ab27749f956b6f6cc3d76dab","vout":0}]' '{"1CDo6iRvGwssyuGhg6VQnH5TqxeGEPiUgw":{"permissions":{"type":"mine"}}}' ['']


After that, I used appendrawchange without specifying a fee, that is:

appendrawchange  0100000001ab6dd7c36c6f6b959f7427ab672d29a03e7590ed36eaa089f8c298a82c59602a0000000000ffffffff0200000000000000002f76a9147b14db349f3bc31ce26aaae6f895039bdc990f1e88ac1473706b700001000000000000ffffffff88158a5e750000000000000000252273706b69000000001976a914fcc0ec61c6b3cf66ccb6d052b61418d7bcc8ee1388ac756a00000000 1Q3SPtj1dfWMTjXkHU3Z3tXq53uRvMUXXh

the tx lenght is 306 chars, so I was expeting a fee of 306/2=153 unit.

After sending I check the fee collected by the miner and I found it is 100 unit.

Could you kindly explain this difference?

My setting for the currency are as follow:

initial-block-reward = 0                
first-block-reward = 200000000000                
reward-halving-interval = 52560000     
reward-spendable-delay = 1              
minimum-per-output = 0                 
maximum-per-output = 200000000000    
minimum-offchain-fee = 0               
minimum-relay-fee = 1000000                 
native-currency-multiple = 100000000    




asked Apr 6, 2020 by fabio

1 Answer

0 votes
First you should please note that the transaction will get larger because of the change output, and the fee is based on the transaction size after adding that output.

Second can you please explain what you mean by "100 unit"?
answered Apr 7, 2020 by MultiChain
Thanks for your support. I found your note useful to understand that the fee is related to the signed transaction and not the one before the sign is applied.

After that I prefer to create my transaction by using createrawtransaction and adding a change by myself.
This way gives me a full control about the transaction fee.

I also doublechecked that the minimun fee is related to the following algorithm:
min_fee=[lenght in byte of the signed tranaction] x [minimum-relay-fee]/(1000 x [native-currency-multiple])

If the transaction fee is lower or equal than the one listed above you get:
error code: -26
error message:
66: insufficient priority

If you forget to add a change you get
error code: -26
error message:
Insane fee

Thanks ffor your support.