
Decentralized Programmer: Solidity 101
Solidity primer
What is solidity?
Solidity is a contract-oriented, high-level language for implementing smart contracts. It was influenced by C++, Python and JavaScript and is designed to target the Ethereum Virtual Machine (EVM). Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
Source: https://solidity.readthedocs.io/en/v0.4.25/
Best IDE
Remix: http://remix.ethereum.org
Smart contracts basics
pragma solidity ^0.4.0; //Version of solidity
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
Explanation:
pragma solidity ^0.4.0 Version of solidity
contract SimpleStorage Contract is a collection of code, functions and data. Contract resides on a specific address on Ethereum blockchain
uint storedData Unsigned Integer that represents some data.
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
Getters and setters. What's interesting the visibility of the function is declared after the list of arguments. The keyword view indicates that method get() won't modify the state of the contract.
Leave Decentralized Programmer: Solidity 101 to:
Read more #solidity posts
Best Posts From cryptoizotx
We have not curated any of cryptoizotx's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From cryptoizotx
- Keyframe animations with Swift
- One algorithm a day: Keeping track of the largest element in a stack
- One algorithm a day. Write a function that returns best profit you could made from trading.
- One algorithm a day: floor of the square root of the input
- iOS Interview: Delegation Pattern in Swift
- Delegation Pattern in Objective-C
- Swift Interview Questions Recursion: Print numbers from 0 to n without using for loop.
- Bitwise Operators in Swift
- S O L I D Principle Rules in iOS
- Decentralized Programmer: Solidity 101