Send Transaction
Use Web3.js to Send Transaction on Clover
For our example, we only need a single JavaScript file (arbitrarily named transaction.js) to create and send the transaction, which we will run using the node
command in the terminal. The script will transfer 100 CLV from the genesis account to another address. For simplicity, the file is divided into three sections: variable definition, create transaction, and send transaction.
We need to set a couple of values in the variable definitions, then construct and sign the transaction:
Create your Web3 constructor (
Web3
).Specify the received address, CLV amount, gas price and gas limit.
Sign the transaction and broadcast it the Clover chain
The code looks like:
Running the Script
You can run the above script using command :
Last updated