Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PIE-1602] Implement operator tool. (blockchain network configuration for permisionned networks) #1511

Merged

Conversation

AbdelStark
Copy link
Contributor

PR description

Implement a tool to generate blockchain config files for a network operator.
Input config file must be a JSON file following the right format.
In addition to the config file, here are the possible CLI options:

  • --to: Directory to write output files to.
  • --genesis-file-name: Name of the genesis file.
  • --private-key-file-name: Name of the private key file.
  • --public-key-file-name: Name of the public key file.

Two modes are possible:

  • generation mode
  • import mode

Generated files are:

  • genesis file
  • a folder per node (named by the address of the node)
  • each folder node contains public and optionally private key (only in generation mode)

Fixed Issue(s)

fixes #PIE-1602

@AbdelStark AbdelStark added enhancement New feature or request api Related to public APIs permissioning testing Related to tesing continuous-integration Related to continuous integration labels May 30, 2019
@AbdelStark
Copy link
Contributor Author

AbdelStark commented May 30, 2019

Sample configuration file to generate an IBFT network with 4 nodes. (keys are generated by the tool)

{
  "genesis": {
    "config": {
      "chainId": 2017,
      "constantinoplefixblock": 0,
      "homesteadBlock": 0,
      "eip150Block": 0,
      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    },
    "nonce": "0x0",
    "timestamp": "0x5b3c3d18",
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x47b760",
    "difficulty": "0x1",
    "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "ibft2": {
      "blockperiodseconds": 2,
      "epochlength": 30000,
      "requesttimeoutseconds": 10
    },
    "alloc": {
      "24defc2d149861d3d245749b81fe0e6b28e04f31": {
        "balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
      },
      "2a813d7db3de19b07f92268b6d4125ed295cbe00": {
        "balance": "0x446c3b15f9926687d2c40534fdb542000000000000"
      }
    }
  },
  "blockchain": {
    "nodes": {
      "generate": true,
      "count": 4
    }
  }
}

@AbdelStark
Copy link
Contributor Author

Sample configuration file to generate an IBFT network 2 nodes (imported keys).

{
  "genesis": {
    "config": {
      "chainId": 2017,
      "constantinoplefixblock": 0,
      "homesteadBlock": 0,
      "eip150Block": 0,
      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    },
    "nonce": "0x0",
    "timestamp": "0x5b3c3d18",
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x47b760",
    "difficulty": "0x1",
    "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "ibft2": {
      "blockperiodseconds": 2,
      "epochlength": 30000,
      "requesttimeoutseconds": 10
    },
    "alloc": {
      "24defc2d149861d3d245749b81fe0e6b28e04f31": {
        "balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
      },
      "2a813d7db3de19b07f92268b6d4125ed295cbe00": {
        "balance": "0x446c3b15f9926687d2c40534fdb542000000000000"
      }
    }
  },
  "blockchain": {
    "nodes": {
      "keys": [
        "0xb295c4242fb40c6e8ac7b831c916846050f191adc560b8098ba6ad513079571ec1be6e5e1a715857a13a91963097962e048c36c5863014b59e8f67ed3f667680",
        "0x6295c4242fb40c6e8ac7b831c916846050f191adc560b8098ba6ad513079571ec1be6e5e1a715857a13a91963097962e048c36c5863014b59e8f67ed3f667680"
      ]
    }
  }
}

@rain-on
Copy link
Contributor

rain-on commented Jun 3, 2019

Is there any chance of making this work for Clique too?

@AbdelStark
Copy link
Contributor Author

Is there any chance of making this work for Clique too?

Yes why not, could you provide a quick description of the requirements ?

@AbdelStark AbdelStark merged commit 3679524 into PegaSysEng:master Jun 10, 2019
@AbdelStark AbdelStark deleted the feature/pie-1602-operator-tool branch June 12, 2019 07:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api Related to public APIs continuous-integration Related to continuous integration enhancement New feature or request permissioning testing Related to tesing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants