ETHCapeTown Hack: Learn to Play with Bonding Curves

Benjamin Scholtz
May 20, 2019 · 9 min read

“Capture The Block”, and how play became a powerful tool for understanding bonding curves.

The idea that play is a powerful tool for learning and understanding is nothing new. As kids, we knew no other way, but as adults, we soon forget to play.

“Tell me and I forget. Teach me and I remember. Involve me and I learn.” — Benjamin Franklin

“Whoever wants to understand much must play much.” — Gottfried Benn

“The creation of something new is not accomplished by the intellect but by the play instinct.” — Carl Jung

“Play gives children a chance to practice what they are learning.” — Mr. Rogers

During the ETHCapeTown hackathon, our team made up of Michael Yankelev, Ryan James Noble, Michael Jordan, and myself, set out to create a game to make bonding curves more practical, fun, and allow people to learn through the act of playing.

ETHCapeTown was the first ETHGlobal hackathon to be hosted in Africa, in the beautiful tech hub of Cape Town. We were lucky to have some of the best minds attend as mentors and judges, and a number of the top projects were championed by teams new to the Ethereum space.

This is a story of our experience and what we learned.

TL;DR

Maybe you came here to play with bonding curves, and not to read? No problem! Give the game a go, and then we’ll carry on where we left off explaining why we created “Capture The Block” and what you can learn from our experience building it:

Do we still play?

We play all the time, maybe not with Lego and running around in the mud outside, but rather in the way we experiment and experience new things. We adapt to our surroundings, and sometimes have fun doing it. The term “Playing the stock market” isn’t a euphemism. Adults genuinely get a thrill from winning and competing on the stock market — no different to a child playing, and like a child playing, adults learn from these experiences.

I was lucky enough to be taught by my dad about the stock market, something that wasn’t really discussed with his own father. But the real way I was given the opportunity to learn about world markets was by playing — looking at the latest stock prices in the newspapers every week and pretending, playing make-believe. From there I was told about the theory of macro and microeconomics, but without play, there would have been little context.

Ready to play with bonding curves?

Looking at the Gartner hype cycle the technology trigger has passed, and we’re probably sitting somewhere between inflated expectations and the trough of disillusionment. To get through the trough and onto the slopes we need to start experimenting. This is already happening with the likes of the Commons Stack, the team at BlockScience and their cadCAD project, and our own projects at Linum LabsMolecule and Protea.

Sometimes, when we don’t fully understand the full scope of applications that bonding curves can be applied to, we need to take a step back, take things less seriously, and play with the dynamics and behaviours of bonding curve economics in more fanciful scenarios.

Capture The Block: What makes a game fun?

Assuming you have a good story, artwork, and genre — gameplay is what makes a game fun.¹ A game should have at least one core gameplay component. Super Mario Bros is a good example of this. The core mechanic is to save the princess and score points while avoiding treacherous obstacles along the way. If you hadn’t noticed, we took inspiration for the tiling from this game.

The gameplay should include at least three mechanisms: an objective, a challenge, and a reward.¹ With this in mind, we set out to make a game with the core mechanics being tightly tied to bonding curve dynamics.

Newton’s Laws of bonding curves…

Even the simplest of games introduce basic laws of motion.

Newton’s second law of motion says that the vector sum of forces on an object is equal to the mass of that object multiplied by the acceleration of that object:

F=ma

From this law we can derive the equation with velocity as a parameter:

F=(1/2)*m*v^2

The only concept of time we have in smart contracts is block time. With this and the dynamics of a bonding curve, we thought that we could come up with some interesting dynamics.

Take Flappy Birds for example. It’s a two degree of freedom (2DOF) system — you have the progression of time or movement along the x-axis, and height up and down the y-axis.

If you take block time and use it as the progression along the x-axis, you have a concept of movement. We soon scrapped this idea to limit the scope of the game but had an interesting conversation with Liam Horne from Counterfactual about possibly using state channels to bring some of the gameplay off-chain. This could increase the game’s time resolution, while still possibly using block time as a continuous check-in point. This would take the game from a 1960s frames per second (maybe that’s being harsh, they probably had better FPS), to modern gaming with a periodic 22 second check-in time.

We went down a number of rabbit holes discussing bonding curve shapes, and how they could introduce a concept of height. Everything from sinusoidal waves to opposing bonding curves.

The mapping of blockchain dynamics to game mechanics:

  1. Friction/difficulty of climbing the hill: increasing bonding curve token price
  2. Progression of time: block time and transaction size

The gameplay & game theory

There are a number of childhood games that fit the dynamics we had available to us:

  1. Capture the flag
  2. Tug of war
  3. Various racing games
  4. Surfing… perhaps introducing a sinusoidal wave?

We settled on capture the flag, or the catchy blockchain equivalent — Capture The Block.

The idea is simple. Two opposing bonding curves and a fight to capture the flag. The team who gets to the top of the hill first wins the entire collateral pot!

A user enters the site. If there is a game already in play, the user can join immediately and start trading on either side of the hill. It is a multiplayer game, so opposing teams are fighting to get to the top of their bonding curve first to secure the collateral of both sides.

This introduces some interesting dynamics. Players are encouraged to pump and dump the other side, perform sybil attacks, etc. — anything that could reasonably happen in the real world while using bonding curves. We want players to experiment, and that includes digging into the contracts for those who are willing.

Since the bonding curves are increasing, it becomes more difficult to reach the summit. Yet at the same time, it becomes more profitable for token holders to sell out, despite the detriment to the rest of the group.

At the end of the game, the team who gets to the top first has the total collateral in Dai from both sides fairly redistributed among themselves based on final token ownership.

Gameplay parameters

There are some design variables that dictate gameplay dynamics and provide some level of control to ensure gameplay is extended while still allowing people to “game” the system.

  1. The maximum price at the summit — this, with the shape of the curve, determines the total curve collateral or reward pot.
  2. The gradient of the curve — an interesting effect of having a curve other than a linear curve, is that you can design the incentive players have to buy or sell at different points. By using a sigmoid curve as an example, you’d be incentivised to buy mid-game. We’ll touch on more about this in the next section.
  3. The buy/sell order size — this determines how quickly a game can be won, by limiting the size of the buy orders, you make sure that a whale can’t come and immediately win the game.

Optimising incentives

When playing a game, there is the initial motivation to start playing the game, and the incentive to continue playing and win. Although the incentive to win might seem high, there are actually ways to be rewarded without winning the overall game. Getting the final pot is not the only way to “win”.

Michael Jordan did some interesting actuarial work to figure out what curve gradient, maximum supply, and step size, is optimal to make sure players are rewarded fairly even if they only trade towards the end of the bonding curve. Based on the table below, the pay-off was calculated. This shows how much you’re paid out if you bought in at different points along the curve.

The maximum price at the summit determines the size of the reward pot — too high and you limit who can play the game, too low and there is little incentive to win.

The gradient of the curve, along with the buy/sell order size, determines how quickly the game can be completed. This should be optimised to be quick enough that players do not get bored, but long enough that players have a chance to compete.

Another effect of limiting the buy/sell order size is ensuring whales can’t kill the game prematurely. By having a small step size, the block time provides the friction needed to allow anyone to fairly compete.

The stack

We chose a standard React-Redux stack with the logic in Ethereum Solidity contracts. We made it a dApp, and by avoiding a centralised backend like Node.js, also made it easier for developers to contribute to the game in future.

The Phaser 2D HTML5 game engine, based on Canvas, allowed us to create neat animations and to expand gameplay more dynamically with additional features.

Future features

  1. Introducing some form of randomness — this would make gameplay more dynamic, and possibly fair.
  2. Bonding curve taxation to ensure players don’t sell too soon after the game starts.
  3. Incentivising the creation of games: 1 Dai to create, 5% of winnings allocated to the creator.
  4. The ability to spin up multiple games at any given time and MMO (massively multi-market online) type gameplay where n number of bonding curves can compete.
  5. Other games, such as top trumps, tug of war, etc.
  6. Integrate CryptoKitty NFTs into the curves, as the risk and reward!

Key takeaways

We discovered and learned more about:

  1. Optimising crypto-economic incentives
  2. Designing gameplay mechanics and the resulting game theory
  3. The benefits of playing to learn

In conclusion, and back to work

We now sit, back at work, but not forgetting to keep on playing.

At Molecule, we’re working on continuous funding mechanisms for the research and development (R&D) of pharmaceutical patents using bonding curves as one of the core components — to bootstrap the market. We want investors to feel comfortable supporting a project, knowing that they’ll get something in return for the risk that they take on. It might not be a game, but there are surely parallels.

We have a big challenge ahead of us taking on the current pharmaceutical drug development process, but let us not forget that with economies of scale, a simple game becomes more efficient, gains stability, and becomes a more analogue representation of larger markets. Now, that’s something worth experimenting with.

References

[1] https://stanford.edu/~jbboin/doc/gamedesign.pdf

Interested in learning more about Molecule?

Get in touch with our team on Twitter or Gitlab & join our Newsletter for project updates and announcements.

Molecule Blog

An open source ecosystem to fund discovery of molecules and…