A literal number can take a suffix of wei, finney, szabo or ether to convert between the subdenominations of Ether, where Ether currency numbers without a postfix are assumed to be Wei, e.g. 2ether==2000finney evaluates to true.

Suffixes like seconds, minutes, hours, days, weeks and
years after literal numbers can be used to convert between units of time where seconds are the base
unit and units are considered naively in the following way:

1==1seconds

1minutes==60seconds

1hours==60minutes

1days==24hours

1weeks==7days

1years==365days

Take care if you perform calendar calculations using these units, because
not every year equals 365 days and not even every day has 24 hours
because of leap seconds.
Due to the fact that leap seconds cannot be predicted, an exact calendar
library has to be updated by an external oracle.

These suffixes cannot be applied to variables. If you want to
interpret some input variable in e.g. days, you can do it in the following way:

block.blockhash(uintblockNumber)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

gasleft()returns(uint256): remaining gas

msg.data (bytes): complete calldata

msg.gas (uint): remaining gas - deprecated in version 0.4.21 and to be replaced by gasleft()

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)

Note

The values of all members of msg, including msg.sender and
msg.value can change for every external function call.
This includes calls to library functions.

Note

Do not rely on block.timestamp, now and block.blockhash as a source of randomness,
unless you know what you are doing.

Both the timestamp and the block hash can be influenced by miners to some degree.
Bad actors in the mining community can for example run a casino payout function on a chosen hash
and just retry a different hash if they did not receive any money.

The current block timestamp must be strictly larger than the timestamp of the last block,
but the only guarantee is that it will be somewhere between the timestamps of two
consecutive blocks in the canonical chain.

Note

The block hashes are not available for all blocks for scalability reasons.
You can only access the hashes of the most recent 256 blocks, all other
values will be zero.

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)) and
keccak256(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.

There are some dangers in using send: The transfer fails if the call stack depth is at 1024
(this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order
to make safe Ether transfers, always check the return value of send, use transfer or even better:
Use a pattern where the recipient withdraws the money.