0chain / gosdk

A client SDK in Go to interface the blockchain and storage platform, and other smart contracts
MIT License
32 stars 29 forks source link

Wallet downloaded from 0Chain main page cannot be used for zwallet cli #511

Closed Dmdv closed 2 years ago

Dmdv commented 2 years ago

When I download the wallet from wallet details page, i.e. https://dev-nonce.devnet-0chain.net/wallet/detail it comes in the following format.

Both are with "version": "1.0",

{
  "id": "5xxx",
  "version": "1.0",
  "creation_date": 1657630352,
  "public_key": "exxx",
  "secretKey": "8xxx",
  "mnemonic": "mnemonicxxx",
  "timeStamp": 1657630353547,
  "cluster_name": "local",
  "balance": {
    "txn": "axxx",
    "round": 72301,
    "balance": 5000000000,
    "nonce": 5
  }
}

However GOSDK expects the wallet in the following format

{
  "client_id": "dxxx",
  "client_key": "9xxx",
  "keys": [
    {
      "public_key": "9xxx",
      "private_key": "fxxx"
    }
  ],
  "mnemonics": "mnemonicsxxx",
  "version": "1.0",
  "date_created": "2022-07-12T23:47:31+05:00",
  "nonce": 0
}

Is it by design or downloadable wallet must be in compliance with GOSDK format?

cnlangzi commented 2 years ago

@Dmdv hmm, it works with cli.

sculptex commented 2 years ago

Irrespective, the mnemonic should be used to restore the wallet to its native target format and actually on CLI many tasks can be performed just with public and private key pair.