NKN Docs

NKN Docs

  • Docs
  • 文档
  • GitHub
  • NKN
  • Help

wallet

vault.Wallet

  • interface

    • GetAccount(pubKey *crypto.PubKey) : *Account, error // get account by public key
    • GetDefaultAccount() : *Account, error // get default account
    • Sign(txn *transaction.Transaction) : error // sign transaction

vault.WalletImpl

  • Variables
VariableDescription
accountaccount of this wallet
contractcode info of wallet
ivIV used to encrypt wallet by AES
masterKeyKey used to encrypt wallet by AES
pathpath to save wallet
WalletStorestorage information of wallet
  • Methods

    • ChangePassword(oldPassword []byte, newPassword []byte) : bool // change the password of wallet
    • CreateAccount(seed []byte) : error // create account
    • GetAccount(pubKey *crypto.PubKey) : *Account, error // see interface Wallet
    • GetContract() : *program.ProgramContext, error // get code information of wallet
    • GetDefaultAccount() : *Account, error // see interface Wallet
    • Sign(txn *transaction.Transaction) : error // see interface Wallet

vault.WalletStore

  • WalletStore
VariableDescription
Datastorage information
Pathpath to save wallet
  • Methods

    • SaveAccountData(programHash []byte, encryptedSeed []byte, contract []byte) : error // save account data
    • SaveBasicData(version int, iv, masterKey, passwordHash []byte) : error // save header data
    • read() : []byte, error
    • write(data []byte) : error

vault.WalletData

  • Variables
VariableDescription
AccountDataaccount data
HeaderDatabasic data

vault.AccountData

  • Variables
VariableDescription
Addressaddress of wallet
ContractDatacode information
ProgramHashcode hash
SeedEncryptedthe encryped seed of privatekey

vault.HeaderData

  • Variables
VariableDescription
IVIV used to encrypt wallet by AES
MasterKeyKey used to encrypt wallet by AES
PasswordHashhash of password
Versionthe version of wallet

vault.Account

  • Variables
VariableDescription
PrivateKeyprivate key
ProgramHashcode hash
PublicKeypublic key
  • Methods

    • PrivKey() : []byte // get private key from account
    • PubKey() : *crypto.PubKey // get public key from account
  • vault.Wallet
  • vault.WalletImpl
  • vault.WalletStore
  • vault.WalletData
  • vault.AccountData
  • vault.HeaderData
  • vault.Account
BowlerNKNTwitterGitHubForum
Copyright © 2025 NKN | All rights reserved