Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.43 KB

README.md

File metadata and controls

46 lines (30 loc) · 1.43 KB

RewardByBlock contract test in OpenEthereum 3.1

Usage

  1. Install OpenEthereum 3.1 and Node.js 8.x LTS (with npm) if they are not installed.

  2. Perform the next commands:

$ git clone https://github.com/varasev/test-block-reward
$ cd test-block-reward
$ npm i
$ npm start
  1. Watch a log in the console. It should be seen that payoutKey balances are being increased alternately by 1 eth and the vault's balance is being increased by 1 eth every 5 seconds. We also can see that the gas fee is being accrued alternately to mining keys when a sender transfers some amount to a receiver. An example log is available here: https://github.com/varasev/test-block-reward/blob/master/example.log

  2. To make charging of one coin to an extra receiver's account, perform the next command:

$ npm run accrue 1

You'll see in the log that the balance of an extra receiver increased by one coin on the next block.

  1. To restart this setup from scratch, perform the next command:
$ npm restart
  1. To completely stop and clear, perform the next command:
$ npm run clear

Compilation/ recompilation

Do the next command for contracts compilation, for saving their bytecodes to config/spec.json and for saving their ABIs to contracts/abis:

$ npm run build

Note that you have to perform npm restart after npm run build if you started it before.