geth 新建賬戶


 

使用geth的account命令管理賬戶,例如創建新賬戶、更新賬戶密碼、查詢賬戶等:

geth account <command> [options...] [arguments...] 
 

命令 - command

  1.  
    list 列表顯示現有賬戶
  2.  
    new 創建一個新的賬戶
  3.  
    update 修改賬戶
  4.  
    import 導入私鑰創建新賬戶

可以使用--help獲取這些命令的幫助信息,例如:

  1.  
    ~$ geth account list --help
  2.  
    list [command options] [arguments...]
  3.  
     
  4.  
    Print a short summary of all accounts
  5.  
     
  6.  
    OPTIONS:
  7.  
    --datadir "/home/bas/.ethereum" Data directory for the databases and keystore
  8.  
    --keystore Directory for the keystore (default = inside the datadir)

 

創建新賬戶

使用geth account new命令新建賬戶:

  1.  
    $ geth account new
  2.  
    Your new account is locked with a password. Please give a password. Do not forget this password.
  3.  
    Passphrase:
  4.  
    Repeat Passphrase:
  5.  
    Address: { 168bc315a2ee09042d83d7c5811b533620531f67}

導入私鑰創建新賬戶

可以使用geth account import命令,通過導入私鑰來創建一個新賬戶,

  1.  
    ~$ geth account import --datadir /someOtherEthDataDir ./key.prv
  2.  
    The new account will be encrypted with a passphrase.
  3.  
    Please enter a passphrase now.
  4.  
    Passphrase:
  5.  
    Repeat Passphrase:
  6.  
    Address: { 7f444580bfef4b9bc7e14eb7fb2a029336b07c9d}

更新賬戶密碼

使用geth account update命令來更新指定賬戶的密碼:

  1.  
    ~$ geth account update a94f5374fce5edbc8e2a8697c15331677e6ebf0b
  2.  
    Unlocking account a94f5374fce5edbc8e2a8697c15331677e6ebf0b | Attempt 1/3
  3.  
    Passphrase:
  4.  
    0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
  5.  
    Account 'a94f5374fce5edbc8e2a8697c15331677e6ebf0b' unlocked.
  6.  
    Please give a new password. Do not forget this password.
  7.  
    Passphrase:
  8.  
    Repeat Passphrase:
  9.  
    0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b

顯示已有賬戶

使用geth account list命令列表顯示已有賬戶,可選的可以使用--keystore指定keystore目錄:

  1.  
    ~$ geth account list --keystore /tmp/mykeystore/
  2.  
    Account #0: {5afdd78bdacb56ab1dad28741ea2a0e47fe41331} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-27.437847599Z--5afdd78bdacb56ab1dad28741ea2a0e47fe41331
  3.  
    Account #1: {9acb9ff906641a434803efb474c96a837756287f} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-52.180688336Z--9acb9ff906641a434803efb474c96a837756287f

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM