semuxproject / semux-core

Semux Core
https://www.semux.org
MIT License
76 stars 31 forks source link

API: should we expose the gas and gasPrice in the transaction? #197

Closed semuxgo closed 5 years ago

semuxgo commented 5 years ago

I thought about this before. Logically, it should be parts of the transaction response, since it's part of the transaction.

My main concern is about API compatibility break. For now, we expose the gas, gasPrice, gasUsed in the transaction result response.

Write up this issue to note the trade-off.

semuxgo commented 5 years ago

One drawback is that we won't be able to get these data for pending transactions.

orogvany commented 5 years ago

Gas supplied and price bid for gasprice are part of transaction signed. I'm not sure one can remove them, as sig won't match. GasUsed def belongs in results.. I do worry about including them in tx result (in db) as it would be more space. For API, I could go either way. Usually when I care about gas after the fact, I'd like to see gas and GasUsed in same web call

orogvany commented 5 years ago

Gas price and gas are not really removable from the transaction. They are user specified, so we will always have them in code for sorting pending txs

semuxgo commented 5 years ago

Agreed. Let's add gas and gasPrice into the /transaction response.