Cosmos-sdk: Add a confirmation displaying the cost of transaction to the CLI

Created on 14 Feb 2019  路  6Comments  路  Source: cosmos/cosmos-sdk

Summary

When you create a transaction, before you input your password you need to be prompted with the amount of Atoms this transaction will cost. Something like:

"This transaction will cost you 10 Atoms in transaction fees. Are you sure you want to proceed? Y\n"

Problem Definition

  • Gas is hard to understand.
  • A typo in Gas Prices can happen. Because fees = gas * gas-prices, a typo can end up in ten times more fees than expected.

Proposal


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
CLI UX

Most helpful comment

I think confirming sends by default is fine, but we should have a --fast or -y / --yes flag.

All 6 comments

Although I think you've got a point in asking to show users the gas price they are going to agree to pay for the tx, I have mixed feelings about turning this sort of interactive mode on by default, considering that we have a specific flag to only simulate the transaction and display an estimate of the gas price (--dry-run).

Thoughts @cosmos/cosmossdk ?

I think it would also be okay to have this feature (which really only adds security) enabled by default so long as it could be easily turned off with --fast flag or something

I think confirming sends by default is fine, but we should have a --fast or -y / --yes flag.

:+1: to the -y/--yes flag

fret not @gamarin2, even though #3698 was merged, we can now simply add a new print statement in the prompt stating the converted fee. I stated it ties into #3510 now because we need this conversion functionality and denom mapping -- it can be simple for now (e.g. ToAtoms(20000000, "uatom"), FromAtoms(2, "uatom"))

Was this page helpful?
0 / 5 - 0 ratings