Skip to content

Wallet File

Bytecoin Developers Team edited this page Feb 21, 2018 · 1 revision

Introduction

Historically Bytecoin uses various formats for storing keys. Current version is V2, it is used by old GUI wallet and old Payment Gate daemon. The new Bytecoin also uses V2 file format with some twists (see below).

File structure

Wallet file is designed to store a list of addresses (minimum one) with corresponding keys and is encrypted with ChaCha8 algorithm. Specifying no password encrypts with a key derived from the empty string.

Each address has a unique spend key pair, but they all share the common view key pair, so from user's perspective, all addresses stored in a single wallet file will have a common right half of address string.

Common view key pair is on purpose. In Bytecoin transactions are anonymous, finding transactions corresponding to some address requires scanning all transaction in blockchain performing slow computations per view key part of the address. Several dozens of different view keys would be enough to exceed modern PC processing capabilities.

Creation timestamp is also stored in wallet file, this allows skipping scanning (significant) part of blockchain prior to the wallet creation.

Deterministic vs non-deterministic

V2 wallet file uses non-deterministic key generation, each key is random. So you should back up wallet file after adding addresses to it, otherwise you risk losing keys for new addresses. This will change in V3.

View-only wallet

View-only wallet file is created by zeroing private spend keys in existing wallet file. When such a file is open by walletd, it allows viewing transaction corresponding to addresses it stores, but does not allow spending.

Transaction history

In Bytecoin, if you do not save addresses you sent money to, you cannot get this information later from blockchain and reveal those addresses. That's why transaction history is an important component being worth backing up.

The old Bytecoin stores history of transactions it sent in the tail section of V2 file, right after keys. In contrast, the new Bytecoin stores history in the <wallet_file>.history folder adjacent to the wallet file in separate files per transaction. You should back up this folder periodically otherwise you risk losing your history.

Interoperability with old Bytecoin

The old Bytecoin's walletd stores wallet cache (megabytes or more) in the tail section of V2 wallet file, after keys and history. The new Bytecoin's walletd stores wallet cache in 'wallet_cache' folder located in the Coin Folder, keeping wallet file very small (~100 bytes per address).

You can make new Bytecoin's walletd truncate the tail section of V2 wallet file by changing wallet file password.

Opening such file by an old Bytecoin will make it rescan blockchain recreating wallet cache in tail section.

Interoperability with simplewallet

simplewallet uses V1 wallet file format. The new Bytecoin's walletd will open V1 file, but overwrite it with V2 format on any modification (e.g. adding addresses or changing password). After that simplewallet will not be able to open the file.