Bitcoin Transactions, Pay-To-Public-Key-Hash Discussion


Welcome to the discussion about this section. Here you can ask questions or post feedback about this specific lecture.



no question - it makes perfect sense to me!!!



@filip I have a question regarding the private key signature. At the point OP_CHECKSIG checks the public key + the private key signature and validates, aren’t these values public in the network now? I would think someone else could just use the same unlocking script for other UTXO’s of the same public key, but of course this isn’t the case. So how does it work with the private key signature, is it exclusive to that specific UTXO and will not work anywhere else? How is that signature created?

EDIT: Sorry for pesking you before googling Filip, I’ve found my answer in the first link I opened
There’s a nice short summary in the bottom, I’ll leave it here if someone else gets the same question:

How do digital signatures work?

  1. You combine the private key + transaction data , and use some mathematics to create a digital signature .
  2. You can then take the digital signature + transaction data + public key , do some more mathematics with them, and the result will confirm whether a legitimate private key was used to create the digital signature.

Because remember, the goal of a digital signature is to prove that you’re the owner of a public key .

1 Like


Exactly! I’m glad you googled, great! That’s exactly why it works.

1 Like


@filip some feedback about the quiz which is a bit confusing (no dedicated link for that, so putting it here).

  1. Q3 What format are serialized bitcoin transactions?

I think, binary is the correct answer. Whereas hexadecimal (aka base16) is just a human readable representation/encoding of binary (for humans and for JSON). That same data could be encoded in base64, base58 or any other way.
If “bitcoin transaction JSON” was implicitly meant, it would be nice to have such hint in a question.

  1. Why do we serialize bitcoin transactions? (Multiple Choice)
    Doesn’t bitcoin core compute hashes over a binary representation?
    Why is “to encrypt” answer invalid?
    P.S. I know that you do not have to binary serialize something to encrypt it. But you don’t have to do so to transmit it either (generally speaking).

That might be opinionated but I’d like to understand your reasoning behind the selected etalon answers.



Thanks. I do not agree on all of your points, but I will be happy to clarify.

On your first point. I do not agree with you, because every format in computers overall could be referred to as binary. That doesn’t mean abstractions of that format don’t exist or are non-important. ASCII is also in the end just binary, that doesn’t mean we should rename ASCII to binary. Bitcoin transactions are serialized to base16, not base10, not base2.

On your second point. To encrypt something is (depending on which definition you pick) basically converting or serializing something for the purpose of preventing access to that information. If that purpose doesn’t exist, to me it’s just a conversion between number formats or any other type of serialization. To summarize, serialization is part of encryption. But they are not the same.

I’m not sure exactly how bitcoin core computes hashes. It doesn’t change the answer as to why we serialize them. But depending on how you look at it, all hash functions operate on binary representations. Because that’s how all code is executed.



@filip, thanks for the discussion. I guess I’ve been over-thinking a bit with that “binary VS. hexadecimal” stuff. Still, I hope our little discussion would help you making the quiz and the course content even better.

My reasoning was “a serialized transaction is a structure mapped on the memory, so it’s binary”. Meaning, the correct answer would be

Serialized bitcoin transactions are binary
In hexadecimal base16 encoding within the JSON payload.

Actually I’ve understood your reasoning and I agree that it can be simplified to “hexadecimal”.

P.S. I think the transaction data is encoded in hexadecimap (base16) because

  1. It’s human readable for computer scientists
  2. It is used within JSON payloads printed by bitcoin-cli
  3. As far as I remember, JSON-rpc is used to exchange this data between bitcoind and bitcoin-cli


@filip, I also wonder your opinion and point of view on

What format are NON-serialized bitcoin transactions?

To me it’s something like a class definition or a DB schema definition. Meaning, an entity which contains

  • List inputs
  • List<UTXOoutputs
  • byte[] scriptOpcodes
  • ect.

In case we are on the same page in this aspect, then I agree that in order to both encrypt, persist on disk and send over the network this data must be serialized.



all hash functions operate on binary representations. Because that’s how all code is executed.

That also depends on the point of view, really.

Obviously, you can calculate the hash both for

  1. binary layout of transaction bytes (one for which you were drawing the color diagrams in the presentation)
  2. Bytes of the ASCII string from JSON (same data but encoded in base16)

If simplified, we are talking about “left” and “right” sides of a hex editor like this one for the same data



Well, it’s a weird way to reason. Because with your reasoning all data structures should just be called binary, since basically all data is mapped in memory. I maybe I just misunderstood you, but does not seem reasonable to me.

In regards to your second comment about NON-serialized tx. That is not a question in the quiz, just to clarify. I’m not sure what the exact data structure is, it would depend on the implementation of bitcoin.