Here is an example.
const from = 'ety001';
const to = 'ety001';
const amount = '0.001 STEEM';
const memo = '';
const wif = '';
let tx = {
'operations': [
[
'transfer',
{
from,
to,
amount,
memo,
}
]
]
};
// prepare tx and sign it
steem.broadcast._prepareTransaction(tx).then( tx => {
tx = steem.auth.signTransaction(tx, [wif]);
// send tx to remote online server and broadcast.
setTimeout(() => {
steem.api.broadcastTransactionSynchronousAsync(tx).then(res => {
console.log(res);
});
}, 5000);
});
We use steem.broadcast._prepareTransaction()
and steem.auth.signTransaction()
to sign a transaction on a offiline mechine.
Then we get parameter tx
. It's a JSON type data. We can send this JSON data to an online mechine.
On the online mechine, we use steem.api.broadcastTransactionSynchronousAsync()
broadcast JSON data to blockchain.
Thank you for reading. I'm a witness. You could find more on my site https://steem.fans
I would really appreciate your witness vote! You can vote by AuthSteem. Or open https://steemitwallet.com/~witnesses page, input ety001 to vote.
Thank you!