What's the best toolset to learn smart contract programming?
The main thing is which blockchain you are targeting, but if you don't have a preference there already, Ethereum should be the default choice. Not only it's the oldest (and in my opinion mature as compared to others), there is a lot of traction in the industry around Ethereum. See, for example, the members directory of Enterprise Ethereum Alliance.
So, if you are choosing Ethereum, a nice way to start programming for the Ethereum blockchain is learn Solidity. One nice thing about Solidity is the browser based Remix IDE. There are other ways, but Remix is preferred as the first exposure to Solidity and smart contracts.
Can you give me a very simply Solidity contract example?
Here is a completely impractical decentralized world-population counter in Solidity:
Basically, we have created a decentralized storage variable of type unsigned int, which is part of the blockchain. No matter which node you choose to run getCount() transaction on, and from which account, you should see the same value for a given block number in the chain.
The simple, but power example, demonstrates several key concepts that you can try out with Remix. The ledger is distributed. It's immutable. There are multiple accounts available that can each invoke transactions, and so on.
How can I run the above code in Remix?
Beyond the simple "Start to compile" button in Remix, the rest might be a bit non-intuitive. It's best to get familiar with it by watching a video tutorial, such as this one:
In very simple terms, the Run tab has a Deploy option. It also has a few pre-built accounts that you can choose for submitting you transactions. Once the smart contract is deployed, you can invoke transactions (i.e., call the public methods) and see the output.
Can you give another example?
Below is an overly simplified, distributed DSN database where a mapping between domain names and owner + IP address is maintained. It implements the following rules:
There is so much more to smart contracts and Solidity, but the above should hopefully spike your interest without exposing you to anything too challenging!
A nice starting point could be the official Solidity docs.
The main thing is which blockchain you are targeting, but if you don't have a preference there already, Ethereum should be the default choice. Not only it's the oldest (and in my opinion mature as compared to others), there is a lot of traction in the industry around Ethereum. See, for example, the members directory of Enterprise Ethereum Alliance.
So, if you are choosing Ethereum, a nice way to start programming for the Ethereum blockchain is learn Solidity. One nice thing about Solidity is the browser based Remix IDE. There are other ways, but Remix is preferred as the first exposure to Solidity and smart contracts.
Can you give me a very simply Solidity contract example?
Here is a completely impractical decentralized world-population counter in Solidity:
Basically, we have created a decentralized storage variable of type unsigned int, which is part of the blockchain. No matter which node you choose to run getCount() transaction on, and from which account, you should see the same value for a given block number in the chain.
The simple, but power example, demonstrates several key concepts that you can try out with Remix. The ledger is distributed. It's immutable. There are multiple accounts available that can each invoke transactions, and so on.
How can I run the above code in Remix?
Beyond the simple "Start to compile" button in Remix, the rest might be a bit non-intuitive. It's best to get familiar with it by watching a video tutorial, such as this one:
In very simple terms, the Run tab has a Deploy option. It also has a few pre-built accounts that you can choose for submitting you transactions. Once the smart contract is deployed, you can invoke transactions (i.e., call the public methods) and see the output.
Can you give another example?
Below is an overly simplified, distributed DSN database where a mapping between domain names and owner + IP address is maintained. It implements the following rules:
- An owner can register a domain only if it hasn't been registered already.
- The IP for a given domain name can only be set by the owner.
- Anyone can lookup the IP based on the domain name.
There is so much more to smart contracts and Solidity, but the above should hopefully spike your interest without exposing you to anything too challenging!
A nice starting point could be the official Solidity docs.
Comments
Post a Comment