Skip to content

Wrong output in Chapter 14 #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edilmedeiros opened this issue Jun 1, 2024 · 3 comments
Closed

Wrong output in Chapter 14 #36

edilmedeiros opened this issue Jun 1, 2024 · 3 comments

Comments

@edilmedeiros
Copy link
Contributor

edilmedeiros commented Jun 1, 2024

This is trying to decode the string in https://github.com/sb1752/bitcoiner-intro-to-rust/blob/8f0c2c87ac2ea8aa51d5fdf989dbfe8444a089af/14_json_serialization.md?plain=1#L105C28-L105C770.

    let transaction_hex = "010000000242d5c1d6f7308bbe95c0f6e1301dd73a8da77d2155b0773bc297ac47f9cd7380010000006a4730440220771361aae55e84496b9e7b06e0a53dd122a1425f85840af7a52b20fa329816070220221dd92132e82ef9c133cb1a106b64893892a11acf2cfa1adb7698dcdc02f01b0121030077be25dc482e7f4abad60115416881fe4ef98af33c924cd8b20ca4e57e8bd5feffffff75c87cc5f3150eefc1c04c0246e7e0b370e64b17d6226c44b333a6f4ca14b49c000000006b483045022100e0d85fece671d367c8d442a96230954cdda4b9cf95e9edc763616d05d93e944302202330d520408d909575c5f6976cc405b3042673b601f4f2140b2e4d447e671c47012103c43afccd37aae7107f5a43f5b7b223d034e7583b77c8cd1084d86895a7341abffeffffff02ebb10f00000000001976a9144ef88a0b04e3ad6d1888da4be260d6735e0d308488ac508c1e000000000017a91476c0c8f2fc403c5edaea365f6a284317b9cdf7258700000000";

Manual inspection say the first input should have txid = 42d5c1d6f7308bbe95c0f6e1301dd73a8da77d2155b0773bc297ac47f9cd7380 (in reverse...)

Original text: https://github.com/sb1752/bitcoiner-intro-to-rust/blob/8f0c2c87ac2ea8aa51d5fdf989dbfe8444a089af/14_json_serialization.md?plain=1#L185C1-L198C2

Inputs: [
  {
    "txid": "f8c693771b2992a11b53c045369ab31a920de1d921ff3c148a9d0487c8f90baf",
    "output_index": 16,
    "script": "483045022100904a2e0e8f597fc1cc271b6294b097a6edc952e30c453e3530f92492749769a8022018464c225b03c28791af06bc7fed129dcaaeff9ec8135ada1fb11762ce081ea9014104da289192b0845d5b89ce82665d88ac89d757cfc5fd997b1de8ae47f7780ce6a32207583b7458d1d2f3fd6b3a3b842aea9eb789e2bea57b03d40e684d8e1e0569",
    "sequence": 4294967295
  },
  {
    "txid": "e51d2177332baff9cfbbc08427cf0d85d28afdc81411cdbb84f40c95858b080d",
    "output_index": 1,
    "script": "4830450220369df7d42795239eabf9d41aee75e3ff20521754522bd067890f8eedf6044c6d0221009acfbd88d51d842db87ab990a48bed12b1f816e95502d0198ed080de456a988d014104e0ec988a679936cea80a88e6063d62dc85182e548a535faecd6e569fb565633de5b4e83d5a11fbad8b01908ce71e0374b006d84694b06f10bdc153ca58a53f87",
    "sequence": 4294967295
  }
]

My output:

Version: 1
Inputs [
  {
    "txid": "8073cdf947ac97c23b77b055217da78d3ad71d30e1f6c095be8b30f7d6c1d542",
    "output_index": 1,
    "script_sig": "4730440220771361aae55e84496b9e7b06e0a53dd122a1425f85840af7a52b20fa329816070220221dd92132e82ef9c133cb1a106b64893892a11acf2cfa1adb7698dcdc02f01b0121030077be25dc482e7f4abad60115416881fe4ef98af33c924cd8b20ca4e57e8bd5",
    "sequence": 4294967294
  },
  {
    "txid": "9cb414caf4a633b3446c22d6174be670b3e0e746024cc0c1ef0e15f3c57cc875",
    "output_index": 0,
    "script_sig": "483045022100e0d85fece671d367c8d442a96230954cdda4b9cf95e9edc763616d05d93e944302202330d520408d909575c5f6976cc405b3042673b601f4f2140b2e4d447e671c47012103c43afccd37aae7107f5a43f5b7b223d034e7583b77c8cd1084d86895a7341abf",
    "sequence": 4294967294
  }
]

I'm fixing this in a PR, but wanted to check first.

@edilmedeiros
Copy link
Contributor Author

edilmedeiros commented Jun 1, 2024

It doesn't happen everywhere, in the final code block in chapter 14, the json output seem fine.

@sb1752
Copy link
Contributor

sb1752 commented Jun 2, 2024

Oh this could be because I changed the transaction example I was using and went back and updated everywhere. I was initially using an arbitrary transaction from mainnet but then decided that that is not good for privacy so switched to an arbitrary testnet example.

I probably just forgot to update this section.

@edilmedeiros
Copy link
Contributor Author

Fixed in #37.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants