单位和全局变量

Ether Units: wei, finney, szabo, ether

Time Units:
1 == 1 seconds
1 minutes == 60 seconds
1 hours == 60 minutes
1 days == 24 hours
1 weeks == 7 days
1 years == 365 days function f(uint start, uint daysAfter) public {
if (now >= start + daysAfter * 1 days) {
// ...
}
}

专用变量和函数

 block.blockhash(uint blockNumber) returns (bytes32): hash of the given block - only works for 256 most recent blocks excluding current
block.coinbase (address): current block miner’s address
block.difficulty (uint): current block difficulty
block.gaslimit (uint): current block gaslimit
block.number (uint): current block number
block.timestamp (uint): current block timestamp as seconds since unix epoch
msg.data (bytes): complete calldata
msg.gas (uint): remaining gas
msg.sender (address): sender of the message (current call)
msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier)
msg.value (uint): number of wei sent with the message
now (uint): current block timestamp (alias for block.timestamp)
tx.gasprice (uint): gas price of the transaction
tx.origin (address): sender of the transaction (full call chain)

错误处理

assert(bool condition): throws if the condition is not met - to be used for internal errors.

require(bool condition): throws if the condition is not met - to be used for errors in inputs or external components.

revert(): abort execution and revert state changes


####数字与加密函数
```bash
addmod(uint x, uint y, uint k) returns (uint): compute (x + y) % k where the addition is performed with arbitrary precision and does not wrap around at 2**256.
mulmod(uint x, uint y, uint k) returns (uint): compute (x * y) % k where the multiplica-tion is performed with arbitrary precision and does not wrap around at 2**256. keccak256(...) returns (bytes32): compute the Ethereum-SHA-3 (Keccak-256) hash of the (tightly packed) arguments
sha256(...) returns (bytes32): compute the SHA-256 hash of the (tightly packed) arguments
sha3(...) returns (bytes32): alias to keccak256
ripemd160(...) returns (bytes20): compute RIPEMD-160 hash of the (tightly packed) arguments ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address):
recover the address associated with the public key from elliptic curve signature or return zero on error (example usage)

地址相关

<address>.balance (uint256): balance of the Address in Wei
<address>.transfer(uint256 amount): send given amount of Wei to Address, throws on failure
<address>.send(uint256 amount) returns (bool): send given amount of Wei to Address, returns false on failure
<address>.call(...) returns (bool): issue low-level CALL, returns false on failure <address>.callcode(...) returns (bool): issue low-level CALLCODE, returns false on failure
<address>.delegatecall(...) returns (bool): issue low-level DELEGATECALL, returns false on failure

合约相关

this (current contract’s type): the current contract, explicitly convertible to Address
selfdestruct(address recipient): destroy the current contract, sending its funds to the given Address
suicide(address recipient): alias to selfdestruct Furthermore, all functions of the current contract are callable directly including the current function.

solidity语言7的更多相关文章

  1. 用solidity语言开发代币智能合约

    智能合约开发是以太坊编程的核心之一,而代币是区块链应用的关键环节,下面我们来用solidity语言开发一个代币合约的实例,希望对大家有帮助. 以太坊的应用被称为去中心化应用(DApp),DApp的开发 ...

  2. 第一行代码:以太坊(2)-使用Solidity语言开发和测试智能合约

    智能合约是以太坊的核心之一,用户可以利用智能合约实现更灵活的代币以及其他DApp.不过在深入讲解如何开发智能合约之前,需要先介绍一下以太坊中用于开发智能合约的Solidity语言,以及相关的开发和测试 ...

  3. Solidity语言系列教程

    Solidity 是一门面向合约的.为实现智能合约而创建的高级编程语言.这门语言受到了 C++,Python 和 Javascript 语言的影响,设计的目的是能在 以太坊虚拟机(EVM) 上运行. ...

  4. solidity语言介绍以及开发环境准备

    solidity语言介绍以及开发环境准备   Solidity 是一门面向合约的.为实现智能合约而创建的高级编程语言.这门语言受到了 C++,Python 和 Javascript 语言的影响,设计的 ...

  5. 用C++生成solidity语言描述的buchi自动机的初级经验

    我的项目rvtool(https://github.com/Zeraka/rvtool)中增加了生成solidity语言格式的监控器的模块. solidity特殊之处在于,它是运行在以太坊虚拟机环境中 ...

  6. Solidity语言基础 和 Etherum ERC20合约基础

    1. 类型只能从第一次赋值中推断出来,因此以下代码中的循环是无限的,  小. for (var i = 0; i < 2000; i++) { ... } --- Solidity Types ...

  7. solidity语言

    IDE:Atom 插件:autocomplete-solidity 代码自动补齐   linter-solium,linter-solidity代码检查错误   language-ethereum支持 ...

  8. solidity语言14

    库(Libraries) 库类似合约,实现仅在专门地址部署一次,使用EVM的DELEGATECALL的功能重复使用的目的.意思是当库函数被调用后,代码执行在被调用的合约的环境.例如,使用this调用合 ...

  9. solidity语言13

    函数过载 合约内允许定义同名函数,但是输入参数不一致 pragma solidity ^0.4.17; contract A { function f(uint _in) public pure re ...

  10. solidity语言12

    View Functions 函数声明为视图,将无权修改状态 pragma solidity ^0.4.16; contract C { function f(uint a, uint b) publ ...

随机推荐

  1. Tensorlflow-神经网络解决非线性回归问题

    import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt #使用numpy生成200个随机点,范围从-0.5到0 ...

  2. 可持久化Treap 赛前摸鱼笔记

    1.基本结构 随机化工具 unsigned int SEED = 19260817; //+1s inline int Rand(){ SEED=SEED*1103515245+12345; retu ...

  3. [转] Akka实战:构建REST风格的微服务

    [From] http://www.yangbajing.me/2015/11/27/akka%E5%AE%9E%E6%88%98%EF%BC%9A%E6%9E%84%E5%BB%BArest%E9% ...

  4. 处女座和他的小姐姐(三)----数位DP

    链接:https://ac.nowcoder.com/acm/contest/329/G来源:牛客网 经过了选号和漫长的等待,处女座终于拿到了给小姐姐定制的手环,小姐姐看到以后直呼666! 处女座其实 ...

  5. EntityFramework 并发处理

    转载自:http://www.cnblogs.com/TianFang/p/4439215.html 什么是并发? 并发分悲观并发和乐观并发. 悲观并发:比如有两个用户A,B,同时登录系统修改一个文档 ...

  6. PIE SDK波段合成

    1.算法功能简介 波段合成功能主要用于将多幅图像合并为一个新的多波段图像(即波段的叠加打包,构建一个新的多波段文件),从而可根据不同的用途选择不同波长范围内的波段合成 RGB 彩色图像. PIE支持算 ...

  7. 3---Django rest framework源码分析(3)----节流

    Django rest framework源码分析(3)----节流 目录 添加节流 自定义节流的方法  限制60s内只能访问3次 (1)API文件夹下面新建throttle.py,代码如下: # u ...

  8. TT 安装之 Windwos

    WINDOWS在 控制面板-〉管理工具-〉本地安全策略-〉本地策略-〉用户权限分配-〉锁定内存页-〉添加用户或组-〉高级查找 然后确定 然后安装 (WINDOWS在 控制面板-〉管理工具-〉ODBC工 ...

  9. vue自定义指令clickoutside使用以及扩展用法

    vue自定义指令clickoutside使用以及扩展用法 产品使用vue+element作为前端框架.在功能开发过程中,难免遇到使用element的组件没办法满足特殊的业务需要,需要对其进行定制,例如 ...

  10. PIXI 根据点走地图(8)

    先了解下数学公式例如: 图已知:a.b两点的坐标, c到a的距离d .求c点的坐标.   求 cy 可以根据d / a到b距离 = a到c垂直距离 / a 到 b的垂直距离.   首先求a到b的距离 ...