bottos 安装和使用

栏目: 后端 · 前端 · 发布时间: 5年前

内容简介:按照提示输入钱包命令和以及帐户的私钥新创建的帐户余额为0:

环境搭建

  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

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python科学计算(第2版)

Python科学计算(第2版)

张若愚 / 清华大学出版社 / 2016-4-29 / 118

本书介绍如何用 Python 开发科学计算的应用程序,除了介绍数值计算之外,还着重介绍了如何制作交互式二维、三维图像,如何设计精巧的程序界面,如何与 C 语言编写的高速计算程序结合,如何编写声音、图像处理算法等内容。本书采用 IPython notebook 编写,所有的程序均能在本书提供的运行环境中正常运行,书中所印刷的图表以及程序输出为均为自动运行的结果,保证了书中所有程序的正确性以及可读性。......一起来看看 《Python科学计算(第2版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具