uma/jimmy

Programming Bitcoin library

Maintainers

Details

github.com/1ma/jimmy

Source

Issues

Installs: 13

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 1

Open Issues: 0

Type:project

dev-master 2025-03-12 20:40 UTC

This package is auto-updated.

Last update: 2025-03-12 20:40:41 UTC


README

CI Coverage

Jimmy Song's Programming Bitcoin code implemented in PHP.

composer require uma/jimmy:dev-master

Disclaimer

This is toy grade code meant to learn concepts, not to be used in real projects that reach production.

It's not performant, it's not tested extensively, and it hasn't been reviewed. If you use it on mainnet you will possibly leak private keys, create transactions with invalid UTXOs that cannot be spent, etc.

To emphasize this I won't tag any release, and I don't promise any kind of backward compatibility. To further emphasize it the library assumes that it runs on testnet by default instead of mainnet.

Book Chapters Implemented

  • Chapter 1: Finite Fields
  • Chapter 2: Elliptic Curves
  • Chapter 3: Elliptic Curve Cryptography
  • Chapter 4: Serialization
  • Chapter 5: Transactions
  • Chapter 6: Script
  • Chapter 7: Transaction Creation and Validation
  • Chapter 8: Pay-to-Script Hash
  • Chapter 9: Blocks
  • Chapter 10: Networking
  • Chapter 11: Simplified Payment Verification
  • Chapter 12: Bloom Filters
  • Chapter 13: SegWit

Other Areas of Interest

How

Implementing the code related to ECC requires doing math operations on 256-bit integers, that's why the book uses Python.

PHP, like most programming languages, only has 32 or 64-bit integers that match the machine's word size. However, the language has a native binding to libgmp that provides support for representing and doing math on arbitrarily large integers with bearable (though not adequate) performance, just like Python.

To reiterate, this code is certainly vulnerable to timing side-channel attacks and other problems, do not use it in production.