以太坊系列之十四: solidity特殊函数

简介:  solidity中的特殊函数括号里面有类型和名字的是参数,只有类型是返回值.block.blockhash(uint blockNumber) returns (bytes32): hash of the given block - onlyworks for 256 most recent blocksblock.

 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
目录
相关文章
|
SQL Dubbo Java
案例分析|线程池相关故障梳理&总结
本文作者梳理和分享了线程池类的故障,分别从故障视角和技术视角两个角度来分析总结,故障视角可以看到现象和教训,而技术视角可以透过现象看到本质更进一步可以看看如何避免。
84907 136
案例分析|线程池相关故障梳理&总结
|
11月前
|
机器学习/深度学习 人工智能 自然语言处理
深度学习中的卷积神经网络(CNN)及其在图像识别中的应用
本文旨在通过深入浅出的方式,为读者揭示卷积神经网络(CNN)的神秘面纱,并展示其在图像识别领域的实际应用。我们将从CNN的基本概念出发,逐步深入到网络结构、工作原理以及训练过程,最后通过一个实际的代码示例,带领读者体验CNN的强大功能。无论你是深度学习的初学者,还是希望进一步了解CNN的专业人士,这篇文章都将为你提供有价值的信息和启发。
|
消息中间件 设计模式 Java
Spring 四种方式教你异步接口返回结果
Spring 四种方式教你异步接口返回结果
Spring 四种方式教你异步接口返回结果
|
SQL DataWorks 安全
DataWorks产品使用合集之怎么注释代码块
DataWorks作为一站式的数据开发与治理平台,提供了从数据采集、清洗、开发、调度、服务化、质量监控到安全管理的全套解决方案,帮助企业构建高效、规范、安全的大数据处理体系。以下是对DataWorks产品使用合集的概述,涵盖数据处理的各个环节。
343 0
|
传感器 大数据 物联网
大数据类型与特征
【4月更文挑战第9天】大数据包含交易、人为、移动及机器传感器数据,特征表现为大量、高速、多样、可变、真实、复杂和有价值。它影响商业决策、市场分析和科学研究,展现巨大潜力。
439 3
|
关系型数据库 MySQL Serverless
【随手记】MySQL窗口函数计算累加和
【随手记】MySQL窗口函数计算累加和
861 0
|
缓存 关系型数据库 MySQL
MySQL数据库性能优化实战
【4月更文挑战第30天】本文探讨了MySQL性能优化实战技巧,包括硬件与配置优化(如使用SSD、增加内存和调整配置参数)、索引优化(创建合适索引、使用复合索引及定期维护)、查询优化(避免全表扫描、减少JOIN和使用LIMIT)、分区与分片(表分区和数据库分片),以及使用缓存、定期清理数据库和监控诊断。通过这些方法,可以提升数据库性能和响应速度。
|
监控 Java 数据库
java线上服务问题排查总结
java线上服务问题排查 1、业务日志相关 如果应用系统出现异常,一般都会在业务日志中体现 查看日志问题常用命令,以标装springboot应用为例: 进到标装日志目录:cd /wls/applogs/rtlog/spri* --善用tab键 统计当天业务日志中ERROR出现数量:egre.
47466 0