bottos 安装和使用

studyBlockChain · · 1194 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

环境搭建

  1. 下载大于1.11版本的golang
  2. 配置GOPATH
  3. 将代码拷贝到$GOPATH/src/github.com目录下
  4. 进入到代码目录运行:
$go build
  1. 在代码根目录会生产一个bottos的可执行文件
  2. 进入到bcli目录
$cd bcli
  1. 编译bcli
$go build
  1. 这样会在bcli目录下生产一个bcli的可执行文件

节点启动

  1. 通过对代码的编译,会得到bottosbcli这2个可执行文件,bottos是用于启动节点的,bcli通过restful API和节点进行通信的命令行工具,它的功能包括,查看区块数据,创建帐户,发交易等

  2. 配置文件:config.tomlgenesis.toml
    config.toml:

# Configuration for Bottos Node

[Node]    # 链数据的存储目录
DataDir = "./datadir"

[Rest]   # Restful API Server的监听端口
RESTPort = 8689
RESTHost = "localhost"

[P2P]
P2PPort = 9868
P2PServAddr = "192.168.0.20"
PeerList = []

[Delegate]
Prate = 0
Solo = true

[Delegate.SignKey]  # 节点用来签名和验证的公钥和私钥
PrivateKey = "b799ef616830cd7b8599ae7958fbee56d4c8168ffd5421a16025a398b8a4be45"
PublicKey = "0454f1c2223d553aa6ee53ea1ccea8b7bf78b8ca99f3ff622a3bb3e62dedc712089033d6091d77296547bc071022ca2838c9e86dec29667cf740e5c9e654b6127f"

[Plugin]

[Plugin.MongoDB]
URL = "mongodb://bottos:bottos@127.0.0.1:27017/bottos"

[Plugin.Wallet]
WalletDir = ""
WalletRESTPort = 6869
WalletRESTHost = "localhost"

[Log]
Config = "./corelog.xml"

genesis.toml: 和chainID内容有关,不同的内容将产生不同的ChainID

# Initial configuration for the Genesis Node

GenesisTime = "2018-08-01T12:00:00"

# 合约帐户bottos验证签名所用的公钥
GenesisKey = "0454f1c2223d553aa6ee53ea1ccea8b7bf78b8ca99f3ff622a3bb3e62dedc712089033d6091d77296547bc071022ca2838c9e86dec29667cf740e5c9e654b6127f"
  1. 启动创世节点:
$ bottos --delegate bottos --enable-wallet
  1. bcli命令:
NAME:
   Bottos bcli tool - a tool that makes user communicate with bottos blockchain

USAGE:
   bcli [global options] command [command options] [arguments...]

VERSION:
   0.0.1

COMMANDS:
     getinfo      get chain information
     getblock     get block information
     gettable     get table information
     account      create or get account
     transfer     for user transfering bto
     transaction  get or push transactions
     contract     get or deploy contract
     p2p          for p2p connection
     delegate     for delegate operations
     wallet       For wallet operations
     genesis      for genesis node operations
     help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --servaddr value  (default: "127.0.0.1:8689")
   --help, -h        show help
   --version, -v     print the version

创建钱包

  1. 当创世节点起来之后,需要先用bottos帐户的私钥来创建一个叫做bottos的钱包:
$ ./bcli wallet create --account bottos

按照提示输入钱包命令和以及帐户的私钥b799ef616830cd7b8599ae7958fbee56d4c8168ffd5421a16025a398b8a4be45

  1. 查看帐户的余额:
$ ./bcli account get --username bottos

创建帐户

  1. 创建帐户之前,需要为帐户生成公钥匙和私钥:
$ ./bcli wallet generatekey

public_key: 040b73ef7a3095089499818a9fd6b4a03f1c0a0d2dddcc2d8b87b6d9ba729dd9364e508ef8381d2e69f3f05d981267f145e707e5a1eaa9ab90579ea523475cb2d4
private_key: b2b504852287be2e5e9359d99fa20c7103a96557634fdd5a067500e10bd3d1b9

  1. 解锁bottos帐户的钱包:
    bottos需要引荐人来创建帐户,这里的引荐人帐户就是bottos,首先解锁bottos帐户的钱包:
$ ./bcli wallet unlock --account bottos
  1. 创建lisa帐户:
./bcli account create --username lisa --pubkey 040b73ef7a3095089499818a9fd6b4a03f1c0a0d2dddcc2d8b87b6d9ba729dd9364e508ef8381d2e69f3f05d981267f145e707e5a1eaa9ab90579ea523475cb2d4

转账

新创建的帐户余额为0:

$ ./bcli account get --username lisa

Account: lisa
Balance: 0.00000000 BTO

查看区块信息

查看最新区块

$./bcli getblock

有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:studyBlockChain

查看原文:bottos 安装和使用

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1194 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传