Running Iteration 02&03 - the-future-of-benchmarking/proof-of-concept GitHub Wiki
Using/Hosting the app (developer mode)
Although this setup is not "one-click" there is no easier possibility to both create a local blockchain and import it into a Web3 extension like MetaMask
Please refer to Troubleshooting in case errors occur.
Dependencies:
Blockchain/Ethereum:
- Ganache (Emulates an Ethereum Blockchain and provides 10 Accounts for usage) https://www.trufflesuite.com/ganache
- Metamask Browser extension (provides underlying primitives for connecting to Ethereum/Ganache either via Infura or locally) https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=de
Webclient:
- either Chrome or any Chromium related browser (i.e. Chromium Edge) [it might work on Firefox as well, although not tested] https://www.google.de/chrome or https://www.microsoft.com/de-de/edge
- Node.js >= v14 (the current LTS version) https://nodejs.org/en/
- (optional) Yarn https://yarnpkg.com/getting-started/install (node.js ships with
npm
as its default package manager - which should be fine. One may useyarn
for better performance. All commands are specified asnpm
andyarn
commands)
Development environment
The developer used Windows Subsystem for Linux v2 as the development environment, combined with Visual Studio Code https://code.visualstudio.com/.
The used distribution was Ubuntu 20.04
.
Procedures:
Compiling the contract (in case something has changed)
Run npm install
or yarn install
and then npx truffle compile
in the contract
directory.
In case you are running windows copy the contracts like this: cp -r build/contracts ../client/src
For running on bash compatible OS'es (i.E. Mac or Linux-derivatives) use the ./compile-contracts.sh
script in the contracts
folder
Setting up Ganache/Metamask
Please refer to the page at https://github.com/the-future-of-benchmarking/proof-of-concept/wiki/Set-up-Ganache-&-Metamask
Start Web Frontend
Run npm run start
or yarn start
=> The webapp now runs under http://localhost:3000/
Start local "participation simulation" script
Iteration 02
The script that has to be used is located in /contract/index_class.ts
To run it, on ganache, leave the truffle-config.json at its defaults.
Otherwise please adjust the settings in this block:
networks: {
development: {
host: "127.0.0.1", <== Insert the address of your node here
port: 7545, <== Insert the RPC!! Port of your node here
network_id: 5777, <== Insert network id here
gas: 4698712, <== Use the default values of the network or remove the attribute
gasPrice: 25000000000, <== Use the default values of the network or remove the attribute
networkCheckTimeout: 5000,
}
}
Create a contract via the web interface and copy its address.
Insert the address at line 19 await instance.startFromAddress("[HERE]")
Run the script via npx ts-node index_class.ts
.
If all goes well, one error message ala revert: Already participated
ath the end should be visible. This is expected.
Change to the webconsole and check if the notifications are coming in on the side. These are events triggered, when the transactions of the script are processed on the blockchain.
Iteration 03
The script that has to be used is located in /contract/index.ts
To run it, on ganache, leave the truffle-config.json at its defaults.
Otherwise please adjust the settings in this block:
networks: {
development: {
host: "127.0.0.1", <== Insert the address of your node here
port: 7545, <== Insert the RPC!! Port of your node here
network_id: 5777, <== Insert network id here
gas: 4698712, <== Use the default values of the network or remove the attribute
gasPrice: 25000000000, <== Use the default values of the network or remove the attribute
networkCheckTimeout: 5000,
}
}
Create a contract via the web interface and copy its address.
Insert the address at line 27 and line 42 const instance = new BenchmarkClient(web3, "[HERE]", account)
Run the script via npx ts-node index.ts
.
Change to the webapp and check if the notifications are coming in on the side. These are events triggered, when the transactions of the script are processed on the blockchain.
Hosted versions
Refer to https://github.com/the-future-of-benchmarking/proof-of-concept/wiki/Hosted-Iterations
The described local approach is the tested one. Using hosted versions is beyond the tested procedures for this app.
Use at your own risk.