- Getting Started
- Key Concepts
- Deep Dive
- APIs, SDKs and Tools
Keypairs, Mnemonics And Wallets
In everiToken, each account is recognized by a pair of public and private key (mainly private key, and public key can be derived from the private key).
The private key is a string of fixed length random bytes, which is usually converted to a string. We also call it
wit string. A person will be recognized as the owner of an account if he / she has the private key of the account.
A public key is usually represented by a string beginning with
EVT, representing user identity.
The public and private key can be used directly after being generated locally without being registered on the chain.
In addition to prefix differences, EVT's public key and private key are compatible with EOS.
For example, suppose you have a public key of EOS: EOSd8d7LL3jf7238sl12Ps98vbbsDK, then you can simply change the first three letters to
EVTand get a legitimate EVT public key: EVTd8d7LL3jf7238sl12Ps98vbbsDK. This means that you can reuse the key generation algorithm of EOS.
BIP39 (Mnemonics) and BIP44
everiToken follows BIP39, so a wallet can use mnemonics to help users remember their keypairs. We use the same algorithm as Ethereum does.
Private keys can be computed by mnemonics. So mnemonics are very important and must be kept safe.
For the developers of the wallet: if you need to support the creation of our private key through a
mnemonic code, especially through a BIP44 protocol to generate different private keys from a memorable word, the code of EVT is 207.
More information about BIP44, please see here: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
Using wallets to create a keypair
A wallet is a place to store your private key. We provide
evtc which supports creating wallets using command line. There are also many other ways to do so (SDKs, 3rd-party wallet sofwares and so on).
Create a wallet via a mobile wallet
MyEVT is an open-source mobile wallet built by our lovely community members. Visit http://myevt.io for detail.
Create a wallet via
evtc command line
We will use evtc to create the default wallet,
evtc will create the wallet server automatically:
evtc wallet create
evtc will prompt that it created the "default" wallet, and will provide a password for the future access of the wallet. You need to keep the password seriously for future use. Here is an example of the output:
Creating wallet: default Save password to use in the future to unlock this wallet. Without password imported keys will not be retrievable. "PW5KFv4tQfhf8bWwePqrmPM2QbcTTTxUwDzg1bgmaJaHiquT9qeuC"
When creating "default" wallet, it will create a new key pair for you. You can see your key by typing:
evtc wallet keys
Here's an example output:
[[ "EVT6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" ] ]
If you want to generate new key, you can type this:
evtc create key
You will get like:
Private key: 5K8N8MZfkzdE4iaMVqR2btgTMM4MTWNAjyVJQjN8Zw1EWmXsW52 Public key: EVT546WaW3zFAxEEEkYKjDiMvg3CHRjmWX2XdNxEhi69RpdKuQRSK
Then you can import new key to your wallet:
evtc wallet import 5K8N8MZfkzdE4iaMVqR2btgTMM4MTWNAjyVJQjN8Zw1EWmXsW52
Key will be imported like this:
imported private key for: EVT546WaW3zFAxEEEkYKjDiMvg3CHRjmWX2XdNxEhi69RpdKuQRSK
Create keypairs via
EvtKey is a class for everiToken's key management.
randomPrivateKey to create a new private key:
// randomPrivateKey returns a promise so we should use await or 'then' let key = await EVT.EvtKey.randomPrivateKey(); // now key is the private key (as wit format).
After generating a private key, you can convert it to a public key by
let publicKey = EVT.EvtKey.privateToPublic(key);