tran.js
var CoinStack = require('coinstack-sdk-js')
var coinstackclient = new CoinStack('YOUR_COINSTACK_ACCESS_KEY',
'YOUR_COINSTACK_SECRET_KEY'); // Actual keys not shown
var privateKeyWIF = CoinStack.ECKey.createKey(); //개인키 생성
var txBuilder = coinstackclient.createTransactionBuilder();
txBuilder.addOutput("1Q8xE8T3G9mxRoDUde6gDSxnK1uCac2kqh",
CoinStack.Math.toSatoshi("0.01"))
txBuilder.setInput("1Q8xE8T3G9mxRoDUde6gDSxnK1uCac2kqh");
txBuilder.buildTransaction(function(err, tx) {
tx.sign(privateKeyWIF)
var rawTx = tx.serialize()
// send tx
client.sendTransaction(rawTx, function(err) {
if (null != err) {
console.log("failed to send tx");
}
});
});
Error
(node:12012) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'sign' of undefined (node:12012) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I don't know what to do