30 seconds to build and test an ICO on NEO

Igor Machado
NeoResearch
Published in
4 min readJul 27, 2018

New technologies are usually challenging due to a lack of tools and tutorials, but these are also where the best opportunities arise :)

NEO blockchain is the #1 choice for many projects due to its superior scalability and the possibility of coding a smart contract in your preferred programming language. For those interested in building an ICO on NEO, here is a tutorial on how to do it… and hopefully, we can do that in 30 seconds!

NEO ecosystem comprises several projects (in different programming languages) and NeoResearch open-source group is bonding all of them together in a single project called NeoCompiler Eco. This project comes with compilers for many programming languages including C#, Python, Java and Go, and also a configurable private net (which is better for testing because you don’t actually spend any valuable GAS). You can install Eco in your computer (as an open-source project) or simply access our public website: https://neocompiler.io (we reset it every 12 hours, so please don’t leave anything valuable there!)

Clock starts: 00:00:30

Our example will be based on C# language (but could be any other) and the official ICO_Template. You can select it on Eco dropdown list, or just copy and paste it there.

Selecting C# “ICO_Template” example at NeoCompiler Eco

You can adjust the ICO owner Address on line public static readonly byte[] Owner = "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y".ToScriptHash(); and all other configurations such as token name (we chose “NeoResearch Token”) Start and End times, total amount of the token, etc.

After everything is fine, click “Compile” (it’s usually spending 3 to 6 seconds, so let’s take 6).

Countdown: 00:00:24

Quickly, go to “Network” tab and we can find a “Deploy” screen. We are lucky, because all “strange” configurations are all set up for us, such as contract parameters (“0710” which means we are accepting a String and Array in Main function), return type 05 (byte array), and we will spend GAS from wallet_0 (which corresponds to the address we provided as our contract owner). Let’s select box “Storage” and click “Deploy JS”, which means we are paying extra GAS to keep information in NEO Storage (information such as who owns how much tokens, etc). Don’t worry, Eco network has enough GAS for us all (it resets automatically every 12 hours) and it usually takes less than 8 seconds to perform the operation (let’s subtract 8 from our clock).

Selecting “Storage” means we are paying 490 GAS for the smart contract

Countdown: 00:00:16

Transaction is validated in less than 8 seconds on average on Eco network (NEO private net)

Time is short now, only 16 seconds to see if our contract works! In the “interaction” screen you can easily invoke a function from your smart contract (by the way, remember that every contract has a unique script hash, ours is 0xe110869da9ac98b6ad31a0c96a5ea4c83828fb10). Let’s invoke C# contract function Name() by selecting name on function list. The invocation JSON is already filled for us, and we are ready to click “Invoke JS”.

Selecting function invoke “name” from the dropdown list

Countdown: 00:00:08

Invocation transaction is validated in few seconds

After few seconds we can check that invoke transaction is fine, so you can click the question mark button “?”, that will redirect you to the RPC call box. An RPC call “getapplicationlog” was automatically performed to our servers and the result of the operation is byte array 4e656f526573656172636820546f6b656e.

Performed RPC call “getapplicationlog” to transaction “4746…” and got bytearray result from invoke

Now we have 8 seconds to discover what this byte array means… in “Conversors” tab, find “String <-> Hex” box and fill the Hex side with this unusual output. Magically, we have the result of the name operation: NeoResearch token .

Hex to String converter on Eco platform

If you want to check out if the transactions really happened, just visit Eco private net blockchain explorer, all your operations will be recorded there: https://neoscan.neocompiler.io/transactions/1

Finally, if you want to do the same process on the “real” NEO MainNet (or in TestNet), you can still do that in 30 seconds! Just change the target network box on top (from “neocompiler.io”, or “localhost”, to anything else…), add your wallet address in Eco with “real” GAS and get it done (obviously, for real GAS spending we recommend to use external tools/wallets that are considered much safer for real scenarios).

Countdown: 00:00:00

We hope you have enjoyed the rest of the 30 seconds to make more tests, experiment with other function invokes on ICO template, different parameter passing and enjoy a little bit more of this nice open-source blockchain ecosystem :)

--

--