nodejs
npm install
vim eos_trx.js
const { Api, JsonRpc, RpcError } = require('eosjs'); // const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); // development only const JsSignatureProvider = require('eosjs/dist/eosjs-jssig').default; const fetch = require('node-fetch'); // node only; not needed in browsers const { TextEncoder, TextDecoder } = require('util'); // node only; native TextEncoder/Decoder // const { TextEncoder, TextDecoder } = require('text-encoding'); // React Native, IE11, and Edge Browsers only const httpEndpoint = 'https://api.jungle.alohaeos.com' const chainId = 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473' const defaultPrivateKey = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"; //eosio default private key const signatureProvider = new JsSignatureProvider([defaultPrivateKey]); const api = new Api({ rpc: new JsonRpc(httpEndpoint,{ fetch }), chainId, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() }) /// test(); async function test(){ const sign_trx = await test_makeTrx(); test_broadcastTrx(sign_trx); } async function test_makeTrx(){ const result = await api.transact({ actions: [{ account: 'eosio.token', name: 'transfer', authorization: [{ actor: 'your_eos_account', permission: 'active', }], data: { from: 'your_eos_account', to: 'eosio', quantity: '0.0001 EOS', memo: '', }, }] }, { broadcast: false, //is broadcast sign: true, //is sign blocksBehind: 3, expireSeconds: 30, }); console.dir('-------------------') console.dir(result); console.dir('-------------------') return result; } async function test_broadcastTrx(sign_trx){ // console.dir('-------------------') // console.dir(sign_trx); // console.dir('-------------------') const result = await api.pushSignedTransaction(sign_trx); console.dir(result); }node eos_trx.js