To start, we need to create a Smart-Contract in the Ethereum Testnet, we can use Remix and MetaMask

If you don’t know how to, you can read these posts:

We will use this code:

pragma solidity ^0.4.16;

contract Register {
    struct MyMail {
        string mail;
    }
    event Record(string mail);
    function record(string mail) public {
        registry[msg.sender] = MyMail(mail);
    }
    mapping (address => MyMail) public registry;
}

Once connected with our MetaMask ( plugin of Google Chrome browser) to the Testnet, we can use Remix to install the contract.

Captura de pantalla 2017-12-29 a las 12.41.56

Once deployed the contract, we can call the “Record” method to store information, in this case the mail  (and this mail will be linked to my Ethereum address, because I am calling the function from my address)

Captura de pantalla 2017-12-29 a las 12.42.04

MetaMask will ask us to approve the transaction

Captura de pantalla 2017-12-29 a las 12.42.15

We will see the input params of the transaction in Etherscan

Captura de pantalla 2017-12-29 a las 12.42.30

Once verified the smart-contract in Etherscan, we can interact and obtain the mail data of an Ethereum address…. because, in this case, we want the Registry of users public.

Captura de pantalla 2017-12-29 a las 12.42.53

You can see the source of the contract and interact ->here<-.

By MrAddon

Advertisements
Posted by:.

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