First we install in our Google Chrome browser the app “MetaMask” (download)

Once installed, we create in the net “Rinkeby Test Network” a new Ethereum account.

Captura de pantalla 2017-12-07 a las 19.02.08

We will get a new Test Ethereum account with 0 Ethers… then, we need to get some Ethers in the network. For this reason, you must copy your Ethereum address and publish it in your Google+ social network.

Captura de pantalla 2017-12-07 a las 19.04.48

Then, we copy the link to the social Google+ pots.

Something like this: https://plus.google.com/101055179642806438902/posts/VPSdXoa4JfU

And we go to the Rinkeby web and we add our address to claim our free test Ethers.

Captura de pantalla 2017-12-07 a las 19.07.49

Once we get the Ethers we can see it in the Rinkeby Etherscan: see it

Captura de pantalla 2017-12-07 a las 19.09.03

And we can see this Ethers also in MetaMask:

Captura de pantalla 2017-12-07 a las 19.10.50

Now we can continue deploying our first Token Contract to create 21.000.000 tokens.

We go to Remix and we start creating our first Solidity code.

Captura de pantalla 2017-12-07 a las 19.15.16.png

We set the code:


pragma solidity ^0.4.19;

contract MrAddonToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;

function MrAddonToken() {
balanceOf[msg.sender] = 21000000;
}
}

And we go to the “Run” section and we set:

  • Environment: Injected Web3
  • Account: our account number

And then we push “Create”

Captura de pantalla 2017-12-07 a las 19.16.06

Then MetaMask will ask us to confirm the contract deployment:

Captura de pantalla 2017-12-07 a las 19.18.35

Once submitted, we will see in the Etherscan our contract created. See it

Captura de pantalla 2017-12-07 a las 19.19.42

We will get a new Contract account/address but for the moment, the code will not be visible.

Captura de pantalla 2017-12-07 a las 19.21.04

To see the Contract Code we need to Verify the code. We need to click on “Verify and Publish”

Captura de pantalla 2017-12-07 a las 19.22.43

Don’t forgive to put Optimization: DISABLED!!

Captura de pantalla 2017-12-07 a las 19.23.54

Once Verified, we can see the contract source and we can call the functions!

Captura de pantalla 2017-12-07 a las 19.25.43

The new tab “Contract Source” will be available

Captura de pantalla 2017-12-07 a las 19.27.48

And we can query in the tab “Read Smart Contract” for the balance of tokens of our test Ethereum address/account

Captura de pantalla 2017-12-07 a las 19.28.15

That’s all! It’s very easy all with MetaMask.. just the new Web3.0!

MrAddon.

Posted by:.

2 replies on “Creating my first Ethereum Smart-Contract in Test net

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s