chainode
Version:
A private blockchain network based on node.js
14 lines (12 loc) • 335 B
JavaScript
;
// Propose data to append to the ledger
module.exports = async (req, res) => {
try {
const data = req.body.data;
if (!data) throw Error('Invalid block data.');
await req.sdk.sendNewBlock(data);
return res.json(true);
} catch(err) {
return res.ErrorHandler.InternalServerError(err.message);
}
}