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.

  • What do you mean by 'security code' and 'security key'?
    – Nick ODell
    Oct 30, 2014 at 19:30
  • From what I can see its using a key pair. Where it makes two keys one public and one private. I could be wrong. Oct 30, 2014 at 19:39
  • 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? and maybe this collection of questions: I am new to Bitcoin, how can I get started?
    – Murch
    Oct 30, 2014 at 19:40
  • 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
    Oct 30, 2014 at 19:43
  • 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. Oct 30, 2014 at 20:03

2 Answers 2


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/


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 then check out:

  1. Bitcoin.org Developer Section (the nitty gritty)
  2. BTC Wiki technical section (more nitty gritty)


  • 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. Oct 31, 2014 at 7:59
  • 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) Oct 31, 2014 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.