Consensys / quorum-genesis-tool

The quorum genesis tool creates genesis configs, configuration files, and keys for Hyperledger Besu, GoQuorum and Tessera.
Apache License 2.0
22 stars 20 forks source link

Support Alloc from cli & on questions format #48

Closed ILoomans closed 1 year ago

ILoomans commented 1 year ago

Overview

The purpose of this pull request is to allow the user to dynamically set the balance of any given account. The motivation for doing this is that using repositories like Quorum-Kubernetes people are assigning the balances they want to give to certain addresses in the yml files, but is unable to translate into the generated config file to to lack of support for the alloc [tag.]

Alloc Issue Quorum-Kubernetes

Further investigation shows that this is because they are using quorum-genesis-tool to create their config file:

Here Here Here Here

Following this (hopefully successfull pr) I would love to make a pull-request on quorum-kubernetes repo to enable this functionality

Example usage

CLI

cd build

node index --consensus QBFT --alloc '{"0xefE756027E36D021B0063CEDf576402C96C8095e": { "balance": "50000000000000000000000000000000000000000000" },"0xC8560eeF2391cE0Ae6A698E586DE9e15c86F2680": { "balance": "50000000000000000000000000000000000000000000" }}'

Cli (Questions format)

Include JSON format of the prefunded account {'address': { balance: '100000'}}: (default {})"

{"0xefE756027E36D021B0063CEDf576402C96C8095e": { "balance": "50000000000000000000000000000000000000000000" },"0xC8560eeF2391cE0Ae6A698E586DE9e15c86F2680": { "balance": "50000000000000000000000000000000000000000000" }}

Changes Included

Let me know what you think!

ILoomans commented 1 year ago

Hi @joshuafernandes and @Ezzahhh,

Let me know if you are interested in supporting this! I think it would be a useful addition!

Ezzahhh commented 1 year ago

Hi @ILoomans,

Thank you for your contribution and sorry we got to this so late. I have added a small change regarding types but otherwise looks good to me. We can look to merge this in and release if you there's nothing else to add.

ILoomans commented 1 year ago

@Ezzahhh Thanks for the review, nothing left to add from my side, Thanks for maintaining this tool it's really great!