I'm trying to look at the distribution of fees per kb of weight, but all I can find in the RPC connection to the daemon is the fees of a transaction. Note that I want the weight of a transaction, not the actual size. That means including the effects of the clawback.

I guess I could get size from the hex representation of the TX, but that doesn't take into account the weight-clawback for Txes with more than 2 inputs or outputs.

To be clear, I want to do this for almost all transactions on the blockchain, not just my own transactions.

1 Answer 1


How do I get the weight of a transaction from the RPC daemon ... Not the weight of a transaction

Due to the contradiction, I'm going to assume you want the size.

I guess I could get size from the hex representation of the TX

Yes. Like:

curl -sd '{"txs_hashes":["329c12515493165e5580cf5541d429ca3f59d7ac949ba918c0f84af9450f13a8"],"decode_as_json":false}' http://localhost:18081/get_transactions \ 
  | jq .txs[].as_hex --raw-output \
  | wc -c \
  | xargs -I N expr N / 2

to get size of any transaction(s).

Or to also include fee related data:

curl -s http://localhost:18081/get_transaction_pool_stats

to get the size and fees of transactions in the tx pool. No use for historical, but useful for data gathering moving forwards.

but that doesn't take into account the weight-penalty

Note the penalty function applies to miners and block size. A user simply pays fees to cover the size of the tx they are sending. Want to send more data, pay more in fees. So if you're wanting data around the penalty imposition, you want to be looking at the block size and history.

  • Thanks for your answer. Sadly, my question was worded wrong. I am interested in the weight of a transaction, not the size. I edited the question to be more clear. Sep 23, 2020 at 10:39
  • Before bulletproofs weight==size. The claw-back was introduced because of the huge size reduction of bulletproofs. I'm not sure why you think this metric is interesting but back calculating it from the size and output count would be fairly trivial. You can see how it's calculated here.
    – jtgrassie
    Sep 23, 2020 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.