Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate delegation transaction with --generate-only without a key in the keybase #3889

Closed
4 tasks
joe-bowman opened this issue Mar 14, 2019 · 7 comments · Fixed by #3960
Closed
4 tasks

Comments

@joe-bowman
Copy link
Contributor

joe-bowman commented Mar 14, 2019

We have come across this issue with a potential delegator, who doesn't own a ledger, so wants to generate a transaction, to sign offline, as per the instructions here:

https://github.com/cosmos/cosmos-sdk/blob/develop/docs/gaia/delegator-guide-cli.md#signing-transactions-from-an-offline-computer

Summary of Bug

The gaiacli tx staking delegate takes a --from param. The problem here is that from (unlike in the docs, which I believe to be incorrect) take the name of a key stored in the keystore, and not a bech32 account key.

For someone who doesn;t want to add their account to an Internet connected machine, this poses an issue. Any command with --generate-only should not require a --from key as the two are completely incompatible.

There is a workaround, by adding a pubkey type to the keybase, and using that - but it seems unintuitive.

Steps to Reproduce

Follow the official delegation docs to generate a tx to sign offline.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

alexanderbez commented Mar 14, 2019

Thanks @joe-bowman. The --from value can be either the Keybase name or the Bech32 account address. I'm not quite understanding the problem tbh. The --generate-only flag needs a --from to populate the address. Can you help clarify the issue?

Namely,

For someone who doesn;t want to add their account to an Internet connected machine, this poses an issue.

Why? You can have a Keybase that isn't connected to the internet to sign txs (use the --offline flag).

@joe-bowman
Copy link
Contributor Author

I think I see the issue:

if addr, err := sdk.AccAddressFromBech32(from); err == nil {

Even if you are using a bech32 cosmos... address that key needs to exist in the keybase; so presumably adding this as a public key is the correct solution.

This is unintuitive and not clear at all from the documentation.

@alexanderbez
Copy link
Contributor

This is unintuitive and not clear at all from the documentation.

What is exactly unclear? Can you elaborate please?

@joe-bowman
Copy link
Contributor Author

That you cannot provide an arbitrary bech32 key in --from - it has to exist in your keystore. So if you want to sign offline, you need to have added it with the --public method of gaiacli keys add.

@alexanderbez
Copy link
Contributor

alexanderbez commented Mar 14, 2019

Ahhh yes yes. The REST client API doesn't use a Keybase and thus only supports generate only. I believe in the same spirit, the CLI client should also do the same -- not require access to a Keybase. In other words, update NewCLIContext to check if --generate-only is provided, if so, require that a Bech32 address is given in --from and do no Keybase lookup.

@sabau or @fedekunze are either of you interested in picking this up?

@joe-bowman joe-bowman changed the title Unable to generate delegation transaction for signing offline Unable to generate delegation transaction for signing offline without a key in the keybase Mar 15, 2019
@joe-bowman joe-bowman changed the title Unable to generate delegation transaction for signing offline without a key in the keybase Unable to generate delegation transaction with --generate-only without a key in the keybase Mar 15, 2019
@jackzampolin
Copy link
Member

I've run into this issue primarily with delegation. We should make the --generate-only flag imply --offline

@jackzampolin jackzampolin added this to the v0.34.0 milestone Mar 16, 2019
@alexanderbez alexanderbez self-assigned this Mar 16, 2019
@alexanderbez
Copy link
Contributor

No, not necessarily. I think the main actionable item here is when --generate-only is provided, not to use the Keybase and enforce that the --from is a valid Bech32 cosmos address. This is exactly what the REST client does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants