签名代码:
function addPreZero(num){
var t = (num+'').length,
s = '';
for(var i=0; i<16-t; i++){
s += '0';
}
return s+num;
}
function usdtSign(privateKey, utxo, feeValue, usdtValue, fromAddress, toAddress) {
var txb = new bitcoin.TransactionBuilder();
var set = bitcoin.ECPair.fromWIF(privateKey);
const fundValue = 546;
var usdtAmount = parseInt(usdtValue*1e8).toString(16);
var totalUnspent = 0;
for(var i = 0; i < utxo.length; i++){
totalUnspent = totalUnspent + utxo[i].value;
}
const changeValue = totalUnspent - fundValue - (feeValue*1e8);
if (totalUnspent < feeValue + fundValue) {
console.log("Total less than fee");
return constant.LessValue;
}
for(var i = 0; i< utxo.length; i++){
txb.addInput(utxo[i].tx_hash_big_endian