An NFT Smart Contract Holiday Event. OnChain Party Hats

ahmed aka gaper
4 min readDec 28, 2021

Introducing OnChain Party Hats.

Mint Here for free up to 5 at a time.

All the way back in 2001, Runescape had a holiday event that would permanently change the game forever. This event added items that are still to this day, the most expensive and sought after items in the game. I’m sure some of you may already know what I am referring to, Christmas Crackers and Party Hats.

To my surprise, a lot of my friends when asked if they knew what a Christmas cracker was, they said no. I guess not everyone played RS growing up huh? So I think it’s important to explain what a Christmas cracker is. A cracker consists of a segmented cardboard tube wrapped in a brightly decorated twist of paper with a prize in the middle, making it resemble an oversized candy wrapper. The cracker is pulled apart by two people, each holding an outer chamber, causing the cracker to split unevenly and leaving one person holding the central chamber and prize.

The Cracker

So to commemorate the first holiday season of the first major NFT year, I’ve created a contract that basically is the Christmas cracker game. The project is free to claim and all the artwork is completely on-chain. There will only be 9500 crackers to claim. CC0 obviously. (4156) All crackers will break on any type of transfer. That’s right, send it to one of your friends and watch what happens. The cracker will be burned and a new party hat NFT will be created. However, it is completely random between the sender and receiver who gets the party hat laying inside! Just like a real Christmas cracker. Isn’t that so cool! The only way to get the party hat inside is to send it to someone (or sell it), preferably a friend, lets make it fun! (JUST SO WE’RE CLEAR, even if you buy a cracker, you are not guaranteed the hat.) Preferably a friend, lets make it fun! The contract also prevents you from sending it to yourself. The party hats will be sellable and transferable like normal NFTs.

The Party Hat

This is an example of one of the party hats you can get when breaking open your cracker. There are 21 different colors in total, making for some unique combinations.

The point of this was really to create something cool and push some of the limits of what we’ve seen done in the NFT space thus far. This was really a passion project for me and I enjoyed making this contract so much. I hope we can all spread a little holiday cheer and pop open a cracker with all the amazing friends we’ve made this year. Today, the Christmas Cracker and Party Hats in Runescape are regarded as the rarest and most valuable items, fetching massive amounts of in-game gold and IRL value .Who knows, maybe one day these can be as valuable as the thing they were inspired by. I’m sure we’d all get a kick out of telling the rest of the world how much these hats are worth.

There’s a ton of other little surprises, but it’ll come in due time. This article may not be around forever, but this project will be as long as Ethereum is.

Who has the biggest crown relatively? That’s right.

Let me take you through the process of minting.

Go here —

  1. Connect your wallet.
  2. Enter quantity (up to 5) and click write under the claim tab to claim.
  3. Pay the gas to claim.
  4. Check Opensea, you now have a cracker.
  5. Transfer via TransferFrom in the contract or Opensea. If you transfer it or sell it, it will break.
  6. Enjoy party hat!

For those interested in how this was done technically, I overrode the default transfer function to check if first the token was a cracker or not. Then I used some psuedo-random function to select if the new token would go to the sender or the receiver. After that it would burn the cracker and mint to either or wallet. If the item is a party hat it acts as normal.



ahmed aka gaper

I am sharing my journey of Ethereum development and working on my own NFT collection, #Chiptos.