Development Environment

To get started, we will learn solidity as a language. We won’t begin with deploying contracts on the blockchain, that will just make things more complicated.

Head over to remix.ethereum.org

You are strongly encouraged to use Remix to follow along with the examples in this course.

Let’s create a hello world.

contract ExampleContract {

    function helloWorld() 
        public 
        pure 
        returns (uint256) {
            return 100;
    }

    function haloDunia() 
        public 
        pure 
        returns (bool) {
            return true;
    }
}

After you go to remix.ethereum.org, right click contracts and left click “New File”

Click "new file" in Remix

This is a solidity file, so give the file a .sol extension. The name is not important

https://static.wixstatic.com/media/c0c19a_3f7aed5e540941efbf85e0c8983090f1~mv2.png

Copy the code from above, or better yet, type it out yourself.

Solidity code in the Remix editor

To compile the code, hit Command S on mac (CTRL S on Windows). If you see a red bubble above the solidity symbol, you have a syntax error. if you see orange, you only have warnings which you can ignore for now.

Now deploy the functions. Click the Ethereum symbol on the left, then click deploy.

Click the Ethereum Symbol

To test the functions, scroll down on the left menu, then click on them. They will return the values you expect them to.

https://static.wixstatic.com/media/c0c19a_cfb667754c4a4398bbdf27c7c4914a76~mv2.png

What if we want to make changes? Delete the contract with by clicking the trash icon.

Deleting a smart contract from Remix

Now change the code, recompile with command S, then click deploy. Test the functions again.

https://static.wixstatic.com/media/c0c19a_074c5f0e3de540a09e1d2d32e9672f03~mv2.png

If a function requires an argument, it will be supplied next to the button.

View function returning  avalue

You are now ready to experiment with Solidity smart contracts!

Learn more with RareSkills

See our Solidity bootcamp to learn more about smart contract development and token standards.

  • Loading