|
| 1 | +# Wallet Management |
| 2 | + |
| 3 | +`oasis wallet` command is used to manage your file-based or hardware wallet |
| 4 | +accounts. Oasis CLI supports the following account kinds: |
| 5 | + |
| 6 | +- `ed25519-adr8`: Ed25519 keypair using [ADR-8] derivation path to obtain |
| 7 | + a private key from mnemonic. This is the default setting suitable for |
| 8 | + accounts on the Oasis consensus layer. |
| 9 | +- `secp256k1-bip44`: Secp256k1 Ethereum-compatible keypair using [BIP-44] |
| 10 | + with ETH coin type to derive a private key. This setting is |
| 11 | + used for accounts living on EVM-compatible ParaTimes. The same account can |
| 12 | + be imported into Metamask and other Ethereum wallets. |
| 13 | +- `ed25519-legacy`: Ed25519 keypair using a legacy 5-component derivation path. |
| 14 | + This is the preferred kind for Oasis accounts stored on |
| 15 | + a hardware wallet like Ledger. It is called legacy, because it was |
| 16 | + implemented before [ADR-8] was standardized. |
| 17 | +- `ed25519-raw` and `secp256k1-raw`: Ed25519 and Secp256k1 respective keypairs |
| 18 | + imported directly from Base32 or Hex-encoded private key. These kinds |
| 19 | + do not use a derivation path. |
| 20 | + |
| 21 | +:::tip |
| 22 | + |
| 23 | +For compatibility with Ethereum, each `secp256k1` account has two addresses: |
| 24 | + |
| 25 | +- 20-byte hex-encoded Ethereum-compatible address, e.g. `0xDCbF59bbcC0B297F1729adB23d7a5D721B481BA9` |
| 26 | +- Bech32-encoded Oasis native address, e.g. `oasis1qq3agel5x07pxz08ns3d2y7sjrr3xf9paquhhhzl`. |
| 27 | + |
| 28 | +There exists a mapping from Ethereum address to the native Oasis address as in |
| 29 | +the example above, but there is no reverse mapping. |
| 30 | + |
| 31 | +::: |
| 32 | + |
| 33 | +[ADR-8]: ../../../adrs/0008-standard-account-key-generation.md |
| 34 | +[BIP-44]: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki |
| 35 | + |
| 36 | +## Create or Import wallet |
| 37 | + |
| 38 | +`oasis wallet create` will generate a new mnemonic and derive a keypair for |
| 39 | +you. For optimal security, you can connect your Ledger wallet and create an |
| 40 | +account which uses a private key stored on the hardware wallet. |
| 41 | + |
| 42 | +If you already have a mnemonic or a raw private key, you can import it |
| 43 | +as a new account by running `oasis wallet import`. You will then need to |
| 44 | +provide a mnemonic or the raw private key in the corresponding format. |
| 45 | + |
| 46 | +## View wallets |
| 47 | + |
| 48 | +You can list all available wallets with `oasis wallet list`: |
| 49 | + |
| 50 | +``` |
| 51 | +$ oasis wallet list |
| 52 | +ACCOUNT KIND ADDRESS |
| 53 | +emerald_test file (secp256k1-raw) oasis1qq3agel5x07pxz08ns3d2y7sjrr3xf9paquhhhzl |
| 54 | +john file (ed25519-raw) oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve |
| 55 | +oasis_hackathon file (ed25519-adr8:0) oasis1qptx7ytle3xlccyvk9w27f47jq4pfqxrug2dzwtv |
| 56 | +sapphire_test file (secp256k1-raw) oasis1qpupfu7e2n6pkezeaw0yhj8mcem8anj64ytrayne |
| 57 | +sapphire_tictactoe1 file (secp256k1-bip44:0) oasis1qqd333zt6lrx734szrcay2cjzek9uumlf5rrmmr7 |
| 58 | +sapphire_tictactoe2 file (secp256k1-bip44:1) oasis1qrk58a6j2qn065m6p06jgjyt032f7qucy5wqeqpt |
| 59 | +``` |
| 60 | + |
| 61 | +Above, you can see native Oasis addresses of all local accounts. You can see |
| 62 | +the public key of an account and for `secp256k1` accounts their Ethereum |
| 63 | +addresses by using `oasis wallet show`: |
| 64 | + |
| 65 | +``` |
| 66 | +$ oasis wallet show emerald_test |
| 67 | +Unlock your account. |
| 68 | +? Passphrase: |
| 69 | +Name: emerald_test |
| 70 | +Public Key: A8JDpTiCnrq+zFUsAHrHY/xuFVsyt48sC1Srkp62r7Yx |
| 71 | +Ethereum address: 0xDCbF59bbcC0B297F1729adB23d7a5D721B481BA9 |
| 72 | +Native address: oasis1qq3agel5x07pxz08ns3d2y7sjrr3xf9paquhhhzl |
| 73 | +``` |
| 74 | + |
| 75 | +To print the account's mnemonic or the private key, run `oasis wallet export`: |
| 76 | + |
| 77 | +``` |
| 78 | +$ oasis wallet export emerald_test |
| 79 | +WARNING: Exporting the account will expose secret key material! |
| 80 | +Unlock your account. |
| 81 | +? Passphrase: |
| 82 | +Name: eth_0 |
| 83 | +Public Key: A8JDpTiCnrq+zFUsAHrHY/xuFVsyt48sC1Srkp62r7Yx |
| 84 | +Ethereum address: 0xDCbF59bbcC0B297F1729adB23d7a5D721B481BA9 |
| 85 | +Native address: oasis1qq3agel5x07pxz08ns3d2y7sjrr3xf9paquhhhzl |
| 86 | +Export: |
| 87 | +0x0b5e6994430f9d3a5b6619b97e6af146b88f06457372764b36cdcff10c1c64f8 |
| 88 | +``` |
| 89 | + |
| 90 | +## Test wallets |
| 91 | + |
| 92 | +Oasis CLI comes with the following hardcoded testing accounts: |
| 93 | + |
| 94 | +- `test:alice`: Ed25519 test account by Oasis core tests |
| 95 | +- `test:bob`: Ed25519 test account by Oasis core tests |
| 96 | +- `test:charlie`: Secp256k1 test account |
| 97 | +- `test:cory`: Ed25519 account used by `oasis-net-runner` |
| 98 | +- `test:dave`: Secp256k1 test account |
| 99 | +- `test:erin`: Sr25519 test account |
| 100 | +- `test:frank`: Sr25519 test account |
| 101 | + |
| 102 | +Those accounts are often used for your Localnet development or when |
| 103 | +reporting bugs to oasis-core team for reproducibility. You can access the |
| 104 | +private key of a test account the same way as you would for ordinary accounts |
| 105 | +by running `oasis wallet export` command. |
| 106 | + |
| 107 | +[oasis-core]: https://github.com/oasisprotocol/oasis-core |
0 commit comments