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)
In the above, “tightly packed” means that the arguments are concatenated without padding. This means that the following are all identical:
keccak256("ab", "c")keccak256("abc")keccak256(0x616263)keccak256(6382179)keccak256(97, 98, 99)
If padding is needed, explicit type conversions can be used: keccak256("\x00\x12")is the same as keccak256(uint16(0x12)).
Note that constants will be packed using the minimum number of bytes required to store them. This means that, for example, keccak256(0) == keccak256(uint8(0)) andkeccak256(0x12345678) == keccak256(uint32(0x12345678)).
It might be that you run into Out-of-Gas for sha256, ripemd160 or ecrecover on a private blockchain. The reason for this is that those are implemented as so-called precompiled contracts and these contracts only really exist after they received the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution runs into an Out-of-Gas error. A workaround for this problem is to first send e.g. 1 Wei to each of the contracts before you use them in your actual contracts. This is not an issue on the official or test net.
<address>.call(...) returns (bool):
issue low-level CALL, returns false on failure, forwards all available gas, adjustable
<address>.callcode(...) returns (bool):
issue low-level CALLCODE, returns false on failure, forwards all available gas, adjustable
<address>.delegatecall(...) returns (bool):
issue low-level DELEGATECALL, returns false on failure, forwards all available gas, adjustable
In Units and Globally Available Variables, all bellow is not supported in Array:
Ether Units https://github.com/arrayio/array-io-solidity/blob/master/units-and-global-variables.rst#ether-units
Time Units https://github.com/arrayio/array-io-solidity/blob/master/units-and-global-variables.rst#time-units
In Block and Transaction Properties, following code: https://github.com/arrayio/array-io-solidity/blob/master/units-and-global-variables.rst#block-and-transaction-properties
block.coinbase (address): current block miner’s address
block.difficulty (uint)
: current block difficultygasleft()
returns (uint256
): remaining gasmsg.data (bytes):
complete calldatamsg.gas (uint)
: remaining gas - deprecated in version 0.4.21 and to be replaced bygasleft()
msg.sig (bytes4)
: first four bytes of the calldata (i.e. function identifier)now (uint)
: current block timestamptx.gasprice (uint)
: gas price of the transactiontx.origin (address)
: sender of the transaction (full call chain)keccak256(...)
until the next subsection): https://github.com/arrayio/array-io-solidity/blob/master/units-and-global-variables.rst#mathematical-and-cryptographic-functionskeccak256(...)
returns (bytes32): compute the Ethereum-SHA-3 (Keccak-256) hash of the (tightly packed) argumentssha256(...)
returns (bytes32): compute the SHA-256 hash of the (tightly packed) argumentssha3(...)
returns (bytes32): alias to keccak256ripemd160(...)
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) In the above, “tightly packed” means that the arguments are concatenated without padding. This means that the following are all identical:keccak256("ab", "c")
keccak256("abc")
keccak256(0x616263)
keccak256(6382179)
keccak256(97, 98, 99)
If padding is needed, explicit type conversions can be used:keccak256("\x00\x12")
is the same askeccak256(uint16(0x12))
. Note that constants will be packed using the minimum number of bytes required to store them. This means that, for example,keccak256(0) == keccak256(uint8(0)) andkeccak256(0x12345678) == keccak256(uint32(0x12345678)).
It might be that you run into Out-of-Gas for sha256, ripemd160 or ecrecover on a private blockchain. The reason for this is that those are implemented as so-called precompiled contracts and these contracts only really exist after they received the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution runs into an Out-of-Gas error. A workaround for this problem is to first send e.g. 1 Wei to each of the contracts before you use them in your actual contracts. This is not an issue on the official or test net.<address>.call(...)
returns (bool): issue low-level CALL, returns false on failure, forwards all available gas, adjustable<address>.callcode(...)
returns (bool): issue low-level CALLCODE, returns false on failure, forwards all available gas, adjustable<address>.delegatecall(...)
returns (bool): issue low-level DELEGATECALL, returns false on failure, forwards all available gas, adjustable