Inspiration
There are many popular social coordination games: Mafia, AmongUs, and Bang! being the most well known. An idea 4 years in the making, Phenomenon takes social coordination games to blockchain. Convince others you are the Chosen One, gain followers and watch your power grow!
What it does
Phenomenon is a competition to see who has the charisma and cunning to be crowned figurehead of a movement. Players (aka prophets) perform actions to prove their power, gain followers, and ruin their enemies. One prophet is secretly selected ChosenOne by Chainlink Functions. The Chosen One will always successfully perform divine actions while other prophets require luck and help from followers (aka accolites). The last living prophet wins and collects winnings. High Priests (randomly selected prophets at the start of the game) and other ticket holders who follow the last living prophet get to share the spoils.
How we built it
Chainlink Functions let me finally realize this 4 year dream. Nothing is hidden on a blockchain. It hasn't been possible to put a piece of data on the blockchain and use that data in computation while also keeping the data secret. Chainlink Functions allows Phenomenon to privately create data and perform computations. When prophets perform actions they send a request to Chainlink Functions who, with the help of offchain secrets, then fulfill the request and update the blockchain. (lines 363-471)
We also use Chainlink VRF to seed randomness at the start of each game (lines 330-361).
I did not anticipate creating this project until watching the "Deep Dive into Chainlink Functions" talk early in the Hackathon. It was during this talk that I had the epiphany that Chainlink could solve my private data problem.
Character images were created with DALL-E
Chainlink Products
Phenomenon uses 2 Chainlink products: VRF and Functions.
Both of these functions can be seen in use in the repo: contracts/phenomenon.sol lines 346-481.
VRF is called when the first player registers for the game (line 188) and contract state is updated when the game starts (line 212).
Functions is called at the start of the game and any time a player takes a turn (line 216, 242, 249, 266, or 277). Starting the game exceeds the callback function gaslimit and requires a player to call setGame() to change state variables.
Challenges we ran into
It was a race to the finish. Debugging Functions was very difficult. I was unable to properly install Deno on 2 separate machines and resorted to manually debugging issues. I still have not fully fleshed out how to use offchain secrets due to their brief expected lifetime.
Accomplishments that we're proud of
This has been an idea for 4 years. Initially I thought it would be a tabletop game with some piece of technology acting as an oracle. I've had the idea to do this on the blockchain for a year or 2 but never could conceive a way around the private but available data issue and so never tried. I'm so happy to have finally created this!
What we learned
Coding is 80% screaming into the void and 80% feeling like God or Dr Frankenstein, the creator of monstrous but wonderful creations. It's like Boris Grishenko in the James Bond film GoldenEye shouting "I'm invincible!" right before dying in a horrific liquid nitrogen accident.
What's next for Phenomenon
Continuing to develop the base code. There is more functionality that needs to be built but contract size limits/Spurious Dragon have halted me momentarily. I also need a competent front-end developer to create a better website.
Built With
- chainlink
- html
- javascript
- remix
- solidity

Log in or sign up for Devpost to join the conversation.