以太坊系列之十四: solidity特殊函数
solidity中的特殊函数
括号里面有类型和名字的是参数,只有类型是返回值.
- block.blockhash(uint blockNumber) returns (bytes32): hash of the given block - only
works for 256 most recent blocks - 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
- msg.data (bytes): complete calldata
- msg.gas (uint): remaining gas
- msg.sender (address): sender of the message (current call)
- 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
6.4. Solidity in Depth 99Solidity Documentation, 0.4.10 - tx.origin (address): sender of the transaction (full call chain)
- revert(): abort execution and revert state changes
- keccak256(...) returns (bytes32): compute the Ethereum-SHA-3 (Keccak-256) hash of the
(tightly packed) arguments - sha3(...) returns (bytes32): an alias to keccak256()
- sha256(...) returns (bytes32): compute the SHA-256 hash of the (tightly packed) arguments
- ripemd160(...) returns (bytes20): compute the RIPEMD-160 hash of the (tightly packed) arguments
- ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address):
recover address associated with the public key from elliptic curve signature, return zero on error - 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 multiplication is performed with arbitrary precision and does not wrap around at 2**256
- this (current contract’s type): the current contract, explicitly convertible to address
- super: the contract one level higher in the inheritance hierarchy
- selfdestruct(address recipient): destroy the current contract, sending its funds to the given address
- .balance (uint256): balance of the Address in Wei
- .send(uint256 amount) returns (bool): send given amount of Wei to Address, returns false on failure
- .transfer(uint256 amount): send given amount of Wei to Address, throws on failure
以太坊系列之十四: solidity特殊函数的更多相关文章
- 以太坊系列之十二: solidity变量存储
solidity中变量的存储 变量存储主要分为两个区域,一个是storage(对应指定是SLOAD,SSTORE),一个是Memory(MLOAD,MSTORE), 这和普通编程语言的内存模型是不一样 ...
- 以太坊系列之十六: 使用golang与智能合约进行交互
以太坊系列之十六: 使用golang与智能合约进行交互 以太坊系列之十六: 使用golang与智能合约进行交互 此例子的目录结构 token contract 智能合约的golang wrapper ...
- 以太坊系列之十六:golang进行智能合约开发
以太坊系列之十六: 使用golang与智能合约进行交互 以太坊系列之十六: 使用golang与智能合约进行交互 此例子的目录结构 token contract 智能合约的golang wrapper ...
- 以太坊系列之十八: 百行go代码构建p2p聊天室
百行go代码构建p2p聊天室 百行go代码构建p2p聊天室 1. 上手使用 2. whisper 原理 3. 源码解读 3.1 参数说明 3.1 连接主节点 3.2 我的标识 3.2 配置我的节点 3 ...
- Chrome浏览器扩展开发系列之十四
Chrome浏览器扩展开发系列之十四:本地消息机制Native messaging 时间:2015-10-08 16:17:59 阅读:1361 评论:0 收藏:0 ...
- webpack4 系列教程(十四):Clean Plugin and Watch Mode
作者按:因为教程所示图片使用的是 github 仓库图片,网速过慢的朋友请移步<webpack4 系列教程(十四):Clean Plugin and Watch Mode>原文地址.更欢迎 ...
- 第一行代码:以太坊(2)-使用Solidity语言开发和测试智能合约
智能合约是以太坊的核心之一,用户可以利用智能合约实现更灵活的代币以及其他DApp.不过在深入讲解如何开发智能合约之前,需要先介绍一下以太坊中用于开发智能合约的Solidity语言,以及相关的开发和测试 ...
- 以太坊智能合约介绍,Solidity介绍
以太坊智能合约介绍,Solidity介绍 一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. Storage contract SimpleSt ...
- OSGi 系列(十四)之 Event Admin Service
OSGi 系列(十四)之 Event Admin Service OSGi 的 Event Admin 服务规范提供了开发者基于发布/订阅模型,通过事件机制实现 Bundle 间协作的标准通讯方式. ...
随机推荐
- 多路复用IO
多路复用IO(IO multiplexing) IO multiplexing这个词可能有点陌生,但是如果我说select/epoll,大概就都能明白了.有些地方也称这种IO方式为事件驱动IO (ev ...
- 虚拟机在 OpenStack 里没有共享存储条件下的在线迁移
虚拟机在 OpenStack 里没有共享存储条件下的在线迁移 本文尝试回答与 Live migration 相关的几个问题:Live migration 是什么?为什么要做 Live migratio ...
- C# IP地址去掉端口号
string Ip1 = "192.168.0.199:7777"; string Ip2 = Ip1.Remove(Ip1.IndexOf(':'));
- leetcode682
class Solution { public: int calPoints(vector<string>& ops) { stack<int> ST; ; for ( ...
- Logstash安装和设置(图文详解)(多节点的ELK集群安装在一个节点就好)
前提 Elasticsearch-2.4.3的下载(图文详解) Elasticsearch-2.4.3的单节点安装(多种方式图文详解) Elasticsearch-2.4.3的3节点安装(多种方式图文 ...
- iOS坑爹的could not find any information for class named xxx
关掉项目也无法解决,最后把文件delete掉,然后选“Remove Reference”,这样就不会真正删除文件.接着选“File -> Add Files to ...”添加回来就可以了.
- solrcloud使用问题记录
Solr Ping query caused exception: undefined field text [java] view plaincopy <span style="fo ...
- Leetcode:Merge k Sorted Lists分析和实现
题目大意是传入一个链表数组lists,每个链表都由若干个链接的链表结点组成,并且每个链表结点记录一个整数.题目保证传入的链表中的整数按从小到大进行排序. 题目要求我们输出一个新的链表,这个链表中应该包 ...
- 2-python代码坑点
#切片: # L = ['aaa', 'bbb', 'ccc', 'ddd'] # print(L[1 : 3]) #取[1, 3):下标 # L = list(range(100)) # print ...
- Docker 学习笔记_安装和使用MongoDB
一.准备 1.宿主机OS:Win10 64 2.虚拟机OS:Ubuntu18.04 3.账号:docker 二.安装 1.搜索MongoDB镜像 ...