简体   繁体   English

如何从交易 ID 中获取发件人比特币地址?

[英]How to get sender bitcoin address from transaction ID?

I am using coinpayment.net payment API for my project now.我现在正在为我的项目使用 coinpayment.net 支付 API。

Here is example bitcoin transaction.这是示例比特币交易。 https://www.blockchain.com/btc/tx/25ecdc29903aa8f80efb51a6b41ac036a91fe441aefd0d26df383827b9578cae https://www.blockchain.com/btc/tx/25ecdc29903aa8f80efb51a6b41ac036a91fe441aefd0d26df383827b9578cae

Here is transactionID is 25ecdc29903aa8f80efb51a6b41ac036a91fe441aefd0d26df383827b9578cae.这里的交易 ID 是 25ecdc29903aa8f80efb51a6b41ac036a91fe441aefd0d26df383827b9578cae。

Sender address is bc1q3q2jw046t888slq9rrg6ypwfna7ellkxh0ytss发件人地址是 bc1q3q2jw046t888slq9rrg6ypwfna7ellkxh0ytss

I want to get this sender address by programming with TxID.我想通过使用 TxID 编程来获取此发件人地址。

If you have got any solution or API, please let me know.如果您有任何解决方案或 API,请告诉我。

I have checked coinpayments.net api, but they don't provide sender address somehow in webhook endpoint.我已经检查了 coinpayments.net api,但他们没有在 webhook 端点中以某种方式提供发件人地址。 So, I am trying to find out this by external api or any solution.所以,我试图通过外部 api 或任何解决方案来找出这一点。

The purpose of this is that I want to send some BTC to sender again every month without asking withdraw address to every customers.这样做的目的是我想每个月再次发送一些 BTC 给发件人,而不需要向每个客户询问提款地址。

You can use any scripting language with JSON support like perl, javascipt or python.您可以使用任何支持 JSON 的脚本语言,如 perl、javascipt 或 python。 Or simply use command line tool like jq:或者干脆使用像 jq 这样的命令行工具:

curl -s https://blockchain.info/tx/25ecdc29903aa8f80efb51a6b41ac036a91fe441aefd0d26df383827b9578cae\?format\=json | jq '.inputs[0]."prev_out".addr'

to get familiar with jq use https://jqplay.org/熟悉 jq 使用https://jqplay.org/

another way is to install your own bitcoin node and fetch all info directly from your own node.另一种方法是安装您自己的比特币节点并直接从您自己的节点获取所有信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM