transactions - 使用 api 或模块在莱特币测试网上发送原始交易(有 tx_hex)
问题描述
我有原始交易的原始数据(tx_hex),但我无法使用对 testnet.litecore.api 的发布请求将其发送到 litecoin tesnet。如果我在浏览器中手动插入 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);
});
有人提议?
解决方案
Postdata必须是字符串,而不是对象。('tx_hex=...')
推荐阅读
- angular - 扫描后如何返回带有插入项的更新数组?
- java - 两个不同的查询返回相同的对象 Spring Boot JPA
- python - 在两个日期时间之间选择 xarray 数据集数据超出范围
- sql - 将列透视到行 PL/SQL
- javascript - how to sort and limit firebase realtime db v9?
- javascript - 如何使用循环在表中使用输入文本字段并获取reactjs中行选择的特定值
- excel - Excel xlsm 将数据表单表添加到主表
- apache-flink - Flink Infer kafka 主题 DDL
- azure-devops - Azure DevOps - 计费可见性 + 详细信息
- delphi - E2362 无法访问受保护的符号 TControl.Color 我该如何解决?