以太坊学习(三)--geth安装

geth是以太坊的官方客户端,它是一个命令行工具,提供很多命令和选项,可以运行以太坊节点、创建和管理账户、发送交易、挖矿、部署智能合约等。

1. windows版本 安装

  • 官方下载路径:https://geth.ethereum.org/downloads/
  • 国内镜像:https://ethfans.org/wikis/Ethereum-Geth-Mirror

官方下载路径很慢或下载不了,所以建议第二种方式下载。
安装完成后,在你安装的目录打开geth.exe,会自动弹出cmd窗口并启动。

2. Linux版本 安装

在终端输入命令

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install ethereum

3. Linux版本 安装

更多详细信息请看:https://github.com/ethereum/go-ethereum/wiki
geth 的基本命令:

  1. geth --datadir gethdata --dev --rpc --rpccorsdomain * console
    –datadir 指定数据存储在gethdata文件夹
    –dev 开启开发者模式
    –rpccorsdomain 限定域名访问,*代表全部都可以访问。
    console 打开控制台

  2. geth account import ~/Desktop/pk.txt 导入密钥文件,生成账户

以下为控制台的命令

  1. eth.accounts 查看账户
  2. personal.newAccount(“string”) 创建一个账户
  3. eth.sendTransaction({from:‘0x6fb02de84fac0787e9681bff614c99b901248420’, to:‘0xffb57de84fac0787e9681bff564c92b901243420’, value: web3.toWei(1,“ether”) }); 转账
  4. personal.unlockAccount(eth.accounts[0]) 解锁账户

你可能感兴趣的:(区块链)