uma/jimmy

Programming Bitcoin library

Maintainers

Details

github.com/1ma/jimmy

Source

Issues

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 1

Open Issues: 0

Type:project

dev-master 2024-11-08 12:47 UTC

This package is auto-updated.

Last update: 2024-12-08 13:04:10 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

  • BIP-0032: Hierarchical Deterministic Wallets
  • BIP-0039: Mnemonic code for generating deterministic keys
  • BIP-0044: Multi-Account Hierarchy for Deterministic Wallets
  • BIP-0084: Derivation scheme for P2WPKH based accounts
  • BIP-0086: Key Derivation for Single Key P2TR Outputs
  • BIP-0173: Base32 address format for native v0-16 witness outputs
  • BIP-0325: Signet
  • BIP-0340: Schnorr Signatures for secp256k1
  • BIP-0341: Taproot
  • BIP-0342: Validation of Taproot Scripts
  • BIP-0350: Bech32m format for v1+ witness addresses
  • BIP-0370: Partially Signed Bitcoin Transaction Format Version 2
  • BIP-0371: Taproot Fields for PSBT

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.