Skip to content

Commit e9308cd

Browse files
committed
Propose new BIP for Programmable Bitcoin Token Standard (PBTS)
1 parent be3d2e4 commit e9308cd

1 file changed

Lines changed: 308 additions & 0 deletions

File tree

bip-pbst.md

Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
# BIP-XXXX: Programmable Bitcoin Token Standard (PBTS)
2+
3+
```
4+
BIP: XXXX
5+
Layer: Applications
6+
Title: Programmable Bitcoin Token Standard (PBTS)
7+
Author: Gobi Shanthan <gobi@torram.xyz>, Lee Raj. <lee@torram.xyz>
8+
Comments-Summary: No comments yet.
9+
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-XXXX
10+
Status: Draft
11+
Type: Standards Track
12+
Created: 2025-02-11
13+
License: BSD-2-Clause
14+
Discussions-To: bitcoin-dev@lists.linuxfoundation.org
15+
Post-History: 2025-02-11
16+
Requires: 340, 341, 342
17+
```
18+
19+
## Abstract
20+
21+
The **Programmable Bitcoin Token Standard (PBTS)** introduces a method to create, transfer, and validate native Bitcoin-based tokens using **Bitcoin Script** and **Taproot**. PBTS enhances Bitcoin's Layer 1 functionality by enabling **tokenized assets** with programmable conditions without compromising security, decentralization, or predictability. Unlike Ethereum or Solana, PBTS **does not introduce Turing-complete smart contracts** but leverages **structured pre-commitments** and **Taproot optimizations** to enable secure, efficient programmable tokens.
22+
23+
PBTS is a **non-consensus-breaking, backward-compatible** standard that ensures tokens remain verifiable and transferable without requiring modifications to Bitcoin's core protocol.
24+
25+
## Copyright
26+
27+
This BIP is licensed under the BSD 2-clause license.
28+
29+
## Motivation
30+
31+
Bitcoin adheres to the principles of **minimalism and security**, which have made it the most robust and decentralized blockchain. PBTS aligns with this philosophy by introducing **programmability without complexity**, ensuring that Bitcoin's core remains unchanged while extending its utility in a predictable and efficient way.
32+
33+
Bitcoin currently lacks a **native** token standard that enables **flexible** and **fully Layer 1** token issuance with programmable conditions. Existing solutions such as **Ordinals, RGB, and Runes** either rely on **external tracking mechanisms** or **Layer 2 solutions** that introduce centralization risks. PBTS provides a **UTXO-based**, predefined, and non-intrusive method for issuing tokens that remain completely **verifiable on Bitcoin's base layer** with advanced programmable features like time-locked vesting and milestone-based escrow.
34+
35+
## Key Benefits
36+
37+
1. **No Additional Layers**
38+
* Execution happens directly in **Bitcoin transactions**
39+
* Complete validation on **Layer 1**
40+
* No external dependencies for validation
41+
42+
2. **Predefined & Deterministic Execution**
43+
* No infinite loops or dynamic state modifications
44+
* Predictable execution paths
45+
* Fixed state transitions
46+
47+
3. **Minimal Impact**
48+
* Utilizes existing **Taproot** and **Script** functionality
49+
* No consensus changes required
50+
* Standard transaction format
51+
52+
4. **Scalability & Efficiency**
53+
* **Merkle proof-based validation**
54+
* Minimal transaction sizes through Taproot optimization
55+
* Compatible with future Bitcoin scaling solutions
56+
57+
5. **Security Model**
58+
* No external validators required
59+
* Fully **self-custodial**
60+
* Bitcoin-native security
61+
62+
6. **Programmable Conditions**
63+
* Time-locked transfers (vesting)
64+
* Milestone-based escrow with multiple release stages
65+
* Multi-signature requirements
66+
* Prepared for oracle integration
67+
68+
## Comparison with Existing Bitcoin Token Standards
69+
70+
| Feature | Ordinals | Runes | PBTS |
71+
|----------------------------|--------------------------|-----------------|------------------------------|
72+
| UTXO-Based | ❌ No (Inscriptions) | ✅ Yes | ✅ Yes |
73+
| Requires External Indexer? | ✅ Yes | ✅ Yes | ❌ No |
74+
| Efficient for Tokens? | ❌ No | ✅ Somewhat | ✅ Fully Optimized |
75+
| Scalability Impact | ❌ High Blockchain Bloat | ⚠️ Medium | ✅ Minimal (Uses Taproot) |
76+
| Bitcoin Script-Based? | ❌ No | ✅ Yes | ✅ Yes (Taproot-Optimized) |
77+
| Consensus Changes Required?| ❌ No | ❌ No | ❌ No |
78+
| Transaction Cost | ❌ Expensive | ⚠️ Medium | ✅ Efficient |
79+
| Programmable Conditions | ❌ No | ⚠️ Limited | ✅ Yes |
80+
| Fully On-Chain Validation | ❌ No | ❌ No | ✅ Yes |
81+
82+
## Specification
83+
84+
### Overview
85+
86+
PBTS tokens are created, transferred, and validated directly on Bitcoin's Layer 1 using Taproot scripts to enable complex programmable conditions without requiring any modifications to the Bitcoin protocol.
87+
88+
### Token Creation
89+
90+
A **PBTS token** is created by locking a **UTXO** with a **Taproot script** that commits to a token issuance structure. The token metadata is encoded in the transaction output using a standardized format:
91+
92+
1. **Token Issuance Format**:
93+
* The output script is a Taproot output that contains:
94+
* Token ID: A 32-byte identifier (Hash of Issuer's Public Key + Script Hash)
95+
* Total Supply: Fixed integer representing the maximum possible supply
96+
* Decimals: Integer representing the decimal places (typically 8 to match satoshis)
97+
* Metadata Commitment: Optional hash of off-chain metadata (name, symbol, description)
98+
99+
2. **Example Issuance Script**:
100+
```
101+
<token_metadata_hash> OP_DROP
102+
<issuer_pubkey> OP_CHECKSIG
103+
```
104+
105+
### Token Contracts
106+
107+
PBTS supports several programmable contract types that define how tokens can be transferred and under what conditions they can be spent:
108+
109+
#### 1. Auto-Vest (Time-Locked) Contracts
110+
111+
Time-locked transfers where tokens become available to the recipient only after a specific date, using Bitcoin's CHECKLOCKTIMEVERIFY opcode.
112+
113+
**Script Pattern**:
114+
```
115+
IF
116+
<locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
117+
<receiver_pubkey> OP_CHECKSIG
118+
ELSE
119+
<issuer_pubkey> OP_CHECKSIG
120+
ENDIF
121+
```
122+
123+
#### 2. Milestone-Based Escrow
124+
125+
Structured transfers with multiple release stages, each requiring specific conditions like time thresholds and multi-signature approvals.
126+
127+
**Script Pattern**:
128+
```
129+
IF
130+
# Milestone 1
131+
<milestone1_locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
132+
<m1> <pubkey1> <pubkey2> <pubkeyN> <n> OP_CHECKMULTISIG
133+
ELSEIF
134+
# Milestone 2
135+
<milestone2_locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
136+
<m2> <pubkey1> <pubkey2> <pubkeyN> <n> OP_CHECKMULTISIG
137+
ELSEIF
138+
# Expiry condition (return to sender)
139+
<expiry_time> OP_CHECKLOCKTIMEVERIFY OP_DROP
140+
<sender_pubkey> OP_CHECKSIG
141+
ENDIF
142+
```
143+
144+
#### 3. Oracle-Ready Contracts
145+
146+
Contracts designed to work with external data oracles, containing placeholder structures for future oracle implementation.
147+
148+
**Script Pattern**:
149+
```
150+
IF
151+
# Oracle verification
152+
<oracle_pubkey> OP_CHECKSIGVERIFY
153+
<condition_hash> OP_SHA256 <expected_result_hash> OP_EQUALVERIFY
154+
<receiver_pubkey> OP_CHECKSIG
155+
ELSEIF
156+
# Expiry condition (return to sender)
157+
<expiry_time> OP_CHECKLOCKTIMEVERIFY OP_DROP
158+
<sender_pubkey> OP_CHECKSIG
159+
ENDIF
160+
```
161+
162+
### Token Transfer
163+
164+
PBTS token transfers involve creating transactions that spend from token-containing UTXOs and create new UTXOs with the appropriate scripts to maintain token properties and conditions.
165+
166+
1. **Standard Transfer**:
167+
* Spends from a token UTXO
168+
* Creates new outputs with token metadata preserved
169+
* May split tokens across multiple outputs (for partial transfers)
170+
171+
2. **Conditional Transfer**:
172+
* Creates outputs with Taproot scripts encoding the conditional logic
173+
* Enables time-locked, multi-signature, or other programmable conditions
174+
175+
3. **Transaction Validation**:
176+
* Follows standard Bitcoin transaction validation rules
177+
* Leverages Bitcoin's native UTXO model for tracking ownership
178+
* Enables verification without external indexers or oracles
179+
180+
### Implementation Details
181+
182+
#### Taproot Integration
183+
184+
PBTS leverages Taproot's script path spending to enable complex script execution while maintaining payment efficiency:
185+
186+
1. **Key Path Spending**:
187+
* Used for standard transfers with no conditions
188+
* Minimizes transaction size and fees
189+
190+
2. **Script Path Spending**:
191+
* Used for conditional transfers (time locks, multi-sig, etc.)
192+
* Reveals only the relevant script path when executing
193+
194+
3. **Commitment Structure**:
195+
* Main output key commits to all possible spending paths
196+
* Each condition is a separate script leaf in the Taproot tree
197+
198+
#### On-Chain Token State Tracking
199+
200+
PBTS tokens maintain their state entirely on-chain:
201+
202+
1. **Token Properties**:
203+
* All token properties are verifiable through transaction outputs
204+
* Token metadata is committed via hashes in the script structure
205+
206+
2. **Ownership Tracking**:
207+
* Token ownership is represented by control of the corresponding UTXOs
208+
* Standard Bitcoin wallet functionality can be used to track and manage tokens
209+
210+
### Security Considerations
211+
212+
PBTS mitigates various attack vectors through:
213+
214+
1. **Double Spending Prevention**:
215+
* Each token is tied to a specific UTXO
216+
* Standard Bitcoin consensus rules prevent double-spending
217+
218+
2. **Replay Attack Protection**:
219+
* Uses unique script conditions for each transfer
220+
* Includes sequence numbers where appropriate
221+
222+
3. **Fee Optimization**:
223+
* Taproot implementation minimizes transaction sizes
224+
225+
4. **Predictable Execution**:
226+
* No dynamic loops or unpredictable execution paths
227+
* All contract conditions are pre-defined at creation time
228+
229+
5. **Time-Based Security**:
230+
* Uses CHECKLOCKTIMEVERIFY to enforce time constraints
231+
* Ensures time-locked funds cannot be spent prematurely
232+
233+
## Reference Implementation
234+
235+
A reference implementation is available at: https://github.com/gobishanthan/pbts
236+
237+
### Prerequisites
238+
239+
* Bitcoin Core v28.1.0+ with RPC enabled
240+
* Go 1.16 or newer
241+
* A Bitcoin testnet or mainnet wallet with funds
242+
243+
### Basic Usage
244+
245+
```bash
246+
# Issue a new token
247+
./pbts issue "Programmable Bitcoin Token" "PBTS" 8 1000000000
248+
249+
# List all tokens
250+
./pbts list
251+
252+
# Create a time-locked vesting contract
253+
./pbts vest <token_id> <sender_pubkey> <receiver_pubkey> <amount> <unlock_date>
254+
255+
# Create a milestone-based escrow
256+
./pbts milestone <token_id> <sender> <receiver> <arbitrator> <amount> <milestone_count> \
257+
<milestone1_percentage> <milestone1_unlock_date> <milestone1_expiry_date> <milestone1_required_sigs> \
258+
<milestone2_percentage> <milestone2_unlock_date> <milestone2_expiry_date> <milestone2_required_sigs>
259+
```
260+
261+
## Examples
262+
263+
### Time-Locked Vesting Contract
264+
265+
A successful time-locked vesting contract implemented on Bitcoin testnet:
266+
267+
```bash
268+
./pbts vest 6ad138104a19ad3711a3ae6ec251f0c2 0234f63fb0b8acefb738a83f276ad6e5d18ec71613965c3f639f4158c3b07db1f4 03a7bd1d77432d2267813c908dca7ec7382a41a21a5da9e12d3726e63aae58bde3 10 2025-03-03
269+
```
270+
271+
Generated Output:
272+
```
273+
🔄 Creating auto-vesting transfer of 10.000000 tokens (ID: 6ad138104a19ad3711a3ae6ec251f0c2) to 03a7bd1d77432d2267813c908dca7ec7382a41a21a5da9e12d3726e63aae58bde3 (unlocks at: 2025-03-03T00:00:00Z)...
274+
Adjusting unlock time to ensure it's in the future: 2025-03-03T23:19:02-05:00
275+
Created Taproot address: tb1pkcvzu54pey9sjrj5qeu7xnvppe5k3w34spv7yhtfxxg56uyscsuq4uah44
276+
🏦 Auto-Vest Address: tb1pkcvzu54pey9sjrj5qeu7xnvppe5k3w34spv7yhtfxxg56uyscsuq4uah44 (unlocks at: 2025-03-03T23:19:02-05:00)
277+
✅ Auto-vest transfer transaction broadcasted! TXID: 8c64767e003ed0b5786be07dac35b48eb32e53095af7802d5179808c36e7869d
278+
```
279+
280+
This transaction (TXID: 8c64767e003ed0b5786be07dac35b48eb32e53095af7802d5179808c36e7869d) demonstrates a successful time-locked contract on Bitcoin testnet using Taproot functionality.
281+
282+
## Backward Compatibility
283+
284+
PBTS is fully backward compatible with the existing Bitcoin protocol. It:
285+
286+
1. Uses standard Bitcoin transactions
287+
2. Leverages existing opcode functionality
288+
3. Does not require any consensus changes
289+
4. Can coexist with other token standards
290+
291+
## Test Vectors
292+
293+
[To be added in future update]
294+
295+
## References
296+
297+
- **Bitcoin Improvement Proposals (BIPs):**
298+
- [BIP-341: Taproot](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
299+
- [BIP-342: Validation of Taproot Scripts](https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki)
300+
- [BIP-340: Schnorr Signatures](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)
301+
- **Technical Documentation:**
302+
- [Bitcoin Script Reference](https://en.bitcoin.it/wiki/Script)
303+
- [UTXO Model Specification](https://developer.bitcoin.org/devguide/transactions.html)
304+
- **Related Research:**
305+
- [RGB Protocol](https://rgb.tech/)
306+
- [Ordinals Specification](https://docs.ordinals.com/)
307+
- [Runes Documentation](https://runes.com/docs/)
308+

0 commit comments

Comments
 (0)