June 28, 2026

Capitalizations Index – B ∞/21M

Ethereum Developer – Tran X. Dong – Medium

Ethereum Developer – Tran X. Dong – Medium

First off, what is a Smart Contract? It’s just a piece of code that lives permanently on the blockchain. You create a Smart Contract by sending a transaction with the contract code compiled to bytecode to reduce its size. Contracts can’t be deleted but can be blocked to avoid people from executing functions on it.

The good thing about Smart Contracts is that the initial code can’t be changed. For instance, you can’t upload a Smart Contract “Example.sol” version 1 and override it with “Example.sol” version 2. The version 1 will stay there since the blockchain is immutable. Immutable means that it’s unchanging over time or unable to be changed.

What’s the purpose of a Smart Contract? It allows you to create code that acts like a real-world contract where the conditions can’t be changed. Everybody using that contract is accepting the terms and can trust it because nobody can modify the code after deploying it. It’s like signing a contract for a job and storing it in a super-secret vault that nobody can access.

Meaning that you don’t have to trust third-party companies to do what they say. You just take a look at the code and you’re guaranteed that it will do exactly what it is promising.

They are especially good when it comes to financial application since they can handle and store ether money.

Let’s start right away with how to create a Smart Contract with this language.

During all the tutorials in this book I’ll be using atom.io since it’s my favorite code editor but you can use whatever you feel like using. Sublime text and visual studio code are also very good choices.

A Smart Contract always starts with the version of Solidity that we are using. So open a text editor such as atom, create a new empty document and write the version of Solidity that will be used for this contract at the beginning of the file like this:

pragma solidity 0.4.20;

In this case I’m using the version 0.4.20 but feel free to use the latest version available. You can find the current version in the official docs: Solidity.readthedocs.io. Note that all the lines must end with a semicolon ; to be valid in Solidity.

You can also specify the latest version with the caret symbol ^ to tell the compiler that you want to use the most recent version of Solidity or the one indicated. For instance:

pragma solidity ^0.4.20;

If there’s a version 0.4.21 or bigger, the compiler will use that version instead of 0.4.20. It also depends on the compiler you’re using. Most of them allow you to change the version used at any moment.

However I don’t recommend this because you never know what version is being used when compiling the contracts and newer versions may be incompatible with the code of the contract. It’s not unusual to deprecate keywords making your contract invalid for that newer version.

For that reason, remember to not use the caret symbol when specifying the version of Solidity.

Then, you start your contract by defining the name of it with the keyword contract:

pragma solidity 0.4.20;

contract Example

You can use any name. Remember to capitalize the first letter to indicate that it is a contract. Just like classes in java.

Now you can start writing the contract logic. But before doing that, save the file with the termination .sol for instance Example.sol. This is the official Solidity file termination. Remember to name the file based on the contract name inside. For instance if you’re creating a contract called Robot it will be confusing to name the file Car.sol. Be smart and keep things simple by using the same name in the file.

At this point you know how to create the basic structure of a Smart Contract. Next, you’ll see the types of variables that you can use in a contract to store information on the blockchain.

Published at Wed, 20 Feb 2019 09:11:47 +0000

Previous Article

Bitmain Announces Its Next Gen Bitcoin and Bitcoin Cash Mining Chip

Next Article

Global Cryptocurrency Derivatives Exchange Bybit Releases Ethereum Perpetual Contract

You might be interested in …

Antonopoulos On Trust: Fake News ‘Is About To Happen To Money’

Andreas Antonopoulos has predicted that the world’s money supply will suffer the fate of information in the fake news era.


Money To Get Its Fake News Moment

In a talk originally held April 11 but republished Saturday, Antonopoulos said that in light of the multiple currency failures seen in recent times, consumers no longer know what gives cash in their pockets value. During the discussion Antonopoulos commented:

blockchain training conference Antonopoulos

What’s really interesting is what just happened in [the] news that has left an entire generation of people now unable to discern truth from fiction, easily manipulated through propaganda […] What I’m going to suggest today is this is about to happen to money.

Just like the information consumer watching television or reading news sources online, the debate about whom to trust and whether the reputation of a source means that source can be considered reliable is now transferring to the financial sector.

…And bitcoin Is Already On Consumers’ Radar

Antonopoulos highlights the currency failures in countries including Zimbabwe, Venezuela, and Ukraine as prime examples of central banks failing to uphold the promise that cash will be worth approximately the same tomorrow as today.

One day, that phrase which seemed so meaningful and strong and satisfying – ‘the full faith and credit of the United States of America’ […] – compare it to this one: ‘the full faith and credit of the National Bank of Zimbabwe.’ […] That sentence no longer has much weight to it.

In terms of bitcoin’s role in providing a haven away from trusting third party authority, Antonopoulos used India’s increased interest in the virtual currency following demonetization of 86% of its cash supply last November.

bitcoin is not going after replacing national currency; […] it’s doing something far more dangerous: it’s encouraging people to put their savings outside the system.

Germany: ‘If You Think bitcoin Is Safe As Fiat, Take Responsibility’

For those reading the news a month after Antonopoulos’ words, a warning against using bitcoin, this time from Germany’s central bank, now strikes an altogether less sincere tone.

“From our perspective bitcoin does not constitute a suitable medium for storage of wealth,” Bundesbank board member Carl-Ludwig Thiele told German newspaper, Die Welt, last weekend. “Just one look at the highly volatile exchange rate demonstrates that.”

In further comments even more ironic in light of Antonopoulos’ words about trust, Thiele continued:

Carl-Ludwig Thiele

Whoever nonetheless thinks bitcoin is as safe as the euro or dollar must take responsibility for that. All we can do is warn people about using bitcoin as a means of wealth storage.

What do you think about Andreas Antonopoulos and Carl-Ludwig Thiele’s opinions? Let us know in the comments below!


Images courtesy of Andreas Antonopoulos, Reuters, AdobeStock

The post Antonopoulos On Trust: Fake News ‘Is About To Happen To Money’ appeared first on Bitcoinist.com.