Data types in the Arkade Script language
Experimental Technology
The Arkade Language is experimental technology in active development. All code and examples presented here are for exploration and proof of concept purposes only. Do not use in production environments.
Arkade Script provides a rich set of data types designed specifically for Bitcoin smart contracts. These types help ensure contract correctness and provide clear semantics for working with Bitcoin’s UTXO model.
The bool
type represents a boolean value (true or false):
Boolean values are used in conditional statements and logical operations.
The int
type represents a signed integer:
Integers in Arkade Script are implemented as 64-bit signed integers, allowing for a range from -2^63 to 2^63-1.
The pubkey
type represents a Bitcoin public key:
Public keys are used for signature verification and address generation.
The signature
type represents a Bitcoin signature:
Signatures are typically provided as function parameters and used with checkSig
or checkMultisig
functions.
The bytes
type represents an arbitrary byte array:
Byte arrays can be used for arbitrary data storage and manipulation.
Fixed-size byte arrays specify the exact number of bytes:
Common fixed-size types include:
bytes20
: Typically used for RIPEMD-160 hashes or Hash160 resultsbytes32
: Typically used for SHA-256 hashesbytes33
: Typically used for compressed public keysThe asset
type represents an Asset:
Asset types are used for working with assets in contracts. They provide identifiers and the terms of the asset, such as supply.
Arrays can hold multiple values of the same type:
Arrays support indexing and length properties:
Structs group related data together:
Struct fields are accessed using dot notation:
Explicit type conversion is performed using casting syntax:
Some types can be implicitly converted:
int
bytes
bytes
or fixed-size byte arraysThe tx
object provides access to transaction data:
The input
type represents a transaction input:
The current input being spent can be accessed directly:
The output
type represents a transaction output:
The size of a value in bytes can be obtained using the size
property:
The type of a value can be checked at runtime:
Some types can be null, indicating the absence of a value:
Arkade Script is statically typed, meaning type checking is performed at compile time:
This helps catch errors before contracts are deployed.
Understanding how types are represented in memory can be important for advanced contract development:
bool
: 1 byte (0 for false, 1 for true)int
: 8 bytes (little-endian)pubkey
: 33 bytes (compressed) or 65 bytes (uncompressed)signature
: 64 bytes (Schnorr) or 71-73 bytes (ECDSA)bytes
: Variable length with size prefixArkade Script’s type system is designed to provide both safety and expressiveness for Bitcoin smart contract development. By using appropriate types, you can make your contracts more readable and less prone to errors.
For more information on how to use these types with functions, see the Arkade Functions page.