DAPPCON 2025: Bringing THC to the EVM: Designing Decentralized Treasure Hunt Challenges on Ethereum
DappCon 2025 · June 2025 · 19:52
A DappCon 2025 talk covers designing decentralized treasure hunt challenges (THC) on Ethereum, on-chain puzzle games that reward participants for finding and claiming hidden assets scattered across a set of smart contracts. The format borrows the scavenger-hunt structure of a traditional treasure hunt and re-implements it as an on-chain game.
Speakers
Topics
From DappCon 2025, hosted by Dappcon Berlin.
Transcript
How are you doing? It's quite bright in here. I got a bit more tense. So, my name is Alberto. Uh, you can call me Albi. And today I'm going to talk about how to bring PHC to the EDM or how you can design the centralized and onchain treasure hunt challenges on Ethereum. Before we start, a few words about myself. Uh I'm a time traveler at social distortion protocol. I also I'm also the founder of the Ethereum Foundation with an I. Uh I invite you to join to join us. Uh go to the website and there is a link to our telegram channel. Uh I'm also a freelance software engineer because it seems you need money to live
in this society. So I work with artists and with them I develop um onchain fine art and also with lawyers uh and with them I develop also um legal dows let's say you can find a list of my works on my website grandzoatoto.net net. But let's go back to social distortion protocol or SDP. It's an organization established in the year 2045 that is in the future for you. And our future is broken like beyond repair. So there is no way for us to fix it. And what we do instead is we time travel. We time travel back in the past that is your future sorry your present. And um we do like these kind of experiences to show
you how the future looks like if you don't fight. And um some people call this kind of experiences game, some other people call them art. We like to use the term experience. And the experience I want to talk about today, it's an experience we really really like that is called THC or treasure hunt challenge. Uh a treasure hunt challenge is also called scavenger hunt. uh but it doesn't allow you to make any fun like acronym with it. So we went for DHC and it's a game that you play on a physical space can be like a an event, a conference, a building, a neighborhood, a city. The game is built around a narrative and um it's organized into levels like many classic games. to go
from level one to so on till the end. And your goal as a player is to solve physical puzzles to progress throughout the game and to finish the game. This is a highle structure of how the treasure hunt uh looks. You have a master plot that is surrounding the whole game and uh the game is divided into chapters. Chap. The first chapter is of course chapter zero and uh where you have uh inside a chapter you have a quest that is some text that uh gives you the context of the story and should and at one points you to a puzzle. A puzzle is a physical most of the time is a physical um thing you need to find and
uh and solve it. And once you solve it, the uh the puzzle will release you uh a solution that is just a piece of text that uh would allow you to move to the next chapter and so on. We have also side quests. So some chapters uh they have these u other things you can solve to gain more points, but they're not needed to finish the game. While if you want to finish the game, you need to go linearly from chapter 0 to chapter n. Uh one very important thing for us as game masters is the onboarding. The onboarding is the process of taking an attendee at an event and converting or convert them to a player in the game and instead of again attending the uh the
event, they will then just spend time with our puzzles. Uh we do this by uh crafting uh letters uh and envelopes that we hand out to people at the conference and uh you receive this letter. It looks kind of nice. Uh inside there is this letter that is inviting you to play the game and you will find also a link uh that will when you open it will will open our dep where part of the game is developed and we use this kind of envelopes. So, also these other ones, I don't know if you uh any Germans here, if you have this one in your mailbox, congrats. You're a bad boy. Uh the game works like this. So, after you open the letter, I said that there is a
URL. You open the URL. 99% of the time, you open it on your phone and this is where the game starts. So, you have the on boarding phase that I just described. Then, you open the website and you start reading the first chapter. Then you locate the puzzle and uh ideally you solve the puzzle, you get the solution and you use the uh web application that is on on the left side here to submit the solution and then the game progress to the next chapter that will you will read again um a new part you you will read the quest for the puzzle solve the puzzle and so on. There are some nice side effects to this kind of experience.
So first of all you exploit the venue. The game again develops over the venue uh of for example it can be an event as I said already and uh we make the game so each chapter will touch a different part of the location. You also connect with others and we had so many examples of people that started the game by themselves and they ended up finishing the game in a team. And even most important you learn new things. We have people doing lockpicking for the first time because they had to solve a puzzle or uh also people starting uh creating their first smart contract on solidity because they had to hack let's say for a side quest a puzzle that was on the Ethereum blockchain
and uh keep I want to keep talking about the puzzles now and um this is probably the most time consuming uh part for us as game masters to create a nice THC because they are in a way connected to the uh to the location where we deploy the game. Uh this what this was at if Berlin and it's a ball pit and we put some balls with a password inside and you had to basically spend quite some time to find these special balls in the ball pit to find the password or this is actually super fun. It's a chess board and you had to solve um a chess puzzle and move the pieces physically on the board to make
the board automatically open because we had some RFIDs under the board and again we like also to play to play with hardware and this is the what this board would do. This one is one of my favorite because a bit it's quite weird. You have a keyboard, MIDI keyboard connected to a birdhouse. And uh you had to play the right tune in order to open uh the door of the birdhouse and and get the password. And everything we do is quite do it yourself. Some people mistake what we do for bombs, but this is not a bomb in case you were wondering. Or this other one is called the vibrator. That is I think the first sex toy connected to the optimism network and you had to interact with a smart contract in order
to activate the vibrator and it would vibrate you in mors the password. So you had to hold it in your hand or somewhere else to get the password to get to the next level. Thanks. Um, and of course like this game is played by many people at the same time and uh it's also fun to see where you are where you are at compared to the others. So we developed also of course a leaderboard uh where you can see uh all the addresses at which chapter they are and also how many side quests they uh solved. And once you finish the game or you finish all the side quests, we also release onchain art onchain NFDs uh developed by some artists we collaborate
with. And uh again what we we love onchain stuff. So also the NFDs are onchain SVGs with no external dependencies. We run this uh as I said already we love THC. We love this kind of game and we uh released the game several times over the years. Uh we started at the congress the curs communication congress and then uh we also deployed the game at east berlin three and four and devcon six and five and six and seven and we did this also I want to mention dedalus industries that is another organization and they developed all these crazy also like hardware puzzles that I also show you in the in the in the section before and also really they're quite amazing but
today I want to talk a bit more about THC as it as in treasure hunt creator that is the open-source um framework that we developed to create this THC this treasure hunt challenges on the EVM it's open source uh you can find it on our GitHub social distortion-protocol the zero is very important otherwise you go to our competitors and /tc uh the uh framework is divided into two pieces there is a that is the front end and there is also the back end that is the smart contract. There is nothing else. So we don't have any other servers um spinning around. It's just like these two pieces. We try to keep things as
again onchain and decentralized as possible. So we avoid uh having our own servers, let's say running the game. Uh the experience from the DAP, as I said before, the DEP is your navigator. It's what you use to explore the game uh and go from chapters to chapters. And also this is what you use to submit your passwords. So your solutions to the to the puzzles when you first open the game uh with the web app there is no registration. So uh you start and you're already in a way registered because we create a burner wallet for you on the phone and given that it's a burner wallet and we don't have the address uh ahead uh there is no balance in this burner wallet. Uh but in order to submit
solutions, we just use uh gelato relay network. So we sponsor basically your transactions uh that are sent to our smart contract. So you need nothing. You don't even need a wallet in installed on your phone if you don't if you don't have one. And uh the other thing that is also important is game assets. As I said, we only have two pieces, the DAP and the smart contract. So the game assets are built in the front end in the DAP and uh I remind you the structure of the game. So you have uh each chapter has a quest, a puzzle and solution. And in that case um given that everything is um again in the front end in the smart in the depth
uh you don't want you don't want players to be able to read the chapters that they're going to play later. So what we do is we take each quest and we encrypt it using AES with the solution of the previous chapter. So chapter one the text is is in your DEP in the DEP but is encrypted with a solution. So if you don't find the solution you will never be able to access this kind of text. On the other side we have this smart contract and um uh as a reminder we have again multiple solutions. solution um uh solution zero to solution n minus one because the last chapter doesn't have a solution. And here uh we are analyzing how we're putting the solutions in the
smart contract. Of course, we cannot put this solution in clear text because otherwise you would be able to decode it from etherscan or any other tool you want. So what we do instead is this. We take a solution, let's say solution X, and this is something we do offline before publishing the game. Of course, we take solution X uh and we hash it using KKAK and we get uh and we use the hash to create what we call a solution wallet. So, we initialize a a wallet using the hash as a seed of the solution and we have two things. Uh when you have a wallet, you have a public address and a private key. We take the public address and we store it in the smart contract. And after we do this process for all solutions, our contract is ready
to be published. So, keep this in mind. we have a smart contract with all the addresses of the solutions uh on chain. Now then there is this other phase that is sub that is the submission phase. You as a player uh represented as a nice pink skeleton because maybe it took too long to find the solution uh find the solution and we run on the front end the same algorithm I show you before. So we hash the solution using KKAK. We create a hardware wallet. But this time instead of caring about the solution address or the public address, we care about the private key. Why? Because we need it to sign the address of the player. So the burner wallet I told you before. So we
take the wallet of the solution to sign the player address and what we get is a proof that that player found that solution. So we take this proof R SV and then using the wallet of the player we submit it to the smart contract. At this point the smart contract starts the verification phase. And what happens is that by receiving this RSV this proof the smart contract is able to run an easy recover using as data the uh player address. And at this point like uh the smart contract is recovering the signer and if the signer is is it's a solution it's a valid solution then the player
can progress to the next chapter otherwise it's rejecting the uh the transaction and this is crucial again because we don't want solutions to be public on chain and this is some kind of uh I guess it actually checks all the check marks of a zero knowledge proof if not let me know but for me this sounds like zero knowledge proof it's not super fancy I mean it's just public key cryptography But still it works very well and it's very cheap in terms of gas also. Uh also like uh in order to prepare all the game assets uh publish the DAP and uh also uh deploy the smart contract with all the solutions as I said um encrypted we need to
um there is a lot of tooling sorry the process is actually quite complex. there are different steps you need to do in order to deploy your own treasure hunt challenge and we don't want you to roll your own THC because it's too complicated. So we developed another framework called CBD uh that is the THC companion and uh CBD stands for continuous build and deployment and this another part of the framework that you can still find on GitHub on SDP/CBD and this is taking care of basically um all all these intermediate steps you need to publish the game. There is one thing that is actually quite crucial when you deploy the game uh and uh all the all the quests are basically in in
the front end already and maybe you need to change something because something is not clear or like a quest is not as clear as you think uh it was or for example something changing the venue and you need to modify part of a chapter. All these uh small like edits they require the pipeline uh to to to be run again the pipeline to build all the assets and CBD is taking care of this part basically rebuilding all the game all the game assets and publish everything on chain. Um that's all on my side. I have two minutes left. I will quickly uh can I go back here? Yes. Nice. I want to quickly mention um that this kind of game is also a DIP that is a devcon improvement
proposal. Uh I invite you to check the original proposals here. This is from 2020. This is the AP4. uh same year uh 2020 there was the AP11 by Dalus Industries industries that I mentioned before and they submitted also uh um improvement proposal for DevCon to create this kind of escape room crypto boarding escape rooms and then in the year 2024 we decided to merge our efforts so SDP and the Delus industries to make uh more like a wider let's say proposal 36 that is game of capture and escape that you can also read at that URL. And now I'm really done. Yes, you
can find me on Twitter at VRde. And if you want to follow SDP, go to distortion proto uh where the first O distortion is a zero. That is crucial. Don't don't don't it up. Thank you guys. Take care. Questions though? Yes, we we have time for questions. Uh that how did the Zuckerberg hunt go? Did you find Zuckerberg? Yes. And then we found Zuckerberg. That was the very first uh game we deployed. It was not exactly this format. It was more like a geocaching. So you had to find QR codes that were hidden in the com in in the event at the congress. In that case it was a primitive version of
uh THC and uh it was very simple but people love geocaching and that was the original let's say the seed idea uh that also guide us to to create these DHC games. They just they just had a geocaching treasure hunt in San Francisco uh that they were talking about on the news someone won uh something like $10,000. People love geocaching treasure hunts. Yeah. In our case, you don't win $10,000. People are also happy with like I don't know once we gave us a prize, a piece of wood.
I mean, it's nothing. But given that it was part of the game, for whatever reason, they liked it. Stickers. But I mean, if you play these guys, don't expect to win $10,000. That is not even the money we make. So, it's also quite expensive on us to make these kind of games. Of course. Of course. Any questions for Alberto down here? That was a great talk. Thank you, Alberta. Thank you. Um, I remember a year or so ago that there was crypto the game or something like that that became very popular. It was even acquired by unis swap or something like this. So, it seems that playing these games with onchain mechanisms is becoming something of a trend. Would you say that? And like where do you see the future of social
distortion going? Like what's your idea to maybe scale this? or maybe you don't maybe it's you know what's your vision so u first of all we have no vision that's also part of STP we don't have uh yeah we just live day by day to be fair uh we have another game we uh deployed a time ago uh that I want to do again it's uh we like this idea of like onchain pop-up games and uh what you mentioned before by the way try to answer your question about onchain games I think it's a super cool trend there people doing uh a lot of really cool games uh onchain games. What we like is this kind of uh onchain games that you play in a
real uh physical space to connect with other people. So we want to focus more on these kind of experiences and uh if we have let's say a plan for the future is try to develop more this kind of ideas of inerson onchain games because I think they're quite fun.