根据彩色硬币文档,我已经发送了testnet
这样的资产:
var issuance_address = 'n2t19a46cBs2DdHs2sqfRwPGhoQjvqmefR';
var key = bitcoin.ECKey.makeRandom();
var wif = key.toWIF();
var to_address = key.pub.getAddress(bitcoin.networks.testnet).toString();
// to_address = 'mhLbuNgefJer5HFpq1UeW2PTq9RyttwghL'
console.log('new TESTNET address: ['+to_address+']');
var send_asset = {
'from': [issuance_address],
'to': [{
'address': to_address,
'amount': 5,
'assetId': 'LKXjG9uMSFoDj2Z6NrEJ6nkcRGVtjUmC4zrtH'
}]
};
colu.sendAsset(send_asset, function (err, body) {
if (err){
return console.error(err);
}
console.log('success',body);
}
它工作正常。但是我怎样才能将硬币从to_address
转回issuance_address
?
我想可以使用生成的WIF
私钥to_address
wif = 'Kyn7ihNLyTXKjWBAD99AY3LDJL4DeLapt4wWwFa4MMjirZe2QbEf'
为此目的,代码应该是什么?
如果我只是用它替换issuance_address
它to_address
会引发错误:
Addresss mhLbuNgefJer5HFpq1UeW2PTq9RyttwghL privateKey not found
如何使用给定的私钥(WIF?)进行此类转移?我在 Colored Coins 和 Colu SDK 的文档中一无所获。