Tour de EOS IDE 🚵‍- Getting started Part 1

This tutorial will be a guide on getting started with EOS smart contracts within a few minutes. This IDE is an equivalent to the Remix of Ethereum.

Given that EOS smart contracts are to be written in C++, and there are a few online C++ IDEs that compile down to WASM (WebAssembly Explorer), and WasmFiddle (C, but not C++). However many of those IDEs don’t currently have access to the EOS libraries/headers that provide all the API integrations. Luckily, one can access this EOS IDE from the web browser and be able to connect with a Scatter Account.

What you will learn in this tutorial:

  • setup a testnet account and use the testnet faucet (step 1)
  • set a EOSIO testnet for the Network Settings in Scatter (step 2)
  • connect testnet account to Scatter (step 3)
  • connect Scatter to the IDE (step 4)
  • compile, deploy and run the smart contract to the testnet (step 5)

*Block One added WABT (Web Assembly Binary Toolkit) optimizer that made the EOSIO network 3x faster. *

Step 1: Connect to the CryptoKylin TestNet

For the purposes of this tutorial, download Scatter. What’s Scatter? Scatter is cross platform compatible and is the most useful tool for your EOS Account, it’s like Metamask but for EOS and more.

If you do not have an EOS test account to connect to Scatter for this tutorial, follow the instructions below.

Create a testnet account. 
Click on the tab that says CryptoKylin Testnet. Write a 12 letter account name of your choice under where it says to create account then click the Create Account button. Save your generated keys on a separate file like notepad++.

Use the faucet. 
After you have created your account. Click on the faucet button to receive free EOS testnet tokens.

Use the Block Explorer. 
Go to this Block explorer to search for your account name to see if it exists and see if you have received EOS from the faucet as well.

Step 2: Connect the testnet to Scatter

Set the network setting first 
Go to the Settings of Scatter and click on the Network tab on the left. Click on the add button next to Networks. Choose one of the api endpoints that is shown on the EOS IDE, copy the chain ID shown on the EOS IDE, and one can find which port to connect to thru this validation site and best to check again by joining the CryptoKylin telegram group as well.

Step 3: Connect the testnet account to Scatter

Connect with your Active key.
You have 2 sets of private/public keys
. One is the owner set and the other is your active set. Never use the owner set on any device. Wallets should always use the active. This way if your active key is ever compromised, you can stop a thief from un-staking your EOS by changing your active key. (cough cough someone could mess with your demo in the middle of the hackathon)

Step 4: Compile and Deploy the Contract

Deploy the default token contract. (I used Opera browser for this.)
Actions will need to be checked off in Scatter to allow such actions.

What do the files mean by the way?
The contract is broken up into two files ‘eosio.token.cpp’ and ‘eosio.token.hpp’. The ‘.hpp’ file defines the contract class, actions and tables. An action is define by sending data to the contract and it is shown as an action when you look at the block explorers. Tables have rows, columns and indexes and that how one sees the data.

Don’t worry. The first deploy will fail due to not having enough ram.
When the deployment of the contract fails due to not having enough ram, make sure to type in the amount of bytes needed. Next, click on the Buy Ram button. Allow this action on Scatter by clicking on the check mark.

Deploy the file again.
After addressing the ram issued needed to deploy the smart contract, make sure to click on the check mark in the scatter application.

Step 5: Run the token contract.

Run the code after it is done compiling.
After the code has compiled, make sure to click on Run. Also allow this permission in Scatter for the create action.

Check the block explorer again.
Token contract was deployed on the testnet account.

One can also save the code on chain.
When the file is saved, it is saved on the testnet and you get a project ID and a link to the following contract and can embed to other examples.

Step 6: Congrats!!!

You have submitted your first token contract on the CryptoKylin testnet.
This EOS IDE is created by EOS Mediterranean and we are very thankful for the opportunity to explore the tool and share it with others.