nw  

Summary

Blockchain technology is often limited by scalability issues and high gas fees, but the use of a layer 2 like StarkNet can help relieve these problems. By computing transactions off the main blockchain, such as Ethereum, the network can handle more activity without slowing down. As a proof of concept, a simplified Pokemon game was built on this layer 2 using non-fungible tokens (NFTs) for players to battle each other.

Keywords

StarkNet, Ethereum Blockchain, Cairo Lang, Solidity

Objective

Build a decentralised application and investigate the communication between Layer 1 (Ethereum Blockchain) and Layer 2 (StarkNet).

Starting position

Blockchains are on the rise and form the backbone of decentralized applications (DApps). The core advantage of DApps is that no central authority is needed to ensure that the DApp functions properly. Thus, there is no need to trust third parties. Blockchain has a very limited computing power compared to centralized alternatives like cloud, which makes it unsuitable for certain applications. However, there are innovative projects and concepts to solve this problem. Cairo is one of these solutions and uses so-called zk-STARKs (zero knowledge proofs), which allow programs to be executed outside the blockchain and then cryptographically prove the correct execution. On theBlockchain, only the proof needs to be validated, which requires much less computing power than executing the corresponding program. However, technologies like Cairo are still very new and experimental and have yet to prove their viability.

Results

We built a decentralized application that allows users to mint their own unique Pokémon NFTs that are true to the original Pokémon game. Players can select an opponent for a fight, which is executed on StarkNet as a Layer 2 solution. This fight is computationally intensive enough to be very expensive if it was implemented without a Layer 2. Once the winner is declared, the results are displayed on the React web application after being confirmed on the Ethereum blockchain. This approach enabled the dapp to handle the high computational demands of the fight while maintaining the security of the underlying blockchain. It was a success to investigate how the communication between the layers work as well as its advantages and disadvantages.

Project data

1 Semester/180h of work each, 2 People

Client

Institut für Mobile und Verteilte Systeme

FHNW

Bahnhofstrasse 6

5210 Windisch

Project team

Valeria Robles Garzon

Luca Lunati

Contact

Markus Knecht, markus.knecht@fhnw.ch

Daniel Kröni, daniel.kroeni@fhnw.ch

<< zurück