Last active
September 11, 2023 21:08
-
-
Save rahuldamodar94/ea3bc4c551e6fc2d318767dcd7e5bffe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Web3 = require("web3"); | |
// Replace value of rpc with https://rpc-mumbai.matic.today for Mumbai | |
let rpc = "https://rpc-mainnet.matic.network"; | |
const provider = new Web3.providers.HttpProvider(rpc); | |
const web3 = new Web3(provider); | |
// Add your private key | |
web3.eth.accounts.wallet.add("pvt-key"); | |
// Send 10 MATIC | |
web3.eth | |
.sendTransaction({ | |
from: "your address", | |
to: "to address", | |
value: web3.utils.toWei("10", "ether"), | |
gas: 8000000, | |
}) | |
.then(function (receipt) { | |
console.log(receipt); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LP