Getting started programming in Solidity to create smart contracts on Ethereum can sound like a difficult challenge. However, in this article we want to show you how easy it is to start developing smart contracts by offering you resources and a brief entry into the world of programming this powerful language.
CAs we have already mentioned, Solidity is the name of a high-level programming language, very similar to the well-known JavaScript, used for Web programming. This language is used to program smart contracts or smart contracts for the blockchain of Ethereum, which will be executed by the EVM.
More specifically, Solidity is a high-level language that allows us to easily program for EVM and which can then be compiled bytecode to finally run on the Ethereum Virtual Machine. Being a high-level language, it means that developers have a simple tool to program. Thus avoiding the difficulty of programming using OP_CODES or operation codes, or bytecode directly, something that does occur in Bitcoin.
As a result, the creation of decentralized applications (DApps) It is a much easier task to carry out, review and test, being available to anyone with basic programming knowledge.
Get started on Bit2Me and jump into the world of cryptocurrencies with a head start. Sign up easily and get €5 FREE on your first purchase with this link. Don't wait any longer to join the crypto revolution! Register
Tools to start programming in Solidity
Documentation and books on Solidity
If you have programming experience, you surely know the importance of having a good official documentation on the possibilities of the programming language you are using. Well, this premise is fully met with Solidity. First of all, the official Solidity documentation is excellent. In its official website You can find all the technical information you need about the potentialities and improvements that this language presents with each new version. In addition, the development and improvement of the language is constant, showing that the community seeks to improve and implement new functions to make DApps programming easier and safer.
If what you want is to program in Solidity and you already have prior knowledge of programming and development in other languages, this is the first place you should go. If, on the other hand, you do not have programming and development knowledge, you must first know the basic forms and operations of programming languages to then start your learning process about Solidity.
On the other hand, two of the most important books devoted to development in Solidity are Solidity Programming Essentials by Ritesh Modi and Ethereum Smart Contract Development by Mayukh Mukhopadhyay. Both books have been published by Packt and are intended to transform those interested in the world of Solidity programming from being beginners to advanced programmers in this language. If you want to know even more about Ethereum then you can complement your reading with Mastering Ethereum written by Andreas Antonopoulos and Gavin Wood.
If you put all these reading elements together then you will begin to understand very well what Ethereum is and how you can effectively use Solidity to program your first DApp and perhaps hopefully change the world for the better.
Tools for programming and debugging
Now, knowing the theoretical part is just a first step to start your way to program in Solidity. But it is a worthless step if you are not able to bring that theoretical knowledge to practicality.
To make this possible, you must have tools to program and debug what you write in this language. In that case, IDEs or Integrated Development Environment, will be your tool to achieve this.
An IDE is a program that has an integrated series of tools that will make your work of programming in a certain language easier. These IDEs generally contain syntax checkers, library integration, error locators, and modes that allow you to test your application before deploying it publicly.
In the case of Ethereum, there are two large IDEs officially supported by the community. The first one is Remix. Remix is a web IDE that we can use from our browser and with which we can program and test our applications written in Solidity without having to install anything.
Another tool widely used in the development world on Ethereum and Solidity is Truffle. In fact, Truffle is by far the best-integrated tool in the Ethereum world for Solidity programming. But on the other hand, the amount of Truffle options makes it a complex tool to use, especially if you are just starting to learn, so it is only recommended for people with more advanced knowledge.
On the other side is ETHFiddle, a simple website that allows you to execute code written in Solidity and learn to program in the least complex way possible. However, if what you want is to create your own programming environment using some other tool, you can also do it.
There are other IDEs and plugins that allow you to do this. For example, IntelliJ IDEA is an IDE for multiple programming languages, specially thought for programming in Java, but it can also be used to program using Solidity. Other development tools like Atom o Visual Studio Code they also allow you to install plugins that enable programming using Solidity. In any of these cases, you will have everything you need to be able to build your Solidity code.
Simulation tools
Another vital tool for scheduling is having access to the testnet of Ethereum. This is necessary since you should be able to test your application in an environment very similar to the real one, but where no trial or error costs you money.
To do this you can install an Ethereum node and follow the configuration steps to work on any of the Ethereum testnets, or access the testnet networks using a deployer (deployer) with that capacity for the IDE you are using. The use of a testnet network will allow you to put your DApp in an environment very similar to the one you would find in the main Ethereum network, and thus verify that it works correctly at all times.
However, an easier way to achieve this is Ganache. Ganache is a tool that allows you to simulate a full Ethereum node without the associated costs of having a node that maintains an entire blockchain on your computer. Thanks to this, Ganache is a much simpler tool, faster to use and that obtains the same results. In addition, it has extensive integration with Truffle and is easily integrable with other IDEs.
Monitoring and security analysis tools
While blockchain technology is very secure, security is something that requires proactivity at all times. For that reason, the community behind Ethereum and Solidity has created a series of analysis tools that help to greatly improve the security of the code written for our smart contracts, thereby preventing bugs from escaping us and ending up causing losses to our users.
Tools like MythX, Mythrill o Alethio are some of the most powerful options in this sense, allowing you powerful security analysis (for the cases of MythX and Mythril) and for the monitoring of your smart contracts (in the case of Alethio).
Other learning resources
Of course, this is only a small part of the universe of options that exist in the Ethereum community. In that case, one of the most complete compilations of tools and learning resources for Ethereum and Solidity can be found in this repository of ConsenSys. Here you can access different resources of great relevance in the community to learn to the fullest how to program in Solidity and get the most out of your knowledge in this language.
But what if instead of just naming tools we show you the potential of Solidity in a simple example? Well, if you like the idea you just have to continue reading.
Our first experience with Solidity
For our first Solidity programming we will use Remix.
Our choice of this tool responds to the fact that it allows us to test the code we write very easily, as well as giving us simple debugging outputs and the ease of using different versions of Solidity. In that case, the first thing you should do is go to this website and select the plugin Solidity in order to have all the programming and debugging options for this language.
Once you have the “Solidity” plugin active you will be able to see the next section of information, and we can proceed to create our first program in Solidity. For this you must go to "File Explorer" and add a new file that we will call "HelloWorld.sun".
Ok now that we have our code written in Remix, we proceed to compile and run it. We can do that by filling the section Solidity Compiler. In this section we will only have to be attentive to the version of Solidity that we will use to compile which must be among the parameters of the smart contract pragma. That is, we must select any version of Solidity between 0.5.0 and 0.7.0. Once this is done, all you have to do is press the button "Compile HelloWorld.sun."
The next thing will be to carry out the deployment of the smart contract, which we can do by going to the section "Deploy & Run", in which we must click on "Deploy". Deploying a contract has a cost in Ethereum, since a real transaction is issued with the information. However, being in a testnet, those ether will have no real cost.
In response we will get the following response:
Finally we can see that our function get () is available to interact with her. If we click on it, we interact and we will get the expected output (our message).
To see the full message, we can click on the button debug and so we can see all the output. In this output, we can see the message that we have put in the contract.
Avoid programming by programming
It is true that the best way to learn something is by doing it. And it is important that you program, but try to make sense of what you do. So try to do it with a project idea in mind, with this you will find yourself facing real situations to solve.
To find good ideas it is important to soak up the culture that surrounds all blockchain technology. A technology that has been created to decentralize everything decentralized. Surely, as soon as you think, you will find situations where a few monopolize power, make decisions unilaterally and all this without transparency.
Remember that blockchain technology has been created to make a more just, democratic and transparent planet. All this regardless of who falls through: governments, kings, religions, corporations, ... Do not be afraid to stand up to whatever you consider unfair.
Click here to open your user account in Spanish for FREE and securely and receive a €5 gift.