# How does Diffie Hellman protocol work in Bitcoin Blockchain Transactions?

Greetings to all! Please explain how the Diffie-Hellman protocol works in Bitcoin?

That is, in Blockchain Transactions, there is also a total number of "K" recipient and sender? "K" the recipient and the sender are the same as in the photo scheme?

Maybe I'm confusing something, but I heard "K" is the secret number of the transaction.

If "X" is a private number. You can define "K" by the formula:

$$K = ((Z + (X \cdot R)) / S) \mod N$$

Suppose there is a transaction:

https://blockchain.info/tx/fcd0ddf5c96d160acc520a6e014e070c293eaf04a8b5145f9c705bb2a36c08b0

1MJT3tqXwzko6ACGYFdRmJbxosLC4VKD7w - sends BTC

Question what is their shared secret key ???

RawTx:

So this Diffie-Hellman protocol turns out this Shared Secret Key is also for an address? https://www.blockchain.com/btc/address/18VGa5mEJyu5XrYD2MG8Xm6J1eJYrrShWW

But the question is how the owner of the address learns: 18VGa5mEJyu5XrYD2MG8Xm6J1eJYrrShWW about the existence of the Shared Secret Key ????

• And in Bitcoin, where exactly is the key agreement between the sender and receiver? – Izi Tors Jan 12 at 15:13
• The question is how can the recipient see this? – Izi Tors Jan 12 at 15:14
• I am worried about my BTC. In 2018, I sent bitcoins to addresses that have already been hacked. Can scammers find out my private key knowing the shared secret transaction key that was sent in 2018 ??? – Izi Tors Jan 12 at 15:39

Bitcoin does not use ECDH, or any DH, at all. It does use ECDSA (on secp256k1). The formula you posted is a wrongly-cased rearrangement of part of DSA, which with notational change is also used for ECDSA. In (EC)DSA k is a secret nonce known only to the signer, and not shared in any way; it could be computed from the formula if you know the privatekey, but only the signer knows the privatekey and the signer never needs to compute k, making that formulation useless. OTOH if the signer defectively uses same k for multiple signatures, an attacker can use a different formula to recover privatekey.

There is no shared secret key. In fact there is no encryption at all. The fundamental principle of blockchain is the exact opposite of confidentiality; it is that the information should be replicated and known widely enough that no 'damage' -- including a governmental prohibition -- can cause it to be lost. The security goal is only integrity/authenticity: that unauthorized parties can't forge or alter a transaction.