Transactions 使用api或模块在litecoin testnet上发送原始事务(具有tx_十六进制)
我有原始事务的原始数据(tx_hex),但我无法使用对testnet.litecore.api的post请求将其发送到litecoin tesnet。如果我在浏览器中手动插入tx_十六进制,则正确发送事务。 我的代码:Transactions 使用api或模块在litecoin testnet上发送原始事务(具有tx_十六进制),transactions,litecoin,Transactions,Litecoin,我有原始事务的原始数据(tx_hex),但我无法使用对testnet.litecore.api的post请求将其发送到litecoin tesnet。如果我在浏览器中手动插入tx_十六进制,则正确发送事务。 我的代码: request({ url: 'https://testnet.litecore.io/tx/send', method: 'POST', data: test_tx }, ((error, response, body) => { if(e
request({
url: 'https://testnet.litecore.io/tx/send',
method: 'POST',
data: test_tx
}, ((error, response, body) => {
if(error) {
console.log(error);
} else {
console.log(body);
}
}));
我也试着使用另一项服务,但也失败了
代码:
postdata = { tx_hex : test_tx };
request.post('https://chain.so/api/v2/send_tx/LTCTEST', postdata, function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log('Upload successful! Server responded with:', body);
});
有人提供?Postdata必须是字符串,而不是对象。('tx_hex=…')