<p>I have BTC data dumps from <a href="https://blockchair.com/dumps" rel="nofollow noreferrer">Blockchair</a>. These have almost all the data I need, however they do not include the raw transaction hex.</p>
<p>Is it possible to generate the <code>tx_hex</code> from this data in Python? or would I need the private key to do that? The inputs/outputs do include the script if that helps...</p>

CC BY-SA 4.0
2023-06-08T17:31:39.070Z
When you say `tx_hex` it seems like you want the raw transaction in hex form. This is public information in the bitcoin blockchain you wouldn't need a secret to produce that.
Michael Tidwell
CC BY-SA 4.0
2023-06-09T05:53:01.317Z
I know, but I am grabbing these on large scale. It would be costly to query an API for each tx_id to get the tx_hex. I have the decoded data in the Blockchair data dumps, and was wondering if I can simply construct the tx_hex (in python for example) from the decoded tx
fpghost
CC BY-SA 4.0
2023-06-09T15:00:11.197Z
But you don't need to grab this from Blockchair at all; any Bitcoin node can give you this data directly. That probably uses fewer resources than even just downloading all these dumps.
Pieter Wuille
CC BY-SA 4.0
2023-06-11T15:14:54.123Z
I am doing this on a server in bulk. I am not running a local node. I have the tx data and found a way to build tx_hex from that using bitcoin-lib in the end. Will post the solution later.
fpghost
<transactions><serialization>
Generate tx_hex from decode transaction?
fpghost
# Generate tx_hex from decode transaction?

(Asked by: username_0 on 2023-06-08)

I have BTC data dumps from [Blockchair](https://blockchair.com/dumps). These have almost all the data I need, however they do not include the raw transaction hex.

Is it possible to generate the `tx_hex` from this data in Python? or would I need the private key to do that? The inputs/outputs do include the script if that helps...

**Tags:** transactions, serialization

> **Comments:**
> **username_1**: When you say `tx_hex` it seems like you want the raw transaction in hex form. This is public information in the bitcoin blockchain you wouldn't need a secret to produce that.  
> **username_0**: I know, but I am grabbing these on large scale. It would be costly to query an API for each tx_id to get the tx_hex. I have the decoded data in the Blockchair data dumps, and was wondering if I can simply construct the tx_hex (in python for example) from the decoded tx  
> **username_2**: But you don't need to grab this from Blockchair at all; any Bitcoin node can give you this data directly. That probably uses fewer resources than even just downloading all these dumps.  
> **username_0**: I am doing this on a server in bulk. I am not running a local node. I have the tx data and found a way to build tx_hex from that using bitcoin-lib in the end. Will post the solution later.  

---

## 0 answers

