1.0.1-beta.2 • Published 4 years ago

perses-cli v1.0.1-beta.2

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

title: 'Centrality Blockchain - Perses CLI'

Perses CLI

A cli tool helps controlling Perses without writing js files!

Installation

  1. run script sh ./install.sh
  2. check installation successful by execute perses -v
> perses -v
v1.0.0

Uninstallation

Run sh ./uninstall.sh

Getting started

Perses capabilities:

Below is highlighting 5 most common usecases that perses cli could help

Run help for more instructions per command.

  • Init blockchain formation:

There are some default parameters: names, forwarding ports which results created 5 nodes above as validators.

> perses blockchain init --image cennznet/cennznet:1.1.0-rc1 --chain dev
631565dee2756d66d8c054e03a49f7a9ee4b203a39b05792ee4d288d75818e71 : Eve
3762d9e14e5e7688a55d4456de911b83114b7638aca7433d29190292e618a20e : Charlie
08442b163f00856fe853df4d8c5c936d240192057773bebcf677d43d92c04b29 : Dave
aa10654b063823fdc0ea5a3e141e24c1297fa5f677beab3601deabc598674b9f : Bob
ba495020d3e48d6d85a17b8456e711ee9764d1a7de910d7637b6ec85798bbb28 : Alice
  • Network partitioning

The following command will create a subnet for 2 nodes and isolate the 1st one to the entire 4 remaining node, 2nd node will join 2 both clusters and may acts as a bridge to connect the whole chaining nodes

> perses network createSubnet --SubnetContainers "ba495020d3e48d6d85a17b8456e711ee9764d1a7de910d7637b6ec85798bbb28, 11.20.10.1,true" "aa10654b063823fdc0ea5a3e141e24c1297fa5f677beab3601deabc598674b9f, 11.20.10.2, false"

> docker inspect Alice | jq '.[].NetworkSettings.Networks'
{
  "Blockchain": {
    "IPAMConfig": {
      "IPv4Address": "11.20.10.1"
    },
    "Links": null,
    "Aliases": [
      "ba495020d3e4"
    ],
    "NetworkID": "116ba07a97d8aad8fe4478b9517c3ccee7f5b7b7089a3069a6ef8e2bb1c26cc9",
    "EndpointID": "20c78c7bc441788ab95cb8d35ba487709ec27df11733a2c0e448c0ac68ad8544",
    "Gateway": "11.20.10.200",
    "IPAddress": "11.20.10.1",
    "IPPrefixLen": 16,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "02:42:0b:14:0a:01",
    "DriverOpts": null
  }
}

> docker inspect Eve | jq '.[].NetworkSettings.Networks'
{
  "bridge": {
    "IPAMConfig": null,
    "Links": null,
    "Aliases": null,
    "NetworkID": "d9e1ab514e341dda2f4aaab595d85083bbd7f94804b979b57f18f5f24d5f7275",
    "EndpointID": "42b183600e858e0d38a69b0c11f2a7a4f7f6b0388237dcb9eee39bddd9ea8a76",
    "Gateway": "172.17.0.1",
    "IPAddress": "172.17.0.5",
    "IPPrefixLen": 16,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "02:42:ac:11:00:05",
    "DriverOpts": null
  }
}
  • Staking setup for authority node

If the chain's config already bond controller with stash accounts, we can use staking module insertKey command to insert sessions keys to the node's storage

perses staking insertKey --node e0b5c19de9045ffa24f967e8342ec6668c36ea9da844d39e74d79fd0e8b2ed33 -s //Alice
  • Network emulation

Perses can even tolerate network packets conditions like delay, loss ... Following command would cause node Alice unable to communicate with any other nodes because packet loss rate is 100%

perses network loss -p 100 -t Alice
  • Teardown

Remove all running containers with image tag cennznet | plug and prune unused docker networks.

What else comming up?

  • Support P^werChain node
  • More robust commands for different usecases
  • Utilities commands

Remember Perses CLI is just cli for actual Perses testing framework, with Perses you can script the tests

STAY TUNED!