3

I'm trying to sign a message with a Bitcoin private key to get a refund from InstaWallet.

Any hints on how to do this from a terminal on OS X?

FernandoEscher
  • 2,940
  • 2
  • 28
  • 27
  • 2
    You might want to migrate this over to http://bitcoin.stackexchange.com/ – stormCloud May 13 '13 at 15:21
  • @stormCloud +1, was just about to suggest that! – Albert Renshaw May 16 '13 at 02:08
  • it's a good, general crypto question. although bitcoin is mentioned, i think the answer below might lead you in the right direction. – obimod May 16 '13 at 11:36
  • To anyone the +1'd this question, please read the text when you hover over the up arrow: "This question shows research effort; it is useful and clear". This is off topic for StackOverflow ([bitcoin.se] or maybe [unix.se]), and shows no research effort. – Brigand Jul 28 '13 at 11:12
  • I've added an edit suggestion in an attempt to address the bitcoin specification in the question text @FakeRainBrigand – obimod Jul 28 '13 at 11:46
  • This question appears to be off-topic because it is about Bitcoin. Probably it should be migrated to bitcoin.stackexchange.com. – FernandoEscher Aug 14 '14 at 19:51

1 Answers1

1

( page 22, 23 from An Introduction to Bitcoin, Elliptic Curves and the Mathematics of ECDSA )

4.6 ECDSA

A brief outline of how digital signatures work was given in 2.4.2. Bitcoin uses the mathematics of elliptic curves as the underlying basis for its digital signature. Recall elliptic curves are defined by T = (p, a, b, G, n, h), with Bitcoin using parameters prescribed by sep256k1. We also have the private and public key pair (Kpriv, Kpub where Kpub = Kpriv × G, as explained in 4.5. If Alice (A) and Bob (B) wanted to send a message (or transaction) to each other, this is how they would create and verify a digital signature.

4.6.1 Signature Generation [7]

To sign a message m Alice would do the following.

  1. Select a random integer k, 1 ≤ k ≤ n − 1.
  2. Compute kG = (x1, y1) and convert x1 to an integer x1.
  3. Compute r = x1 (mod n). If r = 0 then go to step 1.
  4. Compute k^−1 (mod n). Where k^−1 is the multiplicative inverse and satisfies k−1

[ ... ]

Either follow the link and continue on, to steps five, six, and seven via page 23; or via a python answer here via Jorky10: How to sign and verify signature with ecdsa in python

Community
  • 1
  • 1
obimod
  • 797
  • 10
  • 26