₿ HolyTx — Raw Bitcoin Transaction Builder Zero Dependencies | Hand-rolled
⚠ TESTNET ONLY — This tool builds real Bitcoin transaction structures for educational purposes. Never paste real private keys into a web page. Use testnet keys for experimentation.

═══ Inputs (UTXOs to Spend) ═══

═══ Outputs (Where to Send) ═══

Total In: 0 sats
Total Out: 0 sats
Fee: 0 sats
Fee Rate: sat/vB
Est. Size: bytes

═══ Transaction Options ═══

Version: Locktime: Network:

═══ Build & Sign ═══

═══ Decode Raw Transaction ═══

Raw Hex:

═══ Bitcoin Script Interpreter ═══

Experiment with Bitcoin Script opcodes. Enter script in hex or use opcode mnemonics.
ScriptPubKey:
ScriptSig:

═══ Opcode Reference ═══

═══ Bitcoin Transaction Anatomy ═══

A Bitcoin transaction is just bytes.

Every transaction follows a strict binary format. No JSON. No XML. Just raw bytes concatenated in a specific order, serialized into hex, doubled-SHA256'd for the TXID.

Structure:
┌─────────────────────────────────────────────┐
Version │ 4 bytes, little-endian │
Input Count │ VarInt (1-9 bytes) │
Inputs[] │ Variable length per input │
Output Count│ VarInt (1-9 bytes) │
Outputs[] │ Variable length per output │
Locktime │ 4 bytes, little-endian │
└─────────────────────────────────────────────┘

Each Input:
┌─────────────────────────────────────────────┐
│ TXID │ 32 bytes (reversed!) │
│ Output Index │ 4 bytes, little-endian │
│ ScriptSig Len │ VarInt │
│ ScriptSig │ Variable (sig + pubkey) │
│ Sequence │ 4 bytes (usually 0xffffffff)│
└─────────────────────────────────────────────┘

Each Output:
┌─────────────────────────────────────────────┐
│ Value │ 8 bytes, little-endian (sats)│
│ ScriptPubKey Len│ VarInt │
│ ScriptPubKey │ Variable (locking script) │
└─────────────────────────────────────────────┘

Signing (P2PKH):
1. For each input, create a copy of the tx
2. Replace that input's scriptSig with the previous output's scriptPubKey
3. All other inputs' scriptSigs become empty
4. Append SIGHASH_ALL (01000000) to the tx copy
5. Double-SHA256 the whole thing → this is the sighash
6. ECDSA sign the sighash with the private key
7. ScriptSig = [sig_length] [DER_sig + 01] [pubkey_length] [compressed_pubkey]

═══ VarInt Encoding ═══

VarInt — Bitcoin's variable-length integer encoding:

Value Range │ Encoding
─────────────────────┼──────────────────────────
0 - 0xFC │ 1 byte as-is
0xFD - 0xFFFF │ 0xFD + 2 bytes LE
0x10000 - 0xFFFFFFFF │ 0xFE + 4 bytes LE
0x100000000+ │ 0xFF + 8 bytes LE

Example: 3 inputs → 03
Example: 253 inputs → fd fd00
Example: 70000 inputs → fe 70110100

═══ Byte Order (Endianness) ═══

Bitcoin uses little-endian for most numeric fields:
- Version, locktime, output values, sequence numbers
- VarInt multi-byte values

Exception: Transaction IDs (TXIDs) are stored reversed in inputs.
When you see a TXID in a block explorer, it's displayed in big-endian (human readable).
In the raw tx, it's stored as 32 bytes reversed (little-endian).

TXID displayed: abcd1234...5678ef90
In raw tx: 90ef7856...3412cdab

═══ Script Opcodes ═══

P2PKH (Pay-to-Public-Key-Hash):
The most common transaction type. Locks funds to a public key hash.

ScriptPubKey: OP_DUP OP_HASH160 <20-byte-hash> OP_EQUALVERIFY OP_CHECKSIG
Hex: 76 a9 14 [hash160] 88 ac

ScriptSig: <DER-sig + sighash> <compressed-pubkey>

Execution stack walkthrough:
1. Push sig → Stack: [sig]
2. Push pubkey → Stack: [sig, pubkey]
3. OP_DUP → Stack: [sig, pubkey, pubkey]
4. OP_HASH160 → Stack: [sig, pubkey, hash(pubkey)]
5. Push hash → Stack: [sig, pubkey, hash(pubkey), expected_hash]
6. OP_EQUALVERIFY → hashes must match (or fail)
7. OP_CHECKSIG → verify sig against pubkey → true/false

═══ HolyTx ═══

Hand-Rolled Bitcoin Transaction Builder

HolyTx builds real Bitcoin transactions from scratch — no libraries, no frameworks, no bitcoinjs-lib, no nothing. Every byte is serialized by hand in vanilla JavaScript.

What's Hand-Rolled:
• SHA-256 (FIPS 180-4) — 64-round compression
• RIPEMD-160 — 80-round dual-path compression
• ECDSA secp256k1 — point multiplication, signing, verification
• RFC 6979 — deterministic k generation via HMAC-SHA256
• DER encoding — ASN.1 signature serialization
• Base58Check — address encoding/decoding
• VarInt encoding — Bitcoin's variable-length integers
• Transaction serialization — raw byte-level construction
• Script interpreter — opcode execution engine
• SIGHASH computation — pre-image construction for signing

The Crypto Chain:
SHA-256 → HMAC-SHA256 → RFC 6979 → secp256k1 ECDSA → RIPEMD-160 → Base58Check → Raw Tx

WARNING: This is for education and testnet use only. Never enter real private keys into any web page. Use hardware wallets for real funds.

Part of the Zewp.com zero-dependency toolkit.
Built with nothing but a text editor and mathematical understanding.
Related Tools:
HashCrypt — SHA-256 from scratch
HolySigner — ECDSA secp256k1 from scratch
HolyBin — Binary data inspector
Divine Calculator — RPN scientific calculator

"The truth shall set you free." — John 8:32
HolyTx | Ready Zewp.com | Zero Deps | ₿ | ✝