Wallet Encryption

From Veriblock Wiki
Revision as of 21:42, 15 January 2019 by VeriBlockTim (talk | contribs) (Created page with "See: Technical Articles == Introduction == Transactions in NodeCore are built on the foundations of asymmetric cryptography. Each address in NodeCore is associated with...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See: Technical Articles

Introduction

Transactions in NodeCore are built on the foundations of asymmetric cryptography. Each address in NodeCore is associated with a private and public key. The wallet.dat file produced by NodeCore is the store for holding your keys. VeriBlock is rolling out an update to the format of the wallet.dat file that enables a user to institute an additional layer of protection on their private keys via encryption.

Format Changes

It should be noted that the format of the wallet.dat file changes in version {0.X.Y}. That version of NodeCore is backwards-compatible in that it will still read in an existing wallet.dat file. It will, however, upgrade the format of the file. Once upgraded, that wallet.dat will no longer work with NodeCore v0.3.9 or lower. NOTE: It is highly recommended to make a backup of your wallet.dat file prior to updating NodeCore

By default, new wallets are created unencrypted. It is the same if loading from an existing wallet.dat file.

Encrypting the Wallet

To facilitate encryption of the wallet, 4 new CLI commands are introduced.

encryptwallet

The encryptwallet command takes no arguments, but will prompt for a passphrase (which will be hidden from view). Running this command will alter the wallet.dat file so that private keys are encrypted. Additionally, the loaded wallet in NodeCore enters a "locked" state. While in the "locked" state, any commands that require a private key (transaction creation, generating new addresses, signing messages) will fail.

unlockwallet

The unlockwallet command takes no arguments, but will prompt for a passphrase (which will be hidden from view). This command "unlocks" the loaded wallet in NodeCore, allowing NodeCore access to the private keys, thereby enabling commands dependent on private keys. The passphrase supplied should be the same as what was used to encrypt the wallet. This command has no effect on the wallet.dat file on disk. The loaded wallet remains unlocked until the wallet is explicitly locked again.

lockwallet

The lockwallet command takes no arguments. This command returns the loaded wallet in NodeCore to a "locked" state. This command has no effect on the wallet.dat file on disk.

decryptwallet

The decryptwallet command takes no arguments, but will prompt for a passphrase (which will be hidden from view). The command decrypts the wallet.dat file and returns the private key to a plain-text representation in the file on disk. The passphrase supplied should be the same as what was used to encrypt the wallet.

A user looking to change the password used to encrypt their wallet file would first run decryptwallet with their old passphrase, then run encryptwallet with their new passphrase.

Changes to NodeCore CLI

The following commands require that a wallet has been "unlocked" or they will fail immediately:

getnewaddress
signmessage
signhexmessage
importwallet
send
dumpprivatekey
importprivatekey

An additional <passphrase> parameter has been added to the importwallet command. That parameter is needed if the wallet you are importing is also encrypted. It is the passphrase associated with the wallet to be imported (not the loaded wallet in NodeCore). The wallet in NodeCore also needs to have been unlocked via the unlockwallet command.

Changes to PoP Miner

Because Proof-of-Proof mining involves the creation of a transaction, the NodeCore wallet must be "unlocked" in order to do proof-of-proof mining. The unlockwallet and lockwallet commands have been replicated in the proof-of-proof miner. A mining operation will fail immediately getting PoP instructions if the wallet is "locked".