Skip to content

密鑰管理

助記詞,也稱為助記詞,是一組用於恢復或恢復加密貨幣錢包的詞。如果您無法訪問原始錢包,它可以作為訪問您的數字資產的備份。該短語通常是您創建錢包時生成的一系列 12-24 個單詞,應保持安全和私密。

助記詞的重要性在於加密貨幣以分散的方式存儲,這意味著沒有中央機構或機構持有或控制你的資金。這意味著如果您無法訪問您的錢包(例如忘記密碼、丟失您的設備),您將無法在沒有助記詞的情況下取回您的資金。因此,將您的助記詞存儲在安全可靠的地方至關重要,例如物理紙張或安全的數字文件。

此外,建議製作多份副本並將它們存放在不同的位置,以便您可以在任何緊急情況下使用您的資金。

助記符短語與私鑰

種子短語,也稱為恢復短語或備份短語,是用於生成私鑰的一系列單詞。它通常是一組 12 或 24 個單詞,用於在原始私鑰丟失或損壞的情況下恢復或恢復對加密貨幣錢包的訪問。種子短語可用於生成多個私鑰,這些私鑰可用於訪問多個加密貨幣地址和余額。

另一方面,私鑰是一長串字符,用於簽署交易並提供對您的加密貨幣資金的訪問。私鑰是從種子短語生成的,並且對於每個加密貨幣地址都是唯一的。它用於為交易創建數字簽名,以確保交易合法並已獲得資金合法所有者的授權。

總之,您的私鑰和助記詞的安全性至關重要。如果您的私鑰遭到洩露,可能會使所有關聯的帳戶面臨風險。但是,丟失助記詞可能會產生更嚴重的後果,因為它用於生成多個私鑰。因此,採取適當的措施來保護您的私鑰和助記詞以避免任何災難性的損失是至關重要的。

stcd CLI中的助記符

**在繼續使用 CLI 之前,請確保您已安裝 stcd

當您創建新密鑰時,您會收到一個可用於恢復該密鑰的助記詞。備份助記詞:

stcd keys add dev0
{
  "name": "dev0",
  "type": "local",
  "address": "dst1n253dl2tgyhxjm592p580c38r4dn8023ctv28d",
  "pubkey": '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"ArJhve4v5HkLm+F7ViASU/rAGx7YrwU4+XKV2MNJt+Cq"}',
  "mnemonic": ""
}

**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

# <24 word mnemonic phrase>

要恢復密鑰:

$ stcd keys add dev0-restored --recover
> Enter your bip39 mnemonic
banner genuine height east ghost oak toward reflect asset marble else explain foster car nest make van divide twice culture announce shuffle net peanut
{
  "name": "dev0-restored",
  "type": "local",
  "address": "dst1n253dl2tgyhxjm592p580c38r4dn8023ctv28d",
  "pubkey": '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"ArJhve4v5HkLm+F7ViASU/rAGx7YrwU4+XKV2MNJt+Cq"}'
}

密鑰導出

Tendermint-私鑰格式

要備份此類不帶助記詞的密鑰,請執行以下操作:

stcd keys export dev0
Enter passphrase to decrypt your key:
Enter passphrase to encrypt the exported key:
-----BEGIN TENDERMINT PRIVATE KEY-----
kdf: bcrypt
salt: 14559BB13D881A86E0F4D3872B8B2C82
type: secp256k1

# <Tendermint private key>
-----END TENDERMINT PRIVATE KEY-----

$ echo "\
-----BEGIN TENDERMINT PRIVATE KEY-----
kdf: bcrypt
salt: 14559BB13D881A86E0F4D3872B8B2C82
type: secp256k1

# <Tendermint private key>
-----END TENDERMINT PRIVATE KEY-----" > dev0.export

Ethereum-私鑰格式

注意: 這些類型的密鑰與 MetaMask 兼容

要備份此類不帶助記詞的密鑰,請執行以下操作:

stcd keys unsafe-export-eth-key dev0 > dev0.export
**WARNING** this is an unsafe way to export your unencrypted private key, are you sure? [y/N]: y
Enter keyring passphrase:

密鑰導入

Tendermint-私鑰格式

$ stcd keys import dev0-imported ./dev0.export
Enter passphrase to decrypt your key:

Ethereum-私鑰格式

$ stcd keys unsafe-import-eth-key dev0-imported ./dev0.export
Enter passphrase to encrypt your key:

驗證

Verify that your key has been restored using the following command:

$ stcd keys list
[
  {
    "name": "dev0-imported",
    "type": "local",
    "address": "dst1n253dl2tgyhxjm592p580c38r4dn8023ctv28d",
    "pubkey": '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"ArJhve4v5HkLm+F7ViASU/rAGx7YrwU4+XKV2MNJt+Cq"}'
  },
  {
    "name": "dev0-restored",
    "type": "local",
    "address": "dst1n253dl2tgyhxjm592p580c38r4dn8023ctv28d",
    "pubkey": '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"ArJhve4v5HkLm+F7ViASU/rAGx7YrwU4+XKV2MNJt+Cq"}'
  },
  {
    "name": "dev0",
    "type": "local",
    "address": "dst1n253dl2tgyhxjm592p580c38r4dn8023ctv28d",
    "pubkey": '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"ArJhve4v5HkLm+F7ViASU/rAGx7YrwU4+XKV2MNJt+Cq"}'
  }
]