Account management
Last updated
Was this helpful?
Last updated
Was this helpful?
In Shine and EOSIO, there are two types of entities that operate with user keys - wallets and accounts. An account is a human-readable name that identifies a particular user (for example, Abhinavramesh could be an account) and is stored in the blockchain (similar to Bitcoin and Ethereum addresses). Each account is associated with one or more key pairs. Information about this is stored in the blockchain. Wallets are files in which key pairs are recorded. These key pairs can be either associated with certain accounts or not associated with any accounts. The keys contained in the wallet are encrypted with a password. Wallet-files are usually stored offline.
Thus, accounts and wallets actually "do not know" about each other. In one wallet, key pairs from different accounts belonging to different owners can be recorded. At the same time, key pairs associated with one account can be stored in different wallets on different devices. Note that, since to record a key pair in a wallet it is necessary to know a private key, so the wallets and passwords from them must be stored in safe places.
To create an account, you need to make a corresponding record in the blockchain. Such a record should contain the name of the new account and the public keys associated with this account. Each public key is authorized to perform certain operations on behalf of the account. When creating an account, the keys for the access groups are defined (permissions). "Owner" is the key that has the right to sign transactions that change the access rights to the account, and "active" is the key that signs important transactions such as funds transfer. In addition to the above permission groups, you can create custom access groups. Instead of public keys, account names can be specified.
Each key, that belongs to a particular access group, has a weight in it. For each group of rights, a threshold is also specified - the amount of signature weights that is necessary to send transactions.
For example:
Account lab1234 “active” group access rights are the threshold value 3. The two public keys included in this group EOS6cicoG4z1VWdPMRUKJWxgsKMU3SiGxNXJ3oc32gpTLEdbhiW1Z
with weighing 2 and EOS69wbUAw9pVx7aHAHTtMLi4Gy2e3GE2GFWZRSwgsk5hCBWnPD6p
also with the weight 2. Thus, for example, to add data on purity/fineness of the gold, you need to sign the transaction by both keys, so that the total weight of signatures is 2 + 2 = 4 > 3.
As mentioned above, the wallet is an offline storage of private key pairs. Each wallet is a file containing one or more key pairs. The file is stored in the local file system and is in encrypted form. The password by which the wallet is encrypted is shown to the user when creating the wallet. It must be saved in a safe place, since if you lose the password, the wallet will be computationally infeasible to unlock and you will not be able to access the private keys.
In the created wallet, you can import any key pair. It will also be saved and encrypted.
The wallet has two states - lock and unlock. In the lock state, the wallet is encrypted. In the unlock state, the wallet is decrypted for cleos
and keosd
clients and they can use private keys to sign transactions.
In order to sign a transaction with a private account key, cleos
must find out the corresponding public key. That is, extract information about the account from the blockchain with the help of nodeos. Further, from the unlocked wallets the needed private key is extracted. Thus, the signature of the transaction without connection to the node is impossible, but at the same time, the node does not receive any information about the private key.