ะัััะพะผ
var peercoin = require('bitcore-lib');
module.exports = (req, res) => {
const { utxos, keys, to } = req.body;
var tx = new peercoin.Transaction();
for (let i = 0; i < utxos.length; i++) {
tx.addInput(utxos[i].txhash, utxos[i].index);
}
tx.addOutput(to[0].to, to[0].amount);
tx.addOutput(to[1].to, to[1].amount);
for (let i = 0; i < utxos.length; i++) {
let key = peercoin.ECKey.fromWIF(keys[i]);
tx.sign(i, key);
}
res.json({
signed: tx.toHex(),
hash: tx.getId()
});
};
I wrote a primitive code to sign a peercoin transaction, but I get the error "Invalid Argument for input, expected Input but got string" Someone can help and say what's wrong with this code?