mkdir test
cd ./test
npm install bloqly
const bloqly = require('bloqly');
const PRIVATE_KEY = 'x9oZ6jrUVEBDP5C0005fPseqPwLshQbb9io7Upg8sNM=';
const NODE_URL = 'http://localhost:8082';
const SPACE = 'space1';
const KEY = 'test-key1';
async function createTransaction() {
let lastId = await bloqly.getLastId(NODE_URL, SPACE, KEY);
const nonce = lastId.nonce + 1;
let signedTransaction = bloqly.signTransaction(
PRIVATE_KEY,
SPACE,
KEY,
nonce,
Date.now(),
'test',
'memo',
['tag1', 'tag2']
);
console.log(signedTransaction)
const encodedTransaction = bloqly.encodeTransaction(signedTransaction);
const res = await bloqly.sendSignedTransaction(NODE_URL, encodedTransaction);
console.log(res)
}
createTransaction().then(() => console.log('done'));
{
space: 'space-test',
key: 'test-key1',
nonce: 1,
timestamp: 1566131734551,
tags: [ 'tag1', 'tag2' ],
memo: 'memo',
value: 'test',
hash: 'EED07B4C60E2F50017510C9CE8C27034BC86A7015CF9CCDC3774BB658398EC5C',
signature: 'TlATkNPDpc0GBDSENFnXRtkv1Pss75fEjsJbl9eGi1Su6k/JygxOsy6AK0g7mFuG7dp1SADyy/oT/a3D4R8OCg==',
public_key: 'Ud8SI+nIX/XrPss2DEM1B2tdxu0v9NvuuAdABfUMrZk='
}
{ resultStatus: 'SUCCESS', resultCode: 'OK', message: null }
curl 'http://localhost:8082/api/events/{transaction hash}'