Inspiration

We planned to bridge solutions to two specific problems. More often than not, people end up wasting time on the internet watching videos like cat videos and other such media. As a result, the computing power that could be used during this process through the browser is put to waste. To hone in on a specific solution to this problem, we set out to create an app that enables users to earn money while they waste time on the internet through specific video streaming sites like YouTube and Twitch.

Another surprisingly related problem, a lot of third party eCommerce marketplaces have trouble keeping track of transaction history due to potential fraud from hackers. As a result, a decentralized system for transaction authenticity is needed to keep track of each transaction.

Our app is a proof of concept web app that solves both of these problems. This app is run by a simplified blockchain implementation that can distribute it's workload across multiple peer browsers to calculate the next hash of a new ledger transaction.

What it does

Our app uses the cumulative processing power of several browsers to mine a decentralized blockchain. By mining the blockchain, it updates the public ledger of transactions that happen on a specific marketplace. When a user helps mine the blockchain, the user earns some form of marketplace credit to compensate for leasing out their computer's processing power to mine the blockchain. The monetary compensation is a direct component of the amount of processing power required by a user's browser. This has a direct correlation with the number of transactions in the public ledger - that is, the more transactions there are, the harder it is to mine the blockchain.

How we built it

We forked a visual demonstration of a simplified blockchain, and used socket.io to distribute the work of running the hashing algorithms across multiple browsers connected to the same web app. This web app could serve up any kind of content while users' browsers are also running the hashing algorithms for the server.

In the demonstration app, when the data for the next transaction is input and the user clicks mine, the data to run the hashing algorithm is sent to the server. The server then takes all of the other connected clients and distributes to them an equal portion of work. This work is a range of nonce numbers to check against the result of the hashing algorithm. When the first client app finds a correct solution (ie: a verified cryptographic hash ) the server stops the rest of the clients from running the checks. In order to calculate the cryptographic hash we made use of the SHA 256 hashing algorithm. This is all done in real time with a pub sub architecture using sockets in Node.js. The client that we made is vanilla HTML/CSS/JS, and the demonstration panel that we modified is written using a jade template and an express server.

Challenges we ran into

We ran into problems with setting up socket.io to work with the existing server as it was less straight forward than anticipated. In addition, taking the code from the one client side app and spreading out to the two clients and single server asynchronously created a lot of timing and data binding issues. Once we created the data flow for all three apps to work correctly, pulling apart the algorithm became easier.

Accomplishments that we're proud of

One of the big accomplishments was when we successfully split the hash number distributing it to the multiple clients. As the project code became more complex over time, this task proved more challenging than expected.

What we learned

To do this project we started out buy researching how cryptocurrencies and the blockchain work to add new transactions to a ledger in a way that prevents someone from editing the record of transactions (i.e. it is fraud-resistant). We also figured out how to use the socket.io library with node.js, and how to distribute parts of an algorithm between multiple peers on a network using that library. When we researched this idea we did not come across any similar projects.

What's next for VidPay

We plan to implement the our web app with an actually full fledged blockchain going forward. Industry standards include Blockchain.com and Etherum. Going forward, we would like to implement a structured form of monetary compensation tied to the platform

Share this project:

Updates