Interactive Learning Platform for Bitcoin Script Development
A modern, web-based playground for learning and experimenting with Bitcoin Script. Built with vanilla JavaScript, this tool provides an intuitive interface for understanding Bitcoin's scripting language through hands-on practice.
- Real-time script execution
- Syntax highlighting and validation
- Error handling with detailed messages
- Keyboard shortcuts (Ctrl+Enter to run)
- 30+ Bitcoin Script opcodes implemented
- Organized by categories: Stack, Arithmetic, Comparison, Bitwise, Logical, Constants, Verification
- Click-to-insert opcode functionality
- Detailed descriptions for each opcode
- Real-time stack visualization
- Animated stack operations
- Color-coded stack items
- Clear visual feedback
- Pre-built examples for different skill levels
- Basic math operations
- Comparison logic
- Multi-signature examples
- Advanced stack manipulation
- Generate shareable URLs for scripts
- Copy-to-clipboard functionality
- Easy script distribution
Simply open index.html
in your web browser - no setup required!
# Clone the repository
git clone https://github.com/polydeuces32/bitcoin-script-playground.git
cd bitcoin-script-playground
# Start local server
python3 -m http.server 8000
# or
npx serve .
# Open in browser
open http://localhost:8000
OP_1 OP_2 OP_ADD OP_DUP
Result: Stack contains [3, 3]
OP_5 OP_3 OP_ADD OP_8 OP_EQUAL
Result: Stack contains [1]
(true)
OP_1 OP_2 OP_3 OP_ROT OP_SWAP
Result: Stack contains [2, 1, 3]
OP_DUP
- Duplicates the top stack itemOP_2DUP
- Duplicates the top two stack itemsOP_DROP
- Removes the top stack itemOP_SWAP
- Swaps the top two stack itemsOP_OVER
- Copies the second-to-top item to the topOP_ROT
- Rotates the top 3 stack items
OP_ADD
- Adds the top two stack itemsOP_SUB
- Subtracts the second item from the firstOP_MUL
- Multiplies the top two stack itemsOP_DIV
- Divides the second item by the firstOP_MOD
- Returns the remainder of division
OP_EQUAL
- Returns 1 if top two items are equalOP_EQUALVERIFY
- Same as OP_EQUAL but runs OP_VERIFY afterwardOP_1EQUAL
- Returns 1 if input is 1, 0 otherwiseOP_0NOTEQUAL
- Returns 1 if input is not 0, 0 otherwise
OP_AND
- Bitwise AND of the top two itemsOP_OR
- Bitwise OR of the top two itemsOP_XOR
- Bitwise XOR of the top two itemsOP_NOT
- Bitwise NOT of the top item
OP_BOOLAND
- Boolean AND of the top two itemsOP_BOOLOR
- Boolean OR of the top two items
OP_0
throughOP_5
- Push numbers 0-5 onto stack
OP_VERIFY
- Marks transaction as invalid if top stack value is not trueOP_RETURN
- Marks transaction as invalid
This playground is perfect for:
- Bitcoin developers learning script fundamentals
- Students understanding stack-based programming
- Cryptocurrency enthusiasts exploring Bitcoin's scripting capabilities
- Educators teaching blockchain concepts
- More Bitcoin Script opcodes
- Script validation against Bitcoin rules
- Transaction simulation
- Cost estimation
- Multi-signature script builder
- P2SH/P2WSH support
- Real Bitcoin testnet integration
- Script optimization suggestions
- User accounts and authentication
- Script library and sharing
- Collaborative editing
- API access for developers
- Premium features and subscriptions
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Bitcoin Core developers for the original Bitcoin Script specification
- The Bitcoin community for continuous innovation
- Contributors and users who provide feedback and suggestions
- ๐ Bug Reports: GitHub Issues
- ๐ก Feature Requests: GitHub Discussions
- ๐ง Contact: polydeuces32@github.com
โญ Star this repository if you find it helpful!
Made with โค๏ธ for the Bitcoin community