Skip to content

Instantly share code, notes, and snippets.

@rahuldamodar94
Last active September 11, 2023 21:08
Show Gist options
  • Save rahuldamodar94/ea3bc4c551e6fc2d318767dcd7e5bffe to your computer and use it in GitHub Desktop.
Save rahuldamodar94/ea3bc4c551e6fc2d318767dcd7e5bffe to your computer and use it in GitHub Desktop.
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);
});
@VladimirGabriel
Copy link

LP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment