hyperledger / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger.github.io/caliper/
Apache License 2.0
649 stars 402 forks source link

Allow Ethereum Benchmarking With Multiple Address #954

Open steventranjs opened 4 years ago

steventranjs commented 4 years ago

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}"
        ...
    }
}

How To Assign Parallel Addresses To Workers

If numbers of workers LESS than the number of addresses

If numbers of workers MORE than the number of addresses

P/S: If this proposal is accepted, I would like to send a pull request as I alrd prepared code changes from my side

tiepcyber commented 4 years ago

+1

tonybka commented 4 years ago

+1

steventranjs commented 4 years ago

@nklincoln thanks for approve my proposal as an enhancement. May I know when can I have permission to make Pull Request on this? Thanks

hoang-ng commented 4 years ago

+1

nklincoln commented 3 years ago

@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

toutou8148 commented 3 years ago

Does this work? May I apply your proposal as I am using caliper 0.4.2?

toutou8148 commented 3 years ago

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;"