-
Notifications
You must be signed in to change notification settings - Fork 6
Solidity Language Extended Reading
Solidity is a kind of high-level smart contract language operating on HPB main chain -- virtual machine (EVM). This language is first widely used on Ethereum main chain. Now almost all blockchain projects support Solidity language and HPB also perfectly supports this high-level language.
Solidity is an object-oriented language whose syntax is similar to that of Javascript. But as a really decentralized contract that runs on the network, it has a quite a few differences and here are some:
- Ethereum is based on account instead of UTXO, so there is a special
Address
type. It is used to locate users, contracts and contract codes (the contract itself is also an account). - Since the language embedded framework is payable, it provides some keywords, such as
payable
, which enables it to be directly payable at the language level. - Storage uses blockchain on the network and data can be permanently stored in every state, so it is necessary to decide whether the variable occupies memory or blockchain.
- The operating environment is based on a decentralized network which highlights the contract or function as the method to call. This is because a previous simple function call is replaced by code execution in a node on the network.
- The last major difference lies in its exception mechanism. In case of abnormalities, all execution will be withdrawn to maintain the atomicity of contract execution so as to avoid data inconsistency in the intermediate state.
The following is the example of a simple contract HelloWorld programmed in Solidity language:
pragma solidity ^0.4.0;
contract HelloWorld{
uint balance;
function update(uint amount) returns (address, uint){
balance += amount;
return (msg.sender, balance);
}
}
For more details about Solidity language, please visit Official English website or Official Chinese website
|中文(简体)版本 | |English Version|
Basics
R&D
- HPB-Consensus-Algorithm-Election-Mechanism
- HPB-BOE-Introduction
- HPB-Consensus-Algorithm--Compare
- HPB-Gas-Mechanism
- HPB-P2P-NetWork
- HPB-JSON-RPC-API-Index
- RLP-Agreement-Extended-Reading
- Interface-of-HPB-hardware-random-number-generator
- HPB-hardware-random-number-service
HPB Dapp Development
- Quick-Start-For-HPB-Developer
- HPB-Dapps-Introductions
- HPB-EVM-Contracts-Introductions
- HPB-Extended-Reading-on-EVM-Development
- An-Introduction-to-EVM-Virtual-Machines
- HPB-Smart-Contracts-Extended-Doc
- Best-Practice-of-Accessing-HPB-Main-Network-in-JS-version
- Best-Practice-of-HPB-Main-Network-Access-Java-Version
- Best-Practice-of-HPB-Smart-Contract
- Case-of-Transmission-from-Ethereum-DAPP-to-HPB-blockchain
- How-to-Write-a-Contract-Extended-Reading
- Development-Tool--Remix-Extended-Reading
- Solidity-Language-Extended-Reading
- Token-issuance-on-HPB-MainNet
- Migrating-a-Ethereum-DApp-to-the-HPB-MainNet
HPB Wallet Development
- An-Introduction-to-HPB-Wallet
- HPB-Wallet-for-Xcode-Integration
- Creating-the-HPB-Wallet
- Generating-Mnemonics-for-HPB Wallet
- HPB-Wallet-and-Middleware-Interface
HPB Mainnet/TestNet Entry
- HPB-Development-Node-Construction-Guild
- Guide-to-Server-Security-Reinforcement
- Build Node With Docker
- HPB-Private-Chain-Building-Guide
Developer Community