etclabscore / multi-geth-fork

GNU Lesser General Public License v3.0
3 stars 8 forks source link

[WIP] develop <- cmd/echainspec: CLI tool for working with cross client chain configs #74

Closed meowsbits closed 4 years ago

meowsbits commented 4 years ago

Based on change set from #70

> ./build/bin/echainspec ls-formats
parity
multigeth
geth
> ./build/bin/echainspec ls-defaults
social
ethersocial
mix
classic
mordor
rinkeby
goerli
kotti
foundation
ropsten
> ./build/bin/echainspec --default classic --outputf multigeth | head
{
    "config": {
        "networkId": 1,
        "chainId": 61,
        "eip2FBlock": 1150000,
        "eip7FBlock": 1150000,
        "eip150Block": 2500000,
        "eip155Block": 3000000,
        "eip160Block": 3000000,
        "eip161FBlock": 8772000,
> ./build/bin/echainspec --default kotti --outputf parity | head
{
    "name": "",
    "dataDir": "",
    "engine": {
        "Ethash": {
            "params": {
                "minimumDifficulty": null,
                "difficultyBoundDivisor": null,
                "durationLimit": null,
                "blockReward": {},
> ./build/bin/echainspec --default foundation --outputf geth > spec.json; cat spec.json | ./build/bin/echainspec --inputf geth --outputf parity | head
{
    "name": "",
    "dataDir": "",
    "engine": {
        "Ethash": {
            "params": {
                "minimumDifficulty": "0x20000",
                "difficultyBoundDivisor": "0x800",
                "durationLimit": "0xd",
                "blockReward": {
> ./build/bin/echainspec --default classic forks
1150000
2500000
3000000
5000000
5900000
8772000
> ./build/bin/echainspec --default classic ips | head -20
EIP1014 -
EIP1052 -
EIP1108 -
EIP1283Disable -
EIP1283Reenable -
EIP1283 -
EIP1344 -
EIP140 8772000
EIP145 -
EIP150 2500000
EIP152 -
EIP155 3000000
EIP160 3000000
EIP161abc 8772000
EIP161d 8772000
EIP170 8772000
EIP1884 -
EIP198 8772000
EIP2028 -
EIP211 8772000
> ./build/bin/echainspec --default classic validate 10000000
Valid

> echo $?
0
$ ./build/bin/echainspec help
echainspec [global options] command [command options] [arguments...]

USAGE:

- Reading and writing chain configurations:

  The default behavior is to act as a configuration reader and writer (and implicit converter).
  To establish a target configuration to read, you can either
    1. Pass in a chain configuration externally, or
    2. Use one of the builtin defaults.

  (1.) When reading an external configuration, specify --inputf to define how the provided
  configuration should be interpreted.

  The tool expects to read from standard input (fd 0). Use --file to specify a filepath instead.

  With an optional --outputf flag, the tool will write the established configuration in the desired format.
  If no --outputf is given, the configuration will be printed in its original format.

  Run the following to list available client formats (both for reading and writing):

    echainspec ls-formats

  (2.) Use --default [<chain>] to set the chain configuration value to one of the built in defaults.
  Run the following to list available default configuration values.

    echainspec ls-defaults

- Inspecting chain configurations:

  Additional commands are provided (see COMMANNDS section) to help grok chain configurations.

EXAMPLES:

  Convert an external chain configuration between client formats (from STDIN)
.
    > cat my-parity-spec.json | echainspec --inputf parity --outputf [geth|multigeth]

  Convert an external chain configuration between client formats (from file).

    > echainspec --inputf parity --file my-parity-spec.json --outputf [geth|multigeth]

  Print a default Ethereum Classic network chain configuration in multigeth format:

    > echainspec --default classic --outputf multigeth

  Validate a default Kotti network chain configuration for block #3000000:

    > echainspec --default kotti validate 3000000

VERSION:
   1.9.5-unstable

COMMANDS:
   ls-defaults  List default configurations
   ls-formats   List client configuration formats
   validate     Tests whether a configuration is valid
   forks        List unique and non-zero fork numbers
   ips          List IP transition names and values
   help         Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --inputf value   Input format type [multigeth|geth|parity]
   --file value     Path to JSON chain configuration file
   --default value  Use default chainspec values [social|classic|kotti|mordor|foundation|rinkeby|ropsten|goerli|ethersocial|mix]
   --outputf value  Output client format type for converted configuration file [multigeth|geth|parity]
   --help, -h       show help
   --version, -v    print the version