Skip to content

This is a cheating and non-cheating scenarios demonstrating how front-end script, smart-contract, and off-chain code interacts

Notifications You must be signed in to change notification settings

AKEB-asyemmtric-key-each-bidder/scenarios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AKEB Scenarios

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

How to run the scenarios?

Running scenarios are pretty straight-forward. All you need to have is to install (if you already don't have) Docker => download-link.

  1. Open docker desktop application.

  2. Clone this repository into your system.

    git clone https://github.com/AKEB-asyemmtric-key-each-bidder/scenarios.git
    
  3. Open the terminal (MacOS and Ubuntu) or powerShell (windows) and head into the directory of the project.

  4. While you are in the directory of the project, run the command below.

    docker compose build
    
  5. 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.

    Screenshot 2023-06-09 at 6 50 36 AM
  6. 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 and non-cheating) and the corresponding test cases are being executed.

    Screenshot 2023-06-09 at 6 57 31 AM

    You can also observe the logs of the activities such as address of bidders, seller, auctioneer, smart contract address in the system.

    Screenshot 2023-06-09 at 7 01 15 AM

System Structure

The system consists of two main parts.

  1. Off-chain code

  2. Smart-contract

  3. 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

    Screenshot 2023-06-09 at 7 11 33 AM

Where does cheating happen?

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.

Screenshot 2023-06-15 at 12 09 19 PM

Where in front-end script is this cheating detected?

The front-end script performs the comparison and it detects if there has been any miscalculation by Off-chain-code.

Screenshot 2023-06-09 at 7 30 53 AM

About

This is a cheating and non-cheating scenarios demonstrating how front-end script, smart-contract, and off-chain code interacts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published