How to Eliminate Plagiarism in Short-Term Hackathons Using Redis

Hackathons are a phenomenal way to galvanize programmers to build innovative applications. They drive ingenuity. They increase motivation. But just as importantly, they’re fun. However, short-term hackathons in particular are often faced with two main challenges:

  1. Applicants reusing existing projects: this is when applicants take the spine of other projects and modify them over a period of time to then submit them in the 24 hours hackathon. This gives applicants an unfair advantage over other hackers. 
  2. Plagiarism: this involves hackers copying code from other projects to be used in their submission. 

Having these two detriments in any Hackathon creates an unfair platform where honest applicants are faced with an unfair disadvantage. To promote a more equal competitive landscape, programmer Yash Kumar Verma has created his very own application, Hentry. 

Thanks to Redis, every component in this application was able to function with maximal efficiency due to Redis’ ability to transmit data at hyper-speed. Let’s take a look at how this application was able to come to life. 

But before we go any further, we’d like to highlight that we also have a diverse range of innovative applications for you to check out on the Redis Launchpad

So don’t forget to have a browse after this post!

How to Build an Application That Eliminates Plagiarism in Short-Term Hackathons

  1. What will you build?
  2. What will you need?
  3. Architecture
  4. Getting started
  5. Setting up the Hentry client 
  6. Setting up the Hentry server 
  7. Setting up the Hentry feeder
  8. Setting up the Hentry dashboard 

1. What will you build?

You’ll build an application that will weed out any signs of plagiarism in short-term hackathon events. The app will empower all applicants by promoting a more equal landscape for everyone to compete in. 

2. What will you need?

  • Golang: The preferred programming language used to build efficient software
  • RedisJSON: Stores, updates, and fetches JSON values from Redis keys
  • RedisTimeSeries: Provides time-series data
  • NodeJS: Used as an open-source, cross-platform, back-end JavaScript runtime environment that executes Javascript outside the web browser. 
  • TypeScript: used as a powerful programming language that’s built on Javascript.

3. Architecture

  • The Hentry client runs in each of the client machines. These can be hundreds or even thousands in number, depending on the size of the hackathon. 
  • The main aim of the Hentry client is to interact with the Hentry-server which is NodeJS. 
  • The NodeJS interacts with the Redis module which is RedisJSON and RedisTimeSeries, both of which work on team details and device details. 
  • Hentry clients interact with the Hentry server in order to operate on things that relate to team management and device management. 
  • The second service that the Hentry client talks to is the Hentry Feeder. The Hentry client shares the entropy and snapshots with the Hentry feeders. 
  • The final component is the Hentry dashboard. The Hentry dashboard fetches data from the NodeJS which in turn receives data from RedisTimeSeries and RedisJSON modules. 
  • Once the dashboard receives this data it will then be utilized. 

4. Getting started 

Step 1. Clone the repository 

git clone https://github.com/redis-developer/hentry-server

cd hentry-server

Step 2. Install the dependencies

yarn

Step 3.  Run the development build

Once the dependencies are installed, to run a development version with live changes, use the following code:

yarn start:dev

If you want to build the package and then run it, use the code below:

yarn build

yarn start:prod

Step 4. Running Redis inside a Docker container 

Since the server interacts with Redis and operates on RedisJSON and RedisTimeSeries, make sure a docker container is running with the Redismod image. To run the container, use the following code:

yarn redis:mod

A uniform logging-in is done as the requests are being received. Tools like pm2 can be used to accumulate logs and launch the application in clusters. For demonstration purposes, it’s running on the docker container on the deployment machine.

5. Setting up the Hentry Client

The Binary

  • Golang allows us to support more architectures and diagrams as long as Golang supports it.
  • Golang generates a unique signature for each device, which cannot be altered by changing configurations or be spoofed. This means that a single machine cannot act as multiple devices. 
  • The client’s machine also doesn’t require admin privileges for the client to run.
  • Device signatures are hardware-independent, as they can easily be spoofed by VMs. MAC and BIOS settings are also ignored because they can be easily manipulated.
  • Automatically identifies the platform to display in the admin panel.
  • A list of pre-compiled binaries is available on hentry-client.surge.sh. However, it is recommended to compile for yourself since we’re in the early testing phase.

The Interface

  • Hentry client comes with an interactive command line interface. It includes an option to navigate using arrow keys and validation checks .If the validation is about to fail, the terminal will show red with an error message. 
  • Hentry client support Secure TeamID Input feature. Since team IDs are used to join a team, the interface masks the input with * to add a layer of security in the user interface.

Configuration

  • To make it effortless for users to use the application, server credentials can be embedded into the binary itself by the organizers (single-point configuration declarations). This allows the participants to run the same application configuration.A configuration file can be used to declare the endpoints in case there are changes in server deployments, or if the organizers come up with alternative servers to relay the updates. 
  • The configuration file should be named ‘hentry.yaml’ and be placed in the same directory where the binary sits.
app:
    server: "https://some-fancy-server/api"
    feeder: "https://some-fancy-server/feed"
    debug: true
 
  ignore:
    - "public"
    - "cache"
    - "build"
    - "some-custom"

  • Restarting the client will first check if a configuration file is present. If it’s not, then a message will be displayed to notify the user so that they can load the default configuration.
  • Since there can be multiple directories that contain an auto-generated codebase, a provision list has been created for all of them in the config file in the ignore section. Hentry would then ignore those directories while calculating snapshots and entropy.

Functionality

  • Allows users to create a team of people working together in an event or a competition. 
  • Allows users to join an existing team.
  • Allows users to register their device.
  • Unique device signatures can identify old devices and avoid duplicate logins. 

Fancy technology

  • Go-routines are used to utilize the advantages of concurrency and speed.
  • The client walks the directory tree and creates a hashmap of the project in the memory.
  • Calculates the snapshot score and entropy of all the files in each iteration.
  • Snapshot score depends upon the file contents, length, and size.
  • Entropy is a name given to diff-match score, which is basically the number of insertions and deletions required to move from one state to another.
  • The entropy is calculated using the golang port of Neil Fraser’s google-diff-match-patch code.
  • Written in Golang, can be compiled to native binary for any operating system and architecture.

Debug mode

  • The ‘Hentry,yaml’ contains an option to enable the debug mode.
  • This mode is added to help developers debug the deployments. Once it’s turned on, the binary will log all API requests it’s sending and receiving. 

Walkthrough

When you’re in the entry client, you’ll see a screen like this:

First things first, you may check if customer configurations are being loaded or not. You’ll be able to check this on the second line where it says ‘Configuration file named “Hentry.yaml” not found, using defaults.’

Next is a list of directories that are ignored by default. If you’re adding more directories, you can do so beneath where it says ‘Ignoring directories.’

And at the bottom, you’ll have the option to either create or join a team. 

You’ll next come across this screen. 

Here is where you’ll see validations. It’s worth noting that these validations don’t only run when the user submits the response – they run all the time. This means that if the Team ID is less than four characters long then the cross sign will appear. 

Similarly, the Team ID is also hidden on this screen. This is because the Team ID is used to join other teams and so it’s necessary to protect the user’s log-in credentials. 

Here you can define the team name. Similar checks are also made here. 

hentry-client automatically checks if the device is already registered or not. Since in this example the device was not registered, it’s asking the user to register a device name.

After you’ve set the device name, the device will be registered. 

Once you’ve registered the device, it will start to transmit data to the hentry-server. 

How to join a team when a user is already registered

Similar to before, when you join a team with a team ID, the input will be masked.

Thanks to unique device signatures, the hentry client identifies that the device is already registered and automatically adds it to the specified team and starts the transmission. 

Hentry-client shows a list of directories that it will ignore during the startup. If the server configurations change, then make sure to use the hentry.yaml file. In the example, the user utilized the following hentry-config file:

Now when you run the hentry-client, you’ll see that the new configurations are loaded as well as more directories being ignored. 

Since the debug flag was set to true, the client can now log all of the apo calls they make. 

6. Setting up the Hentry server

  • Hentry server is written in typescript with modern tooling to quickly prototype and debug the application. 
  • The Hentry-server connects to the reddismod instance and ensures that connections are made with RedisJSON and RedisTimeSeries.
  • Provides routes for team formation, team joining, device registration, and fetching all RedisTimeSeries data and polling updates in RedisTimeSeries data. 
  • To run locally, run yarn install then yarn start:dev or use the docker image.
  • Follows a uniform logging scheme to make it easier to debug. 
  • Supports keywords like now to fetch all of the data until the present timestamp. 
  • Everything is divided into modules and services to keep related codebases together and make them easier to maintain. 
  • Configurations can be accessed in the config directory.

7. Setting up the Hentry feeder

The overall objective is to push high ingress entropy and snapshot scores into the Redis databases that are running RedisTimeSeries. This is because:

  • Event size: Events can be massive.  Like hackathons, there can be thousands of participants transmitting events using redis-client.
  • Redis can easily ingress data: Because of this, managed services like Redis Enterprise can make sure that the database is always prepared for what may come. 
  • The microservice can be deployed in clusters: This is dependent on the number of participants. The load is divided into the cluster with each one feeding the Redis deployment. This will ensure that our server is not the bottleneck for the infrastructure. 

This is also available as a docker container: yashkumarverma/hentry-feeder

8. Setting up the Hentry dashboard

The Hentry dashboard is deployed on hentry.surge.sh and it’s the main dashboard that’s used by event organizers. It’s written using ReactJS and TailwindCSS, and uses react-vis, which is based on D3. The dashboard is also written in Gatsby to optimize the performance via service-size rendering, as well as enabling other awesome features that gatsby provides

Dashboard features

  • Shows team details
  • Shows team member details along with their operating systems
  • Responsive and runs smoothly on mobile
  • Allows you to view TimeSeries data in the form of a graph for snapshot and entropy values
  • Provides a live feed from participants’ devices
  • Enables you to compare other timestamps from that value
  • Uses colors to highlight additions, deletions, and no changes

Below is the screenshot that shows the name of each device in team as well as their platforms. 

Conclusion: Creating an equal competitive landscape with Redis

The competitive nature of hackathons is a phenomenal way to inspire programmers to tap into their creativity and produce innovative applications and software. But the existence of plagiarism taints the experience by providing some applicants with an unfair competitive advantage. 

By using Redis, Verma was able to create Hentry and provide future hackathons with a tool that can eliminate plagiarism, creating a more equal landscape for applicants to compete in. 

RedisTimeSeries’ ability to ingest samples and events with hyper-efficiency allows users to identify what changes have been made in each project, thereby helping them to identify any signs of plagiarism.

If you want to discover more about the ins and outs of this project, then you can watch Yash’s YouTube video here. 

Check out the Redis Launchpad where you’ll have access to an exciting range of innovative applications that are having an impact on everyday life. 

Give it a browse. Get inspired. Discover what you can build with Redis. 

Who built this application?

Yash Kumar Verma

Yash is a passionate backend developer who loves solving real-world problems through programming. Make sure to visit his GitHub page to keep up to date with all of the projects he’s involved in. 

​​