Source Print Discuss
🔰 Final Standard

PIP-13: Import Private Keys

Import private keys to wallet

Authors Amir Babazadeh (@amirvalhalla)
Discussion View Discussion PIP-13
Created 2023-11-27

Abstract

Currently, the Pactus wallet does not support importing private keys. This document proposes a method to import private keys.

Motivation

Importing private keys will give users the ability to store external private keys inside the wallet safely.

Specification

We propose adding a new Purpose 1 for imported private keys and setting it to 65535 (FFFF). The address path for imported private key is defined like below:

m / purpose' / coin_type' / address_type' / import_index'

The apostrophe in the path indicates that hardened derivation is used. For the imported private key all level are hardened and defined as follows:

  • Purpose: Set to 65535 (0xFFFF).
  • Coin Type: As defined at PIP-82.
  • Address Type: As defined at PIP-82.
  • Import Index: This is a fixed and hardened number that starts at zero. It indicates the position of a key in the list of imported keys. When new private keys are added, they are placed at the end of this list. This list must be securely encrypted using the wallet’s password.

This structure is particularly useful for determining if an address is imported, based on the address path. It also helps to sort the addresses better.

Example

m/65535'/21888'/1'/0'  // imported Validator address at index zero
m/65535'/21888'/2'/0'  // imported BLS-Account address at index zero

References


Copyright

Copyright and related rights waived via CC0.