project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

Stardust CCIP

A space commerce game where players use CCIP and SHA256 hashes to ship secret cargo between different blockchains. Built using Godot, Godot Rust, and Ethers-rs.

Stardust CCIP

Created At

Superhack

Winner of

🏗 Chainlink — Best use of CCIP on Optimism

🏆 Superhack 2023 Finalist

Project Description

Players take the role of a cargo ship pilot, earning game currency by buying goods and delivering them between CCIP-connected chains. Rather than running in the browser, the game is a local app that manages its own secret keys and connects to the blockchain via RPC.

The game features a cross-chain secret-passing mechanic, where players encode the contents of their ship's cargo hold in a SHA256 hash when departing a chain. Their cargo may include Contraband, which is worth much more than other cargo, but which leaves them vulnerable to being caught en-route by other players.

While they are in transit to another chain, other players can choose to put up collateral and place a claim on the incoming cargo. Upon reaching the destination chain, the incoming player must reveal their cargo by committing the values used to create the hash. These values are hashed on-chain and compared to the hash that was just carried from one chain to the next.

If the hashes match, and the values themselves are valid, the player will sell their cargo and receive a reward. But if they were carrying contraband, and another player had placed a claim against them, they will lose all of their cargo, while the claimant receives a small bounty.

If the claimant was wrong, and the cargo was clean, their collateral deposit will instead be given to the player as an extra reward.

How it's Made

Check out my devblog, where I've documented my entire process from the beginning and the various challenges I've faced. It's quite long and detailed, has pictures and video, and I consider it a major part of my submission in addition to the game:

https://github.com/Cactoidal/Stardust/tree/main/contracts#readme

In summary, the project was built in Godot, an open source game engine, using Ethers-rs and Godot Rust for key management and interaction with the blockchain. Open source / public domain 3D models came from sketchfab, shaders from godotshaders.com, and music from Kevin MacLeod's free music archive. Some art was generated by Dall-E, and some was created or touched-up in Krita, an open source painting program.

Originally I thought I would have a team, and was going to develop a browser game and use Metamask. A few days after the hackathon started, that ended up falling through. At first, I wasn't sure what I would do. But then I thought about my previous experiences using Ethers-rs and Godot Rust. I realized they could probably do what I needed, and I should just give it a try. I really put my Rust and my Godot skills to the test and I'm very happy with the result.

I was also really happy with the smuggling mechanic, where a SHA256 hash is used to obscure the contents of the ship's cargo hold, and how there's an interplay between players trying to slip Contraband past each other, and players risking collateral to put down Contraband claims on ships they suspect are carrying it. It's an idea that bedeviled me from the beginning of the hackathon, and when it not only finally clicked, but actually worked in implementation, I was ecstatic.

Using CCIP was a great challenge and I'm just glad I was able to make a working game that uses it. Cross-chain interoperability widens the potential playerbase and also exposes newcomers to a wide variety of blockchains. Increasingly I would like to see games that use blockchains, but are not "blockchain games" in the sense that the connection to the blockchain is the game's only defining feature.

Games of the future will have seamless access to blockchain networks, just like games now have seamless access to the broader internet. Connectivity to blockchains will become the norm, and be expected, just as network protocols used in today's multiplayer games have become an expected, routine part of games.

I'm still very much in the tinkering phase but I would like to see more games exploring use of the blockchain, and more blockchain-using games that exist outside of a web browser. Hopefully the work I've done here can help others who want to try something similar.

background image mobile

Join the mailing list

Get the latest news and updates