Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mycode:
- function sendTxn(rawTx, callback) {
- var privateKeyBuffer = new Buffer(privateKey, 'hex');
- var transaction = new tx(rawTx);
- transaction.sign(privateKeyBuffer);
- var serializedTx = transaction.serialize().toString('hex');
- web3.eth.sendSignedTransaction(
- '0x' + serializedTx, function(err, txnHash) {
- if(err) {
- console.log("txn err", err);
- callback(err, null);
- } else {
- console.log("txn result", txnHash);
- callback(null, txnHash);
- }
- }).catch((err) => {
- callback(err, null);
- });
- }
Add Comment
Please, Sign In to add comment