"NEAR Place" Tutorial

This is the NEAR Place code. This contract has the same principles as Berry Club game, except it's more simpler than that.

We have a platform where we can draw on the front end, and for the pixels you draw, you earn. You have to first pay to buy the quota to draw, each pixels cost the same. Based on how much you draw, you earn.

When someone else comes in and draw on top of yours, your pixels got overridden, and you earn less after that, since you occupy less pixels on the board. To earn back, you need to re-draw to overwrite their changes, so you're the owner of those pixels again.

You can think this as a land, and having multiple empires warring against each other for the land. Each pixels represent a land. Perhaps you send some army to occupy a land (which requires you to pay for the food of the army, and other costs). Now that land is yours, and there may be buildings on top of them which you can rent out to others. Or perhaps you charge tax for the people that lives there. (And hence, each pixel you owned earn you some money).

Then, someone may come in and occupy your land, the land is no longer yours, so the earnings/tax goes to the owner whoever occupied your land before. And if you want to earn the tax, you need to fight it back. The process of fighting it back, you still have to pay for the food and other expenses of your soldiers (money to draw pixels).

So right, this is an analogy of how it seems to work.

We shall look into the code of how it worked out. This code also have a link to the front end so we shall also look at how the communication goes with the smart contract.

References

  • https://github.com/near-examples/place