The simplest transaction is transferring ETH from one account to another. We can use wallet to send transactions.
Set your private key, see section to learn how to generate one.
Create a wallet from the privateKey, and pass the provider. So we can send transactions using this wallet later.
Construct a transaction object.
to is the address of the recipient.
value is the amount of ETH to send. The unit is wei(1 ETH = 10^18 wei).
ethers.utils.parseEther to convert to wei.
sendTransaction will populate all fields in a transaction, signs it and sends it to the network.
We can use .wait to wait for the transaction to be mined. This will return transaction recipient.
If status is
1, it means the transaction was successfully mined.