<p>First of all, nothing is encrypted in Bitcoin, there is no "encryption" involved whatsoever. Cryptography: yes, but encryption: no.</p>

<p>The main aspect of private vs public key signing, is dat you can openly share your public key (that's what bitcoin balances are associated with), and then using your private key you can create a "digital signature" for a transaction spending coins from that public key. Other people can verify if this signature is correct, thus knowing that the transaction was signed by the one holding the private key. But here's the catch: this verification can be done without having the private key.</p>

<p>So essentially, the digital signature algorithm allows you to prove that you have the private key that corresponds to a certain public key, <em>without sharing the actual private key</em>.</p>

<p>And, obviously, neither is there a feasible way to reconstruct the private key from a given public key and a valid signature.</p>

<p>This is called ECDSA or "elliptic curve digital signature algorithm", because the inner workings are based on elliptic curves.</p>

<p>How this all works technically is somewhat complicated, there's some fancy maths involved. If you want to get into the dirty details, here's a good explanation: <a href="http://kakaroto.homelinux.net/2012/01/how-the-ecdsa-algorithm-works/" rel="nofollow">http://kakaroto.homelinux.net/2012/01/how-the-ecdsa-algorithm-works/</a></p>

CC BY-SA 3.0
2014-10-31T08:21:08.830Z
Also check out http://blog.chain.com/post/95218566791/the-math-behind-bitcoin
Wizard Of Ozzie
CC BY-SA 3.0
2014-10-31T08:11:56.413Z
2014-10-31T08:17:45.860Z
2014-10-31T08:17:45.860Z
Maǳi Koǌo
<p>I'm going to say up front, I've referred to several sources but as of this stage have yet to send a raw transaction myself. So I think OP's question is quite relevant in that there is no concrete example available on Bitcoin SE outlining the transaction process (which is convoluted, especially for newcomers). 
Start with <a href="http://blog.chain.com/post/95218566791/the-math-behind-bitcoin" rel="nofollow">this blog</a> then check out:</p>

<ol>
<li><a href="https://bitcoin.org/en/developer-documentation" rel="nofollow">Bitcoin.org Developer Section</a> (the nitty gritty)</li>
<li><a href="https://en.bitcoin.it/wiki/Category:Technical" rel="nofollow">BTC Wiki technical section</a> (more nitty gritty)</li>
</ol>

<p><a href="http://www.royalforkblog.com/2014/09/04/ecc/" rel="nofollow">http://www.royalforkblog.com/2014/09/04/ecc/</a></p>

CC BY-SA 3.0
2014-10-31T07:59:19.220Z
Not really relevant, what the question is all about is just the ECDSA, and hashes or redeeming or raw tx layout is not part of that.
Maǳi Koǌo
CC BY-SA 3.0
2014-10-31T08:16:27.053Z
You're right. I've actually been confined with the iOS SE app which is **finally** HD (ie not an iPhone port); can clearly read OP's post (I missed the tail of it)
Wizard Of Ozzie
CC BY-SA 3.0
2014-10-31T01:02:45.150Z
2014-10-31T08:23:38.197Z
2014-10-31T08:23:38.197Z
Wizard Of Ozzie
<p>I'm a programmer and want to get to know more about encryption and how Bitcoin works, but there is not much on the web describing how all this code works. It would help if there was some visual way to describe the concept of how and what its doing. </p>

<p>How can someone send the public key and private key to another computer without giving away the private key? If you didn't send the private key, how would the other computer know the transaction was from you and not someone else pretending to be you?</p>

<p>I have read up on key pairs and have managed to generate a key pair in java. Everyone's example of 'using' key pairs is very vague. How do you "use" the key pair to confirm a transaction. I know you have a private key that signs the transaction and the public key some how confirms the transaction but i don't understand the "how" it is "used" if you send a transaction with your secret key wouldn't that no longer be a secret key? How is the public key confirm the transaction was signed correctly? How can you send your secret key out with out some one using it once they get it? If Bob sends a transaction to Tim would Tim not now have Bobs security key? </p>

<p>I'm very sorry if this question sounds dumb. I'm just having a hard time understanding how you can send some one a transaction and be able to "sign" that transaction and how its confirmed. a lot of posts people are saying its Elliptic Curve Digital Signature Algorithm (ECDSA) but how is it doing all of this.</p>

CC BY-SA 3.0
2014-10-30T19:30:49.873Z
What do you mean by 'security code' and 'security key'?
Nick ODell
CC BY-SA 3.0
2014-10-30T19:39:00.963Z
From what I can see its using a key pair. Where it makes two keys one public and one private. I could be wrong.
Patrick W. McMahon
CC BY-SA 3.0
2014-10-30T19:40:35.393Z
Hi Patrick, welcome to Bitcoin.SE. Please check out our [tour] for a quick overview how our site works. As you might imagine many questions have already been asked and answered, so please check whether a question already exists before you ask it again. Also, it is easier to compare answers and to merge questions when there is only one question per post. I suggest you check out [What is a private key and a public key?](http://bitcoin.stackexchange.com/q/4675/5406) and maybe this collection of questions: [I am new to Bitcoin, how can I get started?](http://bitcoin.stackexchange.com/a/22840/5406)
Murch
CC BY-SA 3.0
2014-10-30T19:43:37.253Z
Patrick: It would be great if you could edit your question to only ask about one topic and give it a descriptive title. You can ask as many questions as you want, so you can create a new one for each of the other topics. :)
Murch
CC BY-SA 3.0
2014-10-30T20:03:22.333Z
I think I should start with a more basic understanding of what is going on under the hood prior to getting two in depth into questions.
Patrick W. McMahon
CC BY-SA 3.0
2014-10-30T21:16:14.120Z
In addition to the pages that @Murch linked to, I also find this video to be very informative: https://www.youtube.com/watch?v=Lx9zgZCMqXE.
morsecoder
CC BY-SA 3.0
2014-10-31T08:14:21.023Z
You *never* share your private key. You only share your public key, and a signature that proves you have the private key (without revealing the actual private key). See more detailed answer below.
Maǳi Koǌo
CC BY-SA 3.0
2015-01-23T20:37:27.240Z
I would like to thank all of you for the information provided. I'm still researching this stuff and have a long way to go in understanding the inner workings of how digital currencies work.
Patrick W. McMahon
<transactions><encryption><ecdsa>
How are transactions secured?
Patrick W. McMahon
# How are transactions secured?

(Asked by: username_0 on 2014-10-30)

I'm a programmer and want to get to know more about encryption and how Bitcoin works, but there is not much on the web describing how all this code works. It would help if there was some visual way to describe the concept of how and what its doing.

How can someone send the public key and private key to another computer without giving away the private key? If you didn't send the private key, how would the other computer know the transaction was from you and not someone else pretending to be you?

I have read up on key pairs and have managed to generate a key pair in java. Everyone's example of 'using' key pairs is very vague. How do you "use" the key pair to confirm a transaction. I know you have a private key that signs the transaction and the public key some how confirms the transaction but i don't understand the "how" it is "used" if you send a transaction with your secret key wouldn't that no longer be a secret key? How is the public key confirm the transaction was signed correctly? How can you send your secret key out with out some one using it once they get it? If Bob sends a transaction to Tim would Tim not now have Bobs security key?

I'm very sorry if this question sounds dumb. I'm just having a hard time understanding how you can send some one a transaction and be able to "sign" that transaction and how its confirmed. a lot of posts people are saying its Elliptic Curve Digital Signature Algorithm (ECDSA) but how is it doing all of this.

**Tags:** transactions, encryption, ecdsa

> **Comments:**
> **username_1**: What do you mean by 'security code' and 'security key'?  
> **username_0**: From what I can see its using a key pair. Where it makes two keys one public and one private. I could be wrong.  
> **username_2**: Hi username_0, welcome to Bitcoin.SE. Please check out our [tour] for a quick overview how our site works. As you might imagine many questions have already been asked and answered, so please check whether a question already exists before you ask it again. Also, it is easier to compare answers and to merge questions when there is only one question per post. I suggest you check out [What is a private key and a public key?](http://bitcoin.stackexchange.com/q/4675/5406) and maybe this collection of questions: [I am new to Bitcoin, how can I get started?](http://bitcoin.stackexchange.com/a/22840/5406)  
> **username_2**: username_0: It would be great if you could edit your question to only ask about one topic and give it a descriptive title. You can ask as many questions as you want, so you can create a new one for each of the other topics. :)  
> **username_0**: I think I should start with a more basic understanding of what is going on under the hood prior to getting two in depth into questions.  
> **username_3**: In addition to the pages that @username_2 linked to, I also find this video to be very informative: https://www.youtube.com/watch?v=Lx9zgZCMqXE.  
> **username_4**: You *never* share your private key. You only share your public key, and a signature that proves you have the private key (without revealing the actual private key). See more detailed answer below.  
> **username_0**: I would like to thank all of you for the information provided. I'm still researching this stuff and have a long way to go in understanding the inner workings of how digital currencies work.  

---

## 2 answers

### Answer by username_4 on 2014-10-31. Score: 3

First of all, nothing is encrypted in Bitcoin, there is no "encryption" involved whatsoever. Cryptography: yes, but encryption: no.

The main aspect of private vs public key signing, is dat you can openly share your public key (that's what bitcoin balances are associated with), and then using your private key you can create a "digital signature" for a transaction spending coins from that public key. Other people can verify if this signature is correct, thus knowing that the transaction was signed by the one holding the private key. But here's the catch: this verification can be done without having the private key.

So essentially, the digital signature algorithm allows you to prove that you have the private key that corresponds to a certain public key, *without sharing the actual private key*.

And, obviously, neither is there a feasible way to reconstruct the private key from a given public key and a valid signature.

This is called ECDSA or "elliptic curve digital signature algorithm", because the inner workings are based on elliptic curves.

How this all works technically is somewhat complicated, there's some fancy maths involved. If you want to get into the dirty details, here's a good explanation: <http://kakaroto.homelinux.net/2012/01/how-the-ecdsa-algorithm-works/>

> **Comments:**
> **username_5**: Also check out http://blog.chain.com/post/95218566791/the-math-behind-bitcoin  

---

### Answer by username_5 on 2014-10-31. Score: 1

I'm going to say up front, I've referred to several sources but as of this stage have yet to send a raw transaction myself. So I think OP's question is quite relevant in that there is no concrete example available on Bitcoin SE outlining the transaction process (which is convoluted, especially for newcomers).
Start with [this blog](http://blog.chain.com/post/95218566791/the-math-behind-bitcoin) then check out:

1. [Bitcoin.org Developer Section](https://bitcoin.org/en/developer-documentation) (the nitty gritty)
2. [BTC Wiki technical section](https://en.bitcoin.it/wiki/Category:Technical) (more nitty gritty)

<http://www.royalforkblog.com/2014/09/04/ecc/>

> **Comments:**
> **username_4**: Not really relevant, what the question is all about is just the ECDSA, and hashes or redeeming or raw tx layout is not part of that.  
> **username_5**: You're right. I've actually been confined with the iOS SE app which is **finally** HD (ie not an iPhone port); can clearly read OP's post (I missed the tail of it)  

---

