Title: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: NotATether on June 29, 2023, 05:42:03 AM In the GUI, we see that Electrum tells us all the information about the fees our transactions have paid, and the total size of the transaction, total fees, and so on. Likely because we specify the fees ourselves.
But what about in the case of using the Electrum daemon/CLI to fetch any transaction? There doesn't seem to be a specific method for getting the fee info of a transaction, and gettransction just returns a raw transaction that doesn't contain transaction size (or vsize) and fee paid. Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: Abdussamad on June 29, 2023, 03:18:42 PM Fee paid is total inputs minus total outputs. So you can calculate the fee yourself.
Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: MusaMohamed on June 30, 2023, 03:00:57 AM in a terminal it is Is it what you needCode: > getrawtransaction txid if you use the python console, you need to comply with the python syntax: Code: getrawtransaction("txid") In the gui you can also use the menu: Tools -> Load Transaction -> From the blockchain Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: NotATether on June 30, 2023, 04:21:02 AM Fee paid is total inputs minus total outputs. So you can calculate the fee yourself. Yes I can calculate the total fee but I would also like to calculate the fee rate in sats/vbyte, and to do this I must measure the size of the transaction in Weight Units or some other measurement, then divide the total fee by vsize. Some python function that does it without additional libraries would be useful, alternatively just point to some place in bitcoinlib or something where transactions are deserialized and I can rip that part out. in a terminal it is Is it what you needCode: > getrawtransaction txid if you use the python console, you need to comply with the python syntax: Code: getrawtransaction("txid") In the gui you can also use the menu: Tools -> Load Transaction -> From the blockchain Unfortunately, the raw transaction does not contain information about its fee. Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: nc50lc on June 30, 2023, 08:04:52 AM But what about in the case of using the Electrum daemon/CLI to fetch any transaction? There doesn't seem to be a specific method for getting the fee info of a transaction, and gettransction just returns a raw transaction that doesn't contain transaction size (or vsize) and fee paid. Yes, I checked "commands.py" and nothing in it outputs the 'fee rate' or 'transaction size'.Link: https://github.com/spesmilo/electrum/blob/master/electrum/commands.py (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py) deserialize also do not return with the transaction's fee rate, just the exact data in the raw transaction. Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: bitmover on June 30, 2023, 01:48:52 PM But what about in the case of using the Electrum daemon/CLI to fetch any transaction? There doesn't seem to be a specific method for getting the fee info of a transaction, and gettransction just returns a raw transaction that doesn't contain transaction size (or vsize) and fee paid. Yes, I checked "commands.py" and nothing in it outputs the 'fee rate' or 'transaction size'.Link: https://github.com/spesmilo/electrum/blob/master/electrum/commands.py (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py) deserialize also do not return with the transaction's fee rate, just the exact data in the raw transaction. I found this. Maybe it helps https://github.com/spesmilo/electrum/blob/master/electrum/transaction.py Code: def estimated_size(self): Title: Re: Electrum CLI - getting the fee and/or transaction size of a transaction Post by: NotATether on June 30, 2023, 02:05:18 PM But what about in the case of using the Electrum daemon/CLI to fetch any transaction? There doesn't seem to be a specific method for getting the fee info of a transaction, and gettransction just returns a raw transaction that doesn't contain transaction size (or vsize) and fee paid. Yes, I checked "commands.py" and nothing in it outputs the 'fee rate' or 'transaction size'.Link: https://github.com/spesmilo/electrum/blob/master/electrum/commands.py (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py) deserialize also do not return with the transaction's fee rate, just the exact data in the raw transaction. I found this. Maybe it helps https://github.com/spesmilo/electrum/blob/master/electrum/transaction.py Code: def estimated_size(self): Oh, OK. So is this an Electrum command exposed to the user, or just a regular function? |