async function broadcast(){
const fetch = require('node-fetch');
const web3js = require('web3');
const BROADCAST_URL = "https://cryptotalk-public-gateway-byeii62k.de.gateway.dev/bsc/broadcast";
const API_KEY = "AIzaSyCngkz41JSdBMlr4iKqAMLiTMHD9TfQvuc";
const bscWeb3 = new web3js('https://bsc-dataseed.binance.org/');
const Private_key = "....wallet private key... ";
const my_wallet_addr = "0x5585D5365F37671Eecc0FDCAC5a06BD1d176408E";
const rawTx = {
from: '0x5585d5365f37671eecc0fdcac5a06bd1d176408e',
value: '0x0',
to: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
data: '0xa9059cbb00000000000000000000000066eb772458fc2743c5e3adb232dc18ef3a80d5800000000000000000000000000000000000000000000000008ac7230489e80000',
nonce: '0xf16',
gasLimit: '0x7a120',
gasPrice: '0x2540be400'
}
const signedTx = await bscWeb3.eth.accounts.signTransaction(rawTx, Private_key);
const request_body = {
"addr" : my_wallet_addr,
"serializedTx" : (signedTx.raw || signedTx.rawTransaction),
"operation" : "BROADCAST"
};
let txn_response = await fetch(BROADCAST_URL +"?key=" + API_KEY,
{ method : 'post',
body : JSON.stringify({ params : request_body}),
headers: { 'Content-Type': 'application/json'}
}
);
let tx = await txn_response.json();
if(tx.isError){
console.error("Error");
}else{
console.log(tx.data);
}
}