Skip to content

Instantly share code, notes, and snippets.

View flashgrimmie's full-sized avatar

flashgrimmie

View GitHub Profile
@flashgrimmie
flashgrimmie / transaction.js
Created October 18, 2021 20:48
Send transaction with web3 in nodejs
const Web3 = require('web3');
const Provider = require('@truffle/hdwallet-provider');
const MyContract = require('./build/contracts/MyContract.json');
const address = '';
const privateKey = '';
const infuraUrl = '';
// Very hard way (web3#signTransaction() + web3#sendSignedTransaction())
const init1 = async () => {
const web3 = new Web3(infuraUrl);