This is a test script for demonstrating how the system works in cheating
and non-cheating
scenarios.
There are 3 bidders participating with the values (bid,nonce)
below:
bidder1 = (11,"bid1")
bidder2 = (22,"bid2")
bidder3 = (33,"bid3")
Running scenarios are pretty straight-forward. All you need to have is to install (if you already don't have) Docker
=> download-link.
-
Open docker desktop application.
-
Clone this repository into your system.
git clone https://github.com/AKEB-asyemmtric-key-each-bidder/scenarios.git
-
Open the terminal (MacOS and Ubuntu) or powerShell (windows) and head into the directory of the project.
-
While you are in the directory of the project, run the command below.
docker compose build
-
The command above generates two images: one is image for off-chain code and another one is an image for smart-contract and front-end script.
-
Run the command below to execute the scenarios.
docker compose up
After running this command, you will see in the terminal that two scenarios (
cheating
andnon-cheating
) and the corresponding test cases are being executed.You can also observe the logs of the activities such as address of bidders, seller, auctioneer, smart contract address in the system.
The system consists of two main parts.
-
Off-chain code
-
Smart-contract
-
front-end script: The front-end script acts as a automated user-interface to let the users interact with smart-contract and off-chain code. Since there were 3 bidders in the system, I decided to write an automated front-end script to automatically execute all user actions. the front-end script is inside the
SM
folder.- Cheating script:
SM/test/AKEB-cheating.test.js
- Non-cheating script:
SM/test/AKEB-noncheating.test.js
- Cheating script:
In our scenarios, the cheating happens in off-chain-code
and the main objective of the system is the front-end to be capable of detecting such malicious activity.
The front-end script performs the comparison and it detects if there has been any miscalculation by Off-chain-code
.