Allow Ethereum Benchmarking With Multiple Address
Context
Currently, the Ethereum benchmark configuration only allow to send transactions from 1 single address (fromAddress) and all workers using this same address to send transactions
Proposed Enhancement
Allow to add multiple addreses for Ethereum benchmark that run in multiple workers. A sample configuration is as below
{
"caliper": {
"blockchain": "ethereum"
},
"ethereum": {
...
"fromAddress": "{fromAddress1},{fromAddress2},{fromAddress3}",
"fromAddressPrivateKey": "{fromAddressPrivateKey1},{fromAddressPrivateKey2},{fromAddressPrivateKey3}"
"fromAddressPassword": "{fromAddressPassword1},{fromAddressPassword2},{fromAddressPassword3}"
...
}
}
-
fromAddressis allowed to have comma separator beside single address string format -
fromAddressPrivateKeyandfromAddressPasswordalso changed accordingly, validation will ensure numbers of addressed and its private keys / passwords are same - This is not broken changes, existing configuration with single address should be working fine
How To Assign Parallel Addresses To Workers
If numbers of workers LESS than the number of addresses
- Each worker is assigned to address that has same index sequence. The un-assigned addresses will be ignored
- For example: If nums of workers = 2 and nums of addresses = 3 then we assign worker 1,2 to address 1,2 accordingly and ignore address 3
If numbers of workers MORE than the number of addresses
- Each worker is assigned to address that has same index sequence. The un-assigned workers with take a random address from the list
- For example: If nums of workers = 3 and nums of addresses = 2 then we assign worker 1,2 to address 1,2 accordingly and worker 3 will take a random one (either address 1 or address 2)
P/S: If this proposal is accepted, I would like to send a pull request as I alrd prepared code changes from my side
+1
+1
@nklincoln thanks for approve my proposal as an enhancement. May I know when can I have permission to make Pull Request on this? Thanks
+1
@steventranjs I'm so sorry for only just noticing your message - we are always willing to accept PRs.
Please feel free to contact us directly in rocket chat on the following channel: https://chat.hyperledger.org/channel/caliper-contributors
Does this work? May I apply your proposal as I am using caliper 0.4.2?
I have already applied the idea with an easy way. All you need is to edit the network configuration file by setting fromAddress key with a table of addresses. Then, in EthereumConnector, in getContext() method, access to address using "this.ethereumConfig.fromAddress[this.workerIndex]" instead of "this.ethereumConfig.fromAddress;"