<p>You decode them in exactly the same way that you decode a transaction. They are perfectly valid transactions and a decoder should be able to decode them properly and get meaningful data out of them. The reason they look weird is because every part of the transaction is <a href="https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L95" rel="nofollow noreferrer">randomly generated</a> so the fields do not necessarily contain data that you expect (e.g. the version number is randomly generated instead of the standard <code>01000000</code> or <code>02000000</code>).</p>

CC BY-SA 4.0
2018-06-08T22:30:59.460Z
2018-06-08T22:30:59.460Z
Ava Chow
<p>Bitcoin enthusiast here. Learning "the hard way" how bitcoin works (andreas books, looking in js/python implementations), I'm writing (as an hobby) some code here and there to understand things and to test it, I'm using the tests available on the bitcoin github repo. But now, I'm struggling with the ones on the <code>sighash.json</code> file. </p>

<p><strong>What is the encoding format used for the raw transactions ?</strong> (first element on each array). </p>

<p>I understand the traditional format which looks like 0100000000010280e688...000ffffffffe9b54...39da98ac00000000. But here I'm honestly lost. On the tests file, it doesn't look like a regular transaction.</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/master/src/test/data/sighash.json#L3" rel="nofollow noreferrer">Example</a>:</p>

<pre><code>907c2bc503ade11cc3b04eb2918b6f547b0630ab569273824748c87ea14b0696526c66ba74020000004ab65ababfd1f9bdd4ef073c7afc4ae00da8a66f429c917a0081ad1e1dabce28d373eab81d8628de802000000096aab5253ab52000052ad042b5f25efb33beec9f3364e8a9139e8439d9d7e26529c3c30b6c3fd89f8684cfd68ea0200000009ab53526500636a52ab599ac2fe02a526ed040000000008535300516352515164370e010000000003006300ab2ec229
</code></pre>

<p><strong>How am I supposed to decode such string ?</strong></p>

<p>Thanks.</p>

<transactions><development><bitcoin-core-development>
bitcoin repo sighash.json data format
JohnToddmund
# bitcoin repo sighash.json data format

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

Bitcoin enthusiast here. Learning "the hard way" how bitcoin works (andreas books, looking in js/python implementations), I'm writing (as an hobby) some code here and there to understand things and to test it, I'm using the tests available on the bitcoin github repo. But now, I'm struggling with the ones on the `sighash.json` file.

**What is the encoding format used for the raw transactions ?** (first element on each array).

I understand the traditional format which looks like 0100000000010280e688...000ffffffffe9b54...39da98ac00000000. But here I'm honestly lost. On the tests file, it doesn't look like a regular transaction.

[Example](https://github.com/bitcoin/bitcoin/blob/master/src/test/data/sighash.json#L3):

```
907c2bc503ade11cc3b04eb2918b6f547b0630ab569273824748c87ea14b0696526c66ba74020000004ab65ababfd1f9bdd4ef073c7afc4ae00da8a66f429c917a0081ad1e1dabce28d373eab81d8628de802000000096aab5253ab52000052ad042b5f25efb33beec9f3364e8a9139e8439d9d7e26529c3c30b6c3fd89f8684cfd68ea0200000009ab53526500636a52ab599ac2fe02a526ed040000000008535300516352515164370e010000000003006300ab2ec229

```

**How am I supposed to decode such string ?**

Thanks.

**Tags:** transactions, development, bitcoin-core-development


---

## 1 answers

### Answer by username_1 on 2018-06-08. Score: 1

You decode them in exactly the same way that you decode a transaction. They are perfectly valid transactions and a decoder should be able to decode them properly and get meaningful data out of them. The reason they look weird is because every part of the transaction is [randomly generated](https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L95) so the fields do not necessarily contain data that you expect (e.g. the version number is randomly generated instead of the standard `01000000` or `02000000`).


---

