Using CodeChain to Mint Assets

Seung Woo Kim
CodeChain
Published in
3 min readJul 27, 2018

Creating a game with meaningful currency has been difficult in the past. Mainly, this is due to inflation, as game developers can easily create an infinite amount of money within the game to their liking. Soon, the in-game currency’s value will be lost as more and more currency becomes issued. In addition, there are many cases where hackers ruin fair gameplay by discovering exploits to farm a large sum of gold that’s enough to disrupt the entire game’s economy.

Blockchains can offer a solution to this problem, and CodeChain tackles this problem through its properties of asset minting. When minting assets using CodeChain, the amount being minted in that instance is important. This is because assets that are minted in other instances are different asset types. As a result, game companies would initially need to decide exactly how much currency will be circulating the game’s economy.

So let’s say that you would like to create 1 billion Gold that will circulate the game economy that you will create. Once you mint 1 billion Gold, this Gold will be the only accepted form of currency within this game. Gold that were minted using other instances of AssetMint will be automatically rejected by the blockchain system. So how would you go about doing this?

First, you need to get CodeChain configured properly. To do this, visit CodeChain’s Manual Documentation and follow the directions there. Once everything is up and running, you should see a screen that resembles this:

Next, you want to create that 1 billion Gold mentioned earlier. To do that, create an address that you can use to claim ownership of the 1 billion Gold created.

To do that, first create a keystore, along with p2pkh. The keystore is responsible for managing the key pair, and the p2pkh is responsible for generating new addresses from the keys.

Then, create your own address. Let’s call it gameCompanyAddress.

The new address is created, and in order to create 1 billion Gold, you must first define the Gold in an Asset Scheme.

After defining it in the AssetScheme, create a mint transaction along with the recipient of this newly created Gold. In this case, it would be the gameCompanyAddress.

Next, this transaction must be packed into a parcel and sent off into the CodeChain node.

Parcels need to be paid for by a platform account that holds CCC. For the sake of simplicity, we will use an account(cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7) used for testing purposes. The methods on how to create a new account from scratch and adding CCC into that account shall be discussed in a later article.

To find out whether the parcel has been sent successfully or not, you must check the result included in the invoice.

Once the parcel is processed, you have finished minting 1 billion Gold into the newly created account. For a more detailed explanation, please check the manual documentation. In the next article, we will discuss sending this newly created Gold to other users who join the game.

--

--