← Back to IDE

β‚Ώ Bitcoin Telephone Keypad (BTC-TKP)

Complete Language Documentation Open Source

πŸ“– What is BTC-TKP?

BTC-TKP (Bitcoin Telephone Keypad), the FatCat Protocol, is a minimalist, stack-based programming language designed specifically for Bitcoin transaction signing on devices with only 12 buttonsβ€”the standard telephone keypad layout (0-9, *, #).

This language enables Bitcoin operations on extremely constrained hardware: signing devices, vending machines, ATMs, door locks, and any embedded system with a telephone keypad. It's a complete Bitcoin transaction language that fits on 12 buttons.

Open Source Project: BTC-TKP is open source software, designed to be freely used, studied, modified, and distributed by anyone building Bitcoin-enabled hardware devices.

🎯 Design Philosophy

The 12-button constraint isn't a limitationβ€”it's a feature:

⌨️ The 12-Button Telephone Keypad

7
8
9
4
5
6
1
2
3
*
0
#

Standard telephone keypad layout used in BTC-TKP

πŸ—οΈ Stack-Based Execution Model

BTC-TKP uses a stack-based virtual machine similar to Bitcoin Script, Forth, and other stack languages. All data operations work with a Last-In-First-Out (LIFO) stack.

How the Stack Works

Think of the stack like a stack of plates:

Example: Stack Operations

100* β†’ Stack: [100] (push 100) 20* β†’ Stack: [100, 20] (push 20) *1 β†’ Peek: 20 (look at top, don't remove) *2 β†’ Stack: [20, 100] (swap top two items)

πŸ“ Complete Command Reference

Digit Keys (0-9)

Digit keys build numbers in the input buffer. You can type multiple digits to create larger numbers.

1 β†’ Buffer: "1" 2 β†’ Buffer: "12" 3 β†’ Buffer: "123" 4 β†’ Buffer: "1234" * β†’ Push 1234 to stack

* (Star/Asterisk) - Push & Stack Operations

The * key handles data stack operations:

Command Name Description Example
* Push Push input buffer to stack (if buffer has data) 100* pushes 100 onto stack
*1 Peek View top item without removing it *1 shows what's on top
*2 Swap Swap the top two stack items *2 swaps positions

# (Hash/Pound) - Bitcoin Commands

The # key initiates Bitcoin transaction operations:

Command Name M-Alias Description
#0 Clear Stack M0 (Mode 0) Remove all items from stack
#1 Scan Address - Scan recipient Bitcoin address (QR code or input)
#2 Set Fee - Pop stack top and set as fee rate (sat/vB)
#3 Sign - Sign the transaction with private key
#4 Broadcast - Broadcast signed transaction to Bitcoin network
#5 Get Balance M5 (Memory 5) Push wallet balance to stack (in satoshis)

M-Alias System

Some commands have dual purposes and are called "M-aliases" (Mode/Memory aliases):

This dual naming helps users remember commands: "M0 to clear Mode" or "M5 to check Memory (balance)".

πŸ’‘ Complete Transaction Examples

Example 1: Simple Bitcoin Send

Send 1000 sats with 20 sat/vB fee:

#5 Check balance first (M5) 1000* Push 1000 (amount in satoshis) 20* Push 20 (fee rate in sat/vB) #2 Set fee from stack #1 Scan recipient address #3 Sign transaction #4 Broadcast transaction

Full one-liner: #51000*20*#2#1#3#4

Example 2: Using Stack Operations

Prepare amounts, swap them, then send:

5000* Push 5000 10* Push 10 *1 Peek at top (shows 10) *2 Swap (now: 10, 5000) #2 Set fee to 10 #1 Scan address #3 Sign (send 5000 sats) #4 Broadcast

Example 3: Multiple Checks

Check balance multiple times during transaction setup:

#5 Check balance *1 Peek at balance 2000* Push amount #5 Check balance again *1 Peek at new balance 15* Push fee #2 Set fee #1 Scan address #3 Sign #4 Broadcast

πŸ”„ Dual Notation Support

BTC-TKP supports both TKP notation (*/# keys) and legacy notation (P/C keys) for backward compatibility and keyboard convenience:

TKP Notation (Primary) Legacy Notation Function
* P Push / Stack operations
# C Command / Bitcoin operations

You can type either notationβ€”they work identically:

100*#5 ← Telephone keypad notation 100P#5 ← Also works (P maps to *) 100*C5 ← Also works (C maps to #) 100PC5 ← Also works (legacy notation)

πŸ§ͺ TEST Mode vs LIVE Mode

TEST Mode (Default) βœ…

Safe sandbox environment for learning and development:

LIVE Mode πŸ”§

Framework for real Bitcoin operations:

Implementation Status:

The BTC-TKP virtual machine and protocol fully support both TEST and LIVE modes. LIVE mode requires a backend API service (such as fatcatide.com or your own implementation) to handle real Bitcoin operations. The VM architecture is complete and ready to connect to any compatible backend that implements the specification in INTEGRATION.md.

This enables the open source community to build their own backend implementations while using the same BTC-TKP language and IDE frontend.

πŸ› οΈ Hardware Applications

BTC-TKP is designed for these use cases:

Hardware Signing Devices

Build air-gapped Bitcoin wallets using simple keypads. No touchscreen requiredβ€”just 12 buttons and minimal display.

Vending Machines

Accept Bitcoin payments on vending machines. Customer enters amount on telephone keypad, scans their address, and the machine creates the transaction.

ATM-Style Terminals

Bitcoin ATMs with telephone keypad interface. Simple, familiar input method that everyone understands.

Door Locks & Access Control

Bitcoin-enabled door locks where users pay to unlock using the telephone keypad interface.

Embedded Systems

Any IoT device or embedded system with a 12-button keypad can now handle Bitcoin transactions.

πŸ“± Hardware Implementation Example

Here's how a BTC-TKP transaction would appear on an embedded device with a small OLED display and 12-button telephone keypad:

Device Startup

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ BTC-TKP v1.0 β”‚ β”‚ Wallet Ready β”‚ β”‚ β”‚ β”‚ Balance: β”‚ β”‚ 5,000,000 sats β”‚ β”‚ β”‚ β”‚ Press # for menu β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 1: Check Balance (Press #5)

[User Presses: # then 5] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Fetching... β”‚ β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ 80% β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [Then Updates to:] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ Balance β”‚ β”‚ 5,000,000 sats β”‚ β”‚ β”‚ β”‚ Stack: [5000000] β”‚ β”‚ β”‚ β”‚ Ready >_ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 2: Enter Amount (1000*)

[User types: 1 0 0 0 *] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Input: 1000 β”‚ β”‚ Press * to push β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [Display updates:] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ Pushed 1,000 β”‚ β”‚ Stack: [1000] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 3: Set Fee (20* then #2)

[User types: 2 0 *] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ Pushed 20 β”‚ β”‚ Stack: [1000,20] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [User presses: # 2 (set fee)] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ Fee: 20 sat/vB β”‚ β”‚ Stack: [1000] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 4: Scan Recipient (#1)

[User presses: # 1 (scan address)] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SCAN ADDRESS β”‚ β”‚ β”‚ β”‚ Show QR code or β”‚ β”‚ type address via β”‚ β”‚ USB/companion appβ”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [After scanning bc1q...] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Recipient: β”‚ β”‚ bc1q...vx7e β”‚ β”‚ β”‚ β”‚ Amount: 1,000 β”‚ β”‚ Fee: 20 sat/vB β”‚ β”‚ β”‚ β”‚ Press #3 to sign β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 5: Sign Transaction (#3)

[User presses: # 3 (sign)] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ⚠ CONFIRM β”‚ β”‚ Send 1,000 sats? β”‚ β”‚ β”‚ β”‚ 1 = Yes β”‚ β”‚ 0 = Cancel β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [User presses: 1 (confirm)] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Signing... β”‚ β”‚ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [Then shows:] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ Signed! β”‚ β”‚ TXID: a1b2... β”‚ β”‚ β”‚ β”‚ Press #4 to β”‚ β”‚ broadcast β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 6: Broadcast (#4)

[User presses: # 4 (broadcast)] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Broadcasting... β”‚ β”‚ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [Success!] β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ“ SENT! β”‚ β”‚ TXID: a1b2c3d4 β”‚ β”‚ β”‚ β”‚ New Balance: β”‚ β”‚ 4,998,560 sats β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Complete Transaction: #51000*20*#2#1#3#4

This entire transaction flow demonstrates how BTC-TKP works on credit-card-sized hardware devices with minimal displays and 12-button keypadsβ€”perfect for embedded Bitcoin applications.

πŸ“„ File Format

BTC-TKP scripts are saved with the .btctpk extension. Files are plain text containing valid TKP commands:

# example_transaction.btctpk # Send 1000 sats with 20 sat/vB fee #51000*20*#2#1#3#4

Comments start with # followed by a space.

πŸš€ Getting Started

  1. Start in TEST Mode: The IDE defaults to safe TEST mode
  2. Try the keypad: Click buttons to enter commands
  3. Or use your keyboard: Type 0-9, *, # (or P, C for legacy)
  4. Watch the VM State: See stack, balance, and registers update live
  5. Run examples: Try #51000*20*#2
  6. Export scripts: Save your work as .btctpk files

🌐 Open Source

BTC-TKP is open source software. The language specification, reference implementation, and IDE are freely available for anyone to use, study, modify, and distribute.

This enables:

Build your own Bitcoin-enabled devices using BTC-TKP without restrictions or licensing fees.

πŸ“š Quick Reference Card

BTC-TKP Command Cheat Sheet

0-9 Build numbers in input buffer
* Push buffer to stack
*1 Peek top of stack
*2 Swap top two items
#0 Clear stack (M0)
#1 Scan recipient address
#2 Set fee rate
#3 Sign transaction
#4 Broadcast transaction
#5 Get balance (M5)
← Back to IDE
Created by Bitcoin Fat Cat 🐱 β€’ Open Source (MIT License) β€’ About β€’ Terms β€’ Support this project β‚Ώ