How I created my own “4chan” on the Kadena blockchain

Thanos
KadenaCoin
Published in
3 min readApr 29, 2021

I deployed a contract to allow anyone to express themselves freely and engrave it on the Kadena blockchain anonymously for the rest of times. Come have a chat at https://anedak.com/chat

Why?

Fun. I’m not a developer but I love to play around existing “softwares” and modify small parts of it to fit my needs. This was my second attempt at PACT.

A while back Kadena released hello.world, a smart contract on the chain to engrave your name in the early blocks and leave a trace. It is still hosted here. I didn’t think much of it at the time, but then they added a gas station to it, allowing everyone to write their names without owning KDA or even a wallet!

This gave me the idea to play around the code and try to make an anonymous chat room.

The contract

I first had to make a few modifications to the rules of the messages sent. The original one accepted any length of message but that can become problematic with anon-style chats. If something can be abused someone will…

The only restriction on the messages sent is on line 18
It says that the message cannot be empty.

So, basically I added 2 more enforce. On line 19 and 20 that keep the messages between 9 and 1023 characters. I could/should remove the empty one since it’s covered by >8 but eh.

Gas station

My first gas station used this code which was a total failure. I set the gas fee in the front-end but anon loves to break things, so they emptied my station with custom transactions bypassing the front-end.

A few enforce later on that contract too and it now looks like this

On line 26 and 27 I specified a max gas cost and max gas amount the station will accept to pay for. I also needed to add line 10 to be able to use those properties.

Front-end

This was the easiest part, I copied the original version and changed which contract and gas station it connects to, then reversed the chat order to get the most recent messages first.

Source

This chat room is open source and can be hosted anywhere. All you need to do is open the index.html and you will connect to the chat. https://github.com/Thanos420NoScope/Anon-Chat

Make your own chat room

You can follow my tutorial on how to deploy tokens on Kadena, the process is exactly the same. Once for the chat room and once for the gas station.

Useful Links:

--

--