百度区块链 XuperChain开发教程(第二部分)

百度区块链 XuperChain开发教程(第二部分)

 

第一部分编译完成后,现在开始进入测试部分:

 


$ cd output/
$ ./xchain-cli createChain

 

 

msg="create block chain by contract" module=xchain from=xuper toCreate=xuper
msg="ledger meta" module=xchain genesis_block= tip_block= trunk_height=0
msg="utxo total is estimated" module=xchain total=0
msg="debug tx" module=xchain txid=b8b4dd25f2ad6e54e29dc8ed60407110850085693e0c8815a5591cb5da1021dc
msg=txoutput module=xchain offset=0 addr=dpzuVdosQrF2kmzumhVeFQZa1aYcdgFpN amount=100000000000000000000
msg="begin format genesis block" module=xchain
msg="Start to ConfirmBlock" module=xchain
msg="start to confirm block" module=xchain blockid=0f190368b903c6d6e94a52b949e45d46c1224d5dbfca69edf1246950d8f823ee txCount=1
msg="print block size when confirm block" module=xchain blockSize=1371 blockid=0f190368b903c6d6e94a52b949e45d46c1224d5dbfca69edf1246950d8f823ee
msg="confirm block cost" module=xchain blkTimer="saveHeader: 0.08 ms,saveAllTxs: 0.08 ms,saveToDisk: 0.06 ms,total: 0.34ms"
msg="ConfirmBlock Success" module=xchain Height=1
msg="hit queryblock cache" module=xchain blkid=0f190368b903c6d6e94a52b949e45d46c1224d5dbfca69edf1246950d8f823ee
msg="unconfirm table size" module=xchain unconfirmTxMap=0
msg="autogen tx list size, before play block" module=xchain len=0
msg="  start to dotx" module=xchain txid=b8b4dd25f2ad6e54e29dc8ed60407110850085693e0c8815a5591cb5da1021dc
msg="    insert utxo key" module=xchain utxoKey=UdpzuVdosQrF2kmzumhVeFQZa1aYcdgFpN_b8b4dd25f2ad6e54e29dc8ed60407110850085693e0c8815a5591cb5da1021dc_0 amount=100000000000000000000
msg="autogen tx list size, after play block" module=xchain len=0



 

 

$ ls -lth ./data/blockchain/xuper/
total 12K
drwxr-xr-x 2 john john 4.0K 8月   1 13:31 utxoVM
drwxr-xr-x 2 john john 4.0K 8月   1 13:31 ledger
-rw-r--r-- 1 john john 1011 8月   1 13:31 xuper.json

 

 

$ nohup ./xchain &

 

 

 

$ ./xchain-cli status
{
  "blockchains": [
    {
      "name": "xuper",
      "ledger": {
        "rootBlockid": "0f190368b903c6d6e94a52b949e45d46c1224d5dbfca69edf1246950d8f823ee",
        "tipBlockid": "d6d1a3bc5c3938a22ffdc7261fb41a5f6de608a8029030a6a611c0b4931146b0",
        "trunkHeight": 19,
        "maxBlockSize": 134217728
      },
      "utxo": {
        "latestBlockid": "d6d1a3bc5c3938a22ffdc7261fb41a5f6de608a8029030a6a611c0b4931146b0",
        "lockKeyList": null,
        "utxoTotal": "100000000000019000000",
        "avgDelay": 0,
        "unconfirmed": 0
      }
    }
  ],
  "peers": null,
  "speeds": {
    "BcSpeeds": {
      "xuper": {}
    }
  }
}

 

下一步开始创建账户

 

$ ./xchain-cli account --help
Operate an account or address: balance|new|newkeys|split.

Usage:
  xchain-cli account [command]

Available Commands:
  balance     Query the balance of an account or address.
  contracts   query account's contracts
  new         Create an account.
  newkeys     Create an address with public key and private key.
  query       query the account list containing a specific address.
  split       Split the utxo of an account or address.

Flags:
  -h, --help   help for account

Global Flags:
      --config string       config file (default is ./xchain.yaml)
      --cryptotype string   crypto type, eg. default (default "default")
  -H, --host string         server node ip:port (default "127.0.0.1:37101")
      --keys string         directory of keys (default "data/keys")
      --name string         block chain name (default "xuper")

Use "xchain-cli account [command] --help" for more information about a command.

 

$ ./xchain-cli account newkeys --output data/test_demo
create account using crypto type default
create account in data/test_demo

 

$ ls -lth data/test_demo/
total 12K
-rw-r--r-- 1 john john  33 8月   1 13:42 address
-rw-r--r-- 1 john john 266 8月   1 13:42 private.key
-rw-r--r-- 1 john john 184 8月   1 13:42 public.key

 

cat data/keys/address 
******************

 

在百度测试链上查看账户信息:

$ ./xchain-cli account balance ********** -H 14.215.179.74:37101

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JCJC错别字检测-田春峰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值