Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save siandreev/50ee8c066f31dfc2bcdacc4c40c902d3 to your computer and use it in GitHub Desktop.
Save siandreev/50ee8c066f31dfc2bcdacc4c40c902d3 to your computer and use it in GitHub Desktop.
import Web3 from 'web3';
import dotenv from 'dotenv';
import util from "ethereumjs-util";
dotenv.config();
const rawTx = {
from: '0x83757c40420e58135d5881c0c1e30d5424462101',
gas: 100000,
to: '0xecA0A3eFCf009519052Dc92306fE821b9c7A32A2',
value: 2000,
data: util.bufferToHex(Buffer.from('Hello world!', 'utf8'))
};
const web3 = new Web3(process.env.RPC_LINK);
web3.eth.accounts.wallet.add(process.env.PRIVATE_KEY);
web3.eth.sendTransaction(rawTx).then(console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment