Steve Shadders

Intermediate Bitcoin Script

Bitcoin Script has a horrible debugging experience. This talk introduces a high-level language with a powerful debugger to make it finally readable and testable.

Intermediate Bitcoin Script
#1about 3 minutes

Understanding Bitcoin Script as a Forth-like language

Bitcoin Script is a compact and efficient stack-based language similar to Forth, making it ideal for the resource-constrained environment of blockchain transactions.

#2about 8 minutes

Improving Bitcoin Script readability with aliases and formatting

A custom Script Definition Language (SDL) improves the developer experience by removing OP_ prefixes, using aliases for operators, and enabling standard code formatting.

#3about 4 minutes

A better way to debug Bitcoin Script

Overcome the poor native debugging experience by using a tool that provides precise error locations and a stack dumping operator to inspect state during execution.

#4about 13 minutes

The stack and reverse polish notation explained

Stack-based languages operate using reverse polish notation (subject-object-verb), which is a more natural structure for machine execution than standard infix notation.

#5about 4 minutes

Compile-time versus runtime script execution

Understand the distinction between compile-time, where code is generated with known inputs, and runtime, where it executes with new inputs provided later.

#6about 12 minutes

Using variables and words in a script definition language

The Script Definition Language introduces features like comments, variables, and reusable code blocks called 'words' to structure and simplify complex scripts.

#7about 3 minutes

How to implement loops through compile-time unrolling

Since Bitcoin Script lacks native loop opcodes, loops can be implemented at compile time by unrolling the code, which repeats the script body a specified number of times.

#8about 2 minutes

Dynamic script generation with compile-time functions

The 'funk' keyword executes a function at compile time, enabling dynamic script generation based on the values of known inputs before runtime.

#9about 6 minutes

Building a dynamic byte reversal function

A practical example demonstrates creating a byte reversal script that dynamically adapts its loop count based on the input's length, calculated at compile time.

#10about 10 minutes

Q&A on script optimization, tooling, and advanced concepts

The session concludes with answers to audience questions on hardware acceleration, data limits, OP_CODESEPARATOR, and the future of the demonstrated scripting tool.

Related jobs
Jobs that call for the skills explored in this talk.

job ad

Saby Company
Delebio, Italy

Intermediate

d

Saby Company
Delebio, Italy

Junior

Featured Partners

Related Articles

View all articles
CH
Chris Heilmann
Dev Digest 138 - Are you secure about this?
Hello there! This is the 2nd "out of the can" edition of 3 as I am on vacation in Greece eating lovely things on the beach. So, fewer news, but lots of great resources. Many around the topic of security. Enjoy! News and ArticlesGoogle Pixel phones t...
Dev Digest 138 - Are you secure about this?
CH
Chris Heilmann
Dev Digest 131 - AI'm not sure about OSS
News and ArticlesRust and Typescript are rising stars in programming languages 2024 survey, the State of CSS 2024 survey is open and here is what's new in ECMAScript.In security news, a Microsoft update bricks Linux dual-boot systems, they patched a ...
Dev Digest 131 - AI'm not sure about OSS
CH
Chris Heilmann
All the videos of Halfstack London 2024!
Last month was Halfstack London, a conference about the web, JavaScript and half a dozen other things. We were there to deliver a talk, but also to record all the sessions and we're happy to share them with you. It took a bit as we had to wait for th...
All the videos of Halfstack London 2024!
CH
Chris Heilmann
Dev Digest 136 - No JS(on) of mine
News and ArticlesDouglas Crockford is our featured video, so let's talk about evolving JavaScript and all things JSON. Judicious JSON explains all the weird things in it, you can learn why it can be incredibly slow, people wonder what even is a JSON ...
Dev Digest 136 - No JS(on) of mine

From learning to earning

Jobs that call for the skills explored in this talk.

dev

dev

Testing slug
Vienna, Austria

Intermediate
Java
iOS Developer

iOS Developer

Bitmovin Test
Hamburg, Germany

Remote
60-65K
Intermediate
PHP
Java
Dev Ops Engineer

Dev Ops Engineer

Bitpanda
Vienna, Austria

Intermediate
Linux
Docker
Apache
Gitlab
Blockchain
+3