top of page
secp256k1 FOR BITCOIN IN EXCEL, NO MACROS, NO ARRAYS

49MB binary version uploaded November 2024

200MB+ decimal version uploaded October 2024

Presenting the first bitcoin ECDSA secp256k1 spreadsheet calculator

I set out in October 2020 to attempt to put the ECDSA curve into an Excel spreadsheet without using array formulas or macros.  It sounded like a good exercise in spreadsheet building and a chance to learn how bitcoin uses the ECDSA curve

What I thought would be a few months of constructing and building turned into a multi-year project that finished in April 2023.  The project took me down many paths such as building the SHA256 spreadsheet, a private key tutorial spreadsheet, a number of aspects around math, all the while the secp2561k ECDSA completion eluded me

I put the ECDSA spreadsheet on the shelf a few times, incomplete, stopped by time constraints, computer constraints, Excel constraints, but primarily brain constraints—my own understanding of the math behind the code was limited and I had to learn so much.  There were many times I thought I would not complete the task

Thankfully I had help.  A lot of help.  A big thank you to my mathematician guide KP who made modulo inverse multiplication and many other aspects of ECDSA math within the curve become less difficult and without whom I would have not finished this project.  Also big thank you to AP and a supportive crew, as well as to tutorials within Mastering Bitcoin by Antonopoulos and Programming Bitcoin by Song, also the learnmeabitcoin.com website, and many other people and websites that have helped along the way.  They contribute magnitudes above what I have done in this exercise

As for the spreadsheet, a nice aspect is it lays bare the inner workings of the ECDSA curve, and you can use it to see one of the steps of how a private key is converted into a public key.  Instructions are in a separate tab

Play with the spreadsheet and if you break it please give me feedback for improvement.  I used a few well-known methods in the calculation such as 256 precalculated points; at over 200MB the spreadsheet is already too large.  Why is it so large?  The spreadsheet has to go through a number of steps in order to achieve accurate calculations, notably

  • All numbers are at sizes well above Excel's floating point limitations, as such, simple math (addition, subtraction, multiplication, division) must be done long form

  • Maths operate within a modulus finite field, so Euclidian Division (remainders) must be used

  • The biggest and bulkiest demand for computer memory comes from the Extended Euclidian Algorithm and the steps necessary to derive the Greatest Common Divisor of the algorithm's points.  This in itself added over 180 tabs of division and multiplication to the spreadsheet (!), but the upside is the tabs are all identical with automated references between

All 200+MB of calculations is just for the result of adding two points on the ECDSA curve.  That's it, one step.  It is not the entire number of times around the ECDSA curve.  The good news is I built the spreadsheet so you can continue adding and bouncing around the curve by copy-pasting the resulting ECDSA third point and adding the next point to manually find subsequent points, which eventually results in the bitcoin x,y public key.  Like the description in hackernoon article points out, the most calculations within the ECDSA curve (read: this spreadsheet's copy/pasting) you will have to do is 255 times lol

Maybe when I get some energy back I will turn attention to streamlining the spreadsheet, or adding additional pre-interpolated points to reduce the number from 255, or build the conversion of the ECDSA output into a public key and public address within another spreadsheet.[done!]  Would be fun to try to receive bitcoin completely through the spreadsheet, but I need to make the RIPMD160 algo [update: I made the RIPMD160 algo not long after; you can find it on the spreadsheets page of this website].  I could use a short break, and tbh, *don't try this at home*.  Lots of risk in using spreadsheets for holding bitcoin value

Anyway, enjoy

dp

Update Nov.2024:  I made an ECDSA spreadsheet using binary to reduce required memory and improve calculation speed.  Significantly faster calculations due to binary simplicity, reduced size to 49MB, and more explanatory text within the spreadsheet so you can follow along.  Both the new binary spreadsheet and the decimal spreadsheet are free to download:

200MB+ decimal ECDSA spreadsheet:
49MB+ binary ECDSA spreadsheet:
binary ECDSA spreadsheet sha256 hash:
70123A786A55F9317B0B57B046506A03BC9BB54DCEA0CF8223C5ED86EC52995C
(starts with seven-zero-1-2-three-A-7 and ends with 5-two-9-nine-5-C)
decimal ECDSA spreadsheet sha256 hash:
322800721FF2E0D73AA689746AEEF358646A3F053706AB2009E83C78BDF4DB16
(starts with three-two-2-8-zero-zero-7 and ends with F-four-D-B-one-6)
bottom of page