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

Sending a transfer transaction from the Ledger Nano S fails #3573

Closed
2 of 4 tasks
adrianbrink opened this issue Feb 9, 2019 · 5 comments
Closed
2 of 4 tasks

Sending a transfer transaction from the Ledger Nano S fails #3573

adrianbrink opened this issue Feb 9, 2019 · 5 comments
Assignees
Labels
C:Keys Keybase, KMS and HSMs C:Ledger Issues and features related Ledger integration and functionality T:Bug

Comments

@adrianbrink
Copy link
Contributor

adrianbrink commented Feb 9, 2019

Summary of Bug

Sending a transaction from the ledger fails.

Steps to Reproduce

  1. Register a ledger with the cli
  2. Send some tokens to the ledger address
  3. Create a new address on the cli
  4. Send tokens from the ledger to the new address -- This fails

The error message is

➜  cosmos-sdk git:(develop) ./build/gaiacli tx send cosmos1swsspfxys4frpzm3h35xef89x9qdcy04nan6q4 20photinos --from=test_ledger --ledger --fees=20000photinos --chain-id=gaia-10k --node="tcp://35.234.98.115:26657"
ERROR: please open Cosmos app on the Ledger device - error: Error code: 6804
➜  cosmos-sdk git:(develop) ./build/gaiacli version
0.30.0-dev2-86-g7bc837aa0

riot id: @adrianbrink:matrix.org


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adrianbrink adrianbrink changed the title Sending from ledger fails Sending a transfer transaction from the Ledger Nano S fails Feb 9, 2019
@zmanian
Copy link
Member

zmanian commented Feb 9, 2019

Might be fixed in 0.31
#3431

@adrianbrink
Copy link
Contributor Author

It's not fixed in #3431 . This bug report is generated on develop 14c0476f60ad41cea797a9a092f001eaaae633fd which includes #3431 .

@jleni jleni added the C:Ledger Issues and features related Ledger integration and functionality label Feb 10, 2019
@adrianbrink
Copy link
Contributor Author

adrianbrink commented Feb 10, 2019

On gaia-11001 I see the same behaviour. There is an inconsistenty between just giving --ledger and --ledger --from="test_ledger. I would expect that using those two flags should produce the same error messages.

➜  cosmos-sdk git:(b9e523212) gaiacli tx send cosmos1eysta0x7quczxkecrm6f36assewqddr0879wgv 33333photino --ledger --chain-id=gaia-11001 --node="tcp://35.198.155.173:26657"
ERROR: No account with address  was found in the state.
Are you sure there has been a transaction involving it?
➜  cosmos-sdk git:(b9e523212) gaiacli tx send cosmos1eysta0x7quczxkecrm6f36assewqddr0879wgv 33333photino --from=test_ledger --ledger --chain-id=gaia-11001 --node="tcp://35.198.155.173:26657"
ERROR: please open Cosmos app on the Ledger device - error: Error code: 6804

The first error message ERROR: No account with address was found in the state. must be wrong.
I am sending from this account

➜  cosmos-sdk git:(b9e523212) gaiacli query account cosmos1qumptahqxn7awk6urce7sp4yrr2fmcdnnh8fu0 --trust-node --output json --node="tcp://35.198.155.173:26657" | jq
{
  "type": "auth/Account",
  "value": {
    "address": "cosmos1qumptahqxn7awk6urce7sp4yrr2fmcdnnh8fu0",
    "coins": [
      {
        "denom": "photino",
        "amount": "1000000"
      }
    ],
    "public_key": null,
    "account_number": "989",
    "sequence": "0"
  }
}

to this account

➜  cosmos-sdk git:(b9e523212) gaiacli query account cosmos1eysta0x7quczxkecrm6f36assewqddr0879wgv  --trust-node --output json --node="tcp://35.198.155.173:26657" | jq
{
  "type": "auth/DelayedVestingAccount",
  "value": {
    "BaseVestingAccount": {
      "BaseAccount": {
        "address": "cosmos1eysta0x7quczxkecrm6f36assewqddr0879wgv",
        "coins": [
          {
            "denom": "photino",
            "amount": "9999000000"
          }
        ],
        "public_key": {
          "type": "tendermint/PubKeySecp256k1",
          "value": "ApMbpXOltvp26VnVYUCmU6jPiIviNUDItOD2nsmRvtKF"
        },
        "account_number": "935",
        "sequence": "23"
      },
      "OriginalVesting": [
        {
          "denom": "muon",
          "amount": "5000000000"
        }
      ],
      "DelegatedFree": [
        {
          "denom": "muon",
          "amount": "10000074226"
        }
      ],
      "DelegatedVesting": null,
      "EndTime": "1518652800"
    }
  }
}

My current thinking is that this error is caused since an account that is backed by a Ledger hasn't had its pubkey revealed. Maybe that's why it can't find the address in the state. However I am certain that the ledger account has a balance.

@jleni
Copy link
Member

jleni commented Feb 10, 2019

The root cause is that when the account is created, gaiacli is not correctly storing the derivation path in the keybase.

Any command that later refers to these ledger keys, fails because a derivation path 0/0/0/0/0 is sent to the ledger and it gets rejected.

@jleni
Copy link
Member

jleni commented Feb 10, 2019

I will now prepare a fix plus additional unit tests for the keybase store/restore functions.
And some additional checks to the keys add command in the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs C:Ledger Issues and features related Ledger integration and functionality T:Bug
Projects
None yet
Development

No branches or pull requests

3 participants