Magickbase / neuron-public-issues

Neuron Issues
4 stars 3 forks source link

Unable to import wallet created from ckb-cli #354

Open contrun opened 5 months ago

contrun commented 5 months ago

I am running Neuron-v0.112.0-x86_64.AppImage on nixos. I find neuron cannot import a keystore file created freshly by ckb-cli. After deleting the field origin from the file created by ckb-cli (this trick is discovered by export a wallet created by neuron itself and comparing the file format, I think we need to document this file format somewhere), I successfully imported the keystore file. Below are the steps to reproduce this issue.

My ckb-cli version is

ckb-cli --version
ckb-cli 0.103.0 (1ec3ffd 2022-06-24)

Create a new account with password qwertyui1!

ckb-cli account new 
Your new account is locked with a password. Please give a password. Do not forget this password.
Password: 
Repeat password: 
address:
  mainnet: ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgs9tg3r04mvanjw8jzkw3rsxkzawydj7c88gugg
  testnet: ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgs9tg3r04mvanjw8jzkw3rsxkzawydj7cf4rnzs
address(deprecated):
  mainnet: ckb1qyqpq2k3zxltkem8yu0y9vaz8qdv96ugm9asczrphp
  testnet: ckt1qyqpq2k3zxltkem8yu0y9vaz8qdv96ugm9as98a7ma
lock_arg: 0x102ad111bebb6767271e42b3a2381ac2eb88d97b
lock_hash: 0xcd8c4ecbf96bd8c5d782682b065f6446bc6f2a4bd2a37c2d95b285b59426e494

Here is the keystore file to that account, this file can not be imported to neuron wallet.

jq < ~/.ckb-cli/keystore/UTC--2024-02-13T16-30-02.363165640Z--102ad111bebb6767271e42b3a2381ac2eb88d97b
{
  "ckb_root": {
    "chain_code": "eec90d230686c7933afa71d637209605099d1d78d7f73eece97a3fccd78e730b",
    "path": "m/44'/309'/0'",
    "pubkey": "02b88d200cda995d919435f535676bbedc6366dce9fdf0eb0e8b64dbbfc3081067"
  },
  "crypto": {
    "cipher": "aes-128-ctr",
    "cipherparams": {
      "iv": "27ff473a1e579a00d3876b155be6b70d"
    },
    "ciphertext": "3890077b1b138b5f695846b9572ac8f83674fe2b1cb26e979f83aaf0caf324e1ff320bc41470e256ef03a0f75cffa4a4bde332967132e8e1d928d78fb9149946",
    "kdf": "scrypt",
    "kdfparams": {
      "dklen": 32,
      "n": 262144,
      "p": 1,
      "r": 8,
      "salt": "de94db7d697450b2f351f4abbcf2047e90516b2e43df101973a4bbf88fb1a80c"
    },
    "mac": "5d17b965d9a74a30c04758b775492aa20516abb77f3750eee5affe26831de82d"
  },
  "hash160": "102ad111bebb6767271e42b3a2381ac2eb88d97b",
  "id": "c8832c82-8096-429c-88f7-f8633740b2e6",
  "origin": "ckb-cli",
  "version": 3
}

Try to import the file above, and the import will fail

Edit the keystore file manually and delete the field origin

nvim ~/.ckb-cli/keystore/UTC--2024-02-13T16-30-02.363165640Z--102ad111bebb6767271e42b3a2381ac2eb88d97b

Now the field origin is deleted

jq < ~/.ckb-cli/keystore/UTC--2024-02-13T16-30-02.363165640Z--102ad111bebb6767271e42b3a2381ac2eb88d97b
{
  "ckb_root": {
    "chain_code": "eec90d230686c7933afa71d637209605099d1d78d7f73eece97a3fccd78e730b",
    "path": "m/44'/309'/0'",
    "pubkey": "02b88d200cda995d919435f535676bbedc6366dce9fdf0eb0e8b64dbbfc3081067"
  },
  "crypto": {
    "cipher": "aes-128-ctr",
    "cipherparams": {
      "iv": "27ff473a1e579a00d3876b155be6b70d"
    },
    "ciphertext": "3890077b1b138b5f695846b9572ac8f83674fe2b1cb26e979f83aaf0caf324e1ff320bc41470e256ef03a0f75cffa4a4bde332967132e8e1d928d78fb9149946",
    "kdf": "scrypt",
    "kdfparams": {
      "dklen": 32,
      "n": 262144,
      "p": 1,
      "r": 8,
      "salt": "de94db7d697450b2f351f4abbcf2047e90516b2e43df101973a4bbf88fb1a80c"
    },
    "mac": "5d17b965d9a74a30c04758b775492aa20516abb77f3750eee5affe26831de82d"
  },
  "hash160": "102ad111bebb6767271e42b3a2381ac2eb88d97b",
  "id": "c8832c82-8096-429c-88f7-f8633740b2e6",
  "version": 3
}

Import the file again, now it works

yanguoyu commented 4 months ago

https://github.com/nervosnetwork/neuron/commit/1b66ea36af0a7b7ed672fbefb429562acf61131a If currently, Neuron can support ckb-cli keystore file, we can remove this logic.

contrun commented 4 months ago

I would like to know the historical reason of why the functionality of importing ckb-cli keystore file was removed. If there is indeed something that makes ckb-cli keystore file and neuron keystore file incompatible, then I think we should warn the user and tell them what's happening.

yanguoyu commented 4 months ago

I would like to know the historical reason of why the functionality of importing ckb-cli keystore file was removed. If there is indeed something that makes ckb-cli keystore file and neuron keystore file incompatible, then I think we should warn the user and tell them what's happening.

https://github.com/nervosnetwork/ckb-cli/wiki/Import-ckb-cli-keystore-from%26to-Neuron-wallet#ckb-cli-and-neuron-use-the-keystore-in-different-way Hi, because they are using different derivative rules, the generated addresses may be different. I believe we should tell the user the reason why neuron does not support ckb-cli's keystore file. @Danie0918

Keith-CY commented 1 month ago

Some users were confused by this case too, it would be grateful if a brief guide can be added @Danie0918

Danie0918 commented 1 month ago

Some users were confused by this case too, it would be grateful if a brief guide can be added @Danie0918

Okay, I'll take it over.

Danie0918 commented 1 month ago

Image

【Add a prompt when importing wallets from ckb-cli】

  1. Display prompt text, text fixed display, according to the software to select the language to switch the language.
  2. Add external link instructions, and click to open the browser to jump to the relevant link.
Kirl70 commented 1 month ago

Design Draft:

https://www.figma.com/design/6XNoimRDbFTTNm016rbIdU/Magickbase?node-id=39127-51231&t=yZ1AXdl9HCKoIymK-1

image
devchenyan commented 4 weeks ago

https://github.com/nervosnetwork/neuron/pull/3192

silySuper commented 3 weeks ago

1.Click X to close window does not works.

https://github.com/Magickbase/neuron-public-issues/assets/25971273/de231724-faa7-4c3e-b25f-3a5c379d9ea8

2.English shows abnormal.

截屏2024-06-27 17 01 55
devchenyan commented 2 weeks ago

1.Click X to close window does not works.

2024-06-27.17.02.42.mov 2.English shows abnormal. 截屏2024-06-27 17 01 55

https://github.com/nervosnetwork/neuron/pull/3192

  1. fixed
  2. The display is not quite right due to the font design.