Ether (ETH) is a cryptocurrency. Ether is also used to pay fees for using the Ethereum network, like making transactions in the form of sending Ether to an address or interacting with an Ethereum application.
To specify a unit of Ether, we can add the suffixes wei
, gwei
, or ether
to a literal number.
Wei is the smallest subunit of Ether, named after the cryptographer Wei Dai. Ether numbers without a suffix are treated as wei
(line 7).
One gwei
(giga-wei) is equal to 1,000,000,000 (10^9) wei
.
One ether
is equal to 1,000,000,000,000,000,000 (10^18) wei
(line 11).
Watch a video tutorial on Ether and Wei.
- Create a
public
uint
calledoneGwei
and set it to 1gwei
. - Create a
public
bool
calledisOneGwei
and set it to the result of a comparison operation between 1 gwei and 10^9.
Tip: Look at how this is written for gwei
and ether
in the contract.