我有用于原始事务的原始数据(tx_hex),但我不能使用post请求将其发送到litecoin。如果我在浏览器中手动插入tx_hex,则事务将正确发送。我的代码:
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);
});有人愿意吗?
发布于 2018-05-30 10:30:05
Postdata必须是字符串,而不是对象。(“tx_hex=……”)
https://stackoverflow.com/questions/50528249
复制相似问题