Lv.的博客

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

 

posted @   Avatarx  阅读(3051)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
历史上的今天:
2014-07-18 深入理解Linux操作系统守护进程的意义
2014-07-18 Linux 的启动流程
2014-07-18 Linux开机启动程序详解
2014-07-18 不同linux系统添加开机启动程序的命令
2014-07-18 如何在Linux桌面环境下自动启动程序?
点击右上角即可分享
微信分享提示