Import or compile Plutus Validator Scripts (Cardano Smart Contracts) from built CBOR, or from source code using languages like Helios.
When importing an already built Plutus Script providing CBOR, this function will also try to deserialize it and calculate it's hash.
When building from source code like with Helios language, you are compiling Plutus Validators on-the-fly during dapp connection, and this have advantages like instant parametrization of built code, and reusability of code-artifacts like datums produced in-language. This can reduce incompatibilities as each language may use their own preferred data type formats. This function also will calculate the hash of the new compiled script.
A common design pattern is to use the produced hash scriptHashHex
to built smart contract addresses for example, while using the produced CBOR scriptHex
and script reference CBOR scriptRefHex
to deploy the contract on-chain or use it inlined on a transaction.
{
"type": "plutusScript",
"script": {
"scriptHex": "4746010000222499",
"lang": "plutus_v2"
}
}
{
"type": "plutusScript",
"script": {
"heliosCode": "{replaceAll(hexToStr('0a7370656e64696e672074696d655f6c6f636b0a0a73747275637420446174756d207b0a202020206c6f636b556e74696c3a20202054696d650a202020206f776e65723a202020202020205075624b657948617368202f2f20746865206f776e65722063616e20616c7761797320756e6c6f636b20746865206173736574730a2020202062656e65666963696172793a205075624b657948617368202f2f2062656e65666963696172792063616e206f6e6c7920756e6c6f636b207468652061737365747320616674657220276c6f636b556e74696c270a7d0a0a66756e63206d61696e28646174756d3a20446174756d2c205f2c206374783a20536372697074436f6e7465787429202d3e20426f6f6c207b0a2020202074783a205478203d206374782e74783b0a202020206e6f773a2054696d65203d2074782e74696d655f72616e67652e73746172743b0a0a2020202074782e69735f7369676e65645f627928646174756d2e6f776e657229207c7c20280a202020202020202074782e69735f7369676e65645f627928646174756d2e62656e6566696369617279292026260a20202020202020206e6f77203e20646174756d2e6c6f636b556e74696c0a20202020290a7d0a20202020202020200a636f6e7374204558414d504c455f444154554d203a446174756d203d20446174756d7b0a2020202054696d653a3a6e6577284578616d706c6554696d65292c0a202020205075624b6579486173683a3a6e657728233031323334353637383961626364663031323334353637383961626364663031323334353637383961626364663031323334353637383961292c0a202020205075624b6579486173683a3a6e657728236664636261393837363534333231306664636261393837363534333231306664636261393837363534333231306664636261393837363534290a7d0a0a'),'ExampleTime','1234')}",
"parameters": [
"EXAMPLE_DATUM"
],
"version": "0.15.2",
"simplify": false
}
}
"plutusScript"
Wallet stores locally specific objects for later reuse. This is the name property of this record. Names can collide. If name is present, this item will be stored locally on you wallet
Plutus on-chain validator code, also known as 'Cardano smart contracts'
Plutus Script (Hexadecimal)
No Additional PropertiesPlutus Script in hexadecimal encoding
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
Reserved language functions
any
): void
;The function return allows you to stop execution of inline code block at that position and return a value as result
of entire block execution.
any
) - value to return [OPTIONAL]The function fail() is similar but halts the execution of entire script with failure instead.
(?<![\w_])return\s*\(.*\)(?![\w_])
"{ return(5) }"
"{ return('Hello World!') }"
"{ return(get('cache.myAddress')) }"
string
): void
;The function fail allows you to stop execution of inline code block at that position and also entire script execution in error state.
User can provide a message
as argument to became the message of the error to be thrown.
string
) - error message to throw [OPTIONAL]The function return() is similar but halts the execution of inline code block successfully, returning a value.
(?<![\w_])fail\s*\(.*\)(?![\w_])
"{ fail('This is an error message') }"
"{ fail() }"
System functions for memory management, logging, etc..
string
, value: any
): any
;The function set allows you to set arbitrary data on script context for later reuse.
string
) - path of the value to set any
) - variable to store Use get() with path='global.<path>'
to access and reuse the value later
(?<![\w_])set\s*\(.*\)(?![\w_])
"{ set('temp1','Hello World!') }"
"{ set('temp2',get('global.temp1')) }"
string
): any
;The function get allows you to get arbitrary data from script context.
string
) - path of the value to retrieve Use set() function to declare user variables inside a global
object which you can later access using get()
(?<![\w_])get\s*\(.*\)(?![\w_])
"{ get('cache.myAddress') }"
"{ get('cache.buildTransaction.txHex') }"
"{ set('temp1','Hello World!'); get('global.temp1'); }"
'log'|'info'|'warn'|'error'
, ...values: any
): void
;Dumps to console one or several values
, which can be string messages or of any type
'log'|'info'|'warn'|'error'
) - value to pretty print in the logs any
) - value to pretty print in the logs [REST](?<![\w_])console\s*\(.*\)(?![\w_])
"{ console('log','This is a log') }"
"{ console('info','This is an information') }"
"{ console('warn','This is a warning') }"
"{ console('error','This is an error') }"
"{ console('info','Hello web3 user!','Your address is:', get('cache.myAddress')) }"
"{ console('log',get('global.temp1')) }"
String manipulation functions
string
, prefixLength: number
, suffixLength: number
, separator: string
): string
;Truncates a string from start to prefixLength
characters, attaches a separator
string, and finally adds the last suffixLength
characters of the string
Useful for truncating long texts, or hashes and addresses when you want to keep the beginning and the end of them and discard the middle.
string
) - utf-8 string to be truncated number
) - initial number of characters to be included in resulting string number
) - final number of characters to be included in resulting string string
) - string to be included between prefix and suffix parts of the string addr1qzk45...kwg (prefixLength
=10 ,suffixLength
=3, separator
="...")
(?<![\w_])truncate\s*\(.*\)(?![\w_])
string
, match: string
, value: string
): string
;Replaces all match
occurrences inside text
by value
string
) - utf-8 string where to search and replace string
) - utf-8 exact string that will be searched for and replaced by value
string
) - utf-8 string value to replace with (?<![\w_])replaceAll\s*\(.*\)(?![\w_])
Array manipulation functions
Type: stringany
): array
;Returns an array with each provided argument as an item
any
) - items of the array of any type [REST]base
(?<![\w_])getArray\s*\(.*\)(?![\w_])
"{ getArray('apple','banana',43, get('cache.address')) }"
Encoding and decoding functions
string
): any
;Parses a JSON string and returns a value of JSON-supported type
string
) - string value to parse, must be a valid JSON string Use objToJson() function to serialize JSON
(?<![\w_])jsonToObj\s*\(.*\)(?![\w_])
any
): string
;Turns a value of JSON-supported type into a JSON string
any
) - value to serialize as JSON string Use jsonToObj() function to parse JSON
(?<![\w_])objToJson\s*\(.*\)(?![\w_])
string
): string
;Encodes a utf-8 text string into hexadecimal string
string
) - utf-8 text string Use hexToStr() function to decode from hexadecimal encoding
(?<![\w_])strToHex\s*\(.*\)(?![\w_])
string
): string
;Decodes an hexadecimal string into the former utf-8 text string
string
) - hexadecimal encoded string Use strToHex() function to encode using hexadecimal encoding
(?<![\w_])hexToStr\s*\(.*\)(?![\w_])
string
): string
;Encodes a utf-8 text string into base64 string
string
) - utf-8 text string Use base64ToStr() function to decode from base64 encoding
(?<![\w_])strToBase64\s*\(.*\)(?![\w_])
string
): string
;Decodes a base64 string into a utf-8 text string
string
) - base64 encoded string Use strToBase64() function to encode using base64 encoding
(?<![\w_])base64ToStr\s*\(.*\)(?![\w_])
string
): string|string[]
;Automatically splits a utf-8 text string into a list of 64 bytes long strings if value
length is bigger than 64 bytes
Otherwise, it returns the original string
Strings in Cardano transaction's auxiliary data (metadata) can't be longer than 64 bytes.
Many standards use a list of short strings as a workaround.
string
) - utf-8 text to be adapted for metadata usage Use metadataStrToStr() function to convert back to string a metadata string
(?<![\w_])strToMetadataStr\s*\(.*\)(?![\w_])
string|string[]
): string
;If a list of strings ( produced by strToMetadataStr
) is provided, joins it into a single string
If a string is provided, returns the string
Strings in transaction's auxiliary data (metadata) can't be longer than 64 bytes.
Many standards use a list of short strings as a workaround.
string|string[]
) - string or list of strings produced by strToMetadataStr() Use strToMetadataStr() function to convert a string into a metadata string
(?<![\w_])metadataStrToStr\s*\(.*\)(?![\w_])
Cryptographic functions
string
): object
;Parses a Cardano address
and returns information as an object with many useful properties
string
) - a valid Cardano address (?<![\w_])getAddressInfo\s*\(.*\)(?![\w_])
string
): string
;Calculates SHA512 hash of data
string
string
) - utf-8 string to be hashed (?<![\w_])sha512\s*\(.*\)(?![\w_])
string
): string
;Calculates SHA256 hash of data
string
string
) - utf-8 string to be hashed (?<![\w_])sha256\s*\(.*\)(?![\w_])
string
): string
;Calculates SHA1 hash of data
string
string
) - utf-8 string to be hashed (?<![\w_])sha1\s*\(.*\)(?![\w_])
string
): string
;Calculates MD5 hash of data
string
string
) - utf-8 string to be hashed (?<![\w_])md5\s*\(.*\)(?![\w_])
Arithmetic functions
string|number
, ...addends: string|number
): string
;Adds extraArgs
numbers to an initial value
.
BigNum are big positive integers provided as strings.
This function also convert numbers on arguments into BigNum string
Returns the sum as a BigNum string.
string|number
) - initial value (BigNum) string|number
) - value or values to be added (BigNum) [REST](?<![\w_])addBigNum\s*\(.*\)(?![\w_])
string|number
, ...subtrahends: string|number
): string
;Subtracts subtrahends
numbers from an initial value
minuend. Fails on underflow.
BigNum are big positive integers provided as strings.
This function also convert numbers on arguments into BigNum string
Returns the subtraction as a BigNum string.
string|number
) - minuend, initial value (BigNum) string|number
) - value or values to be subtracted (BigNum) [REST](?<![\w_])subBigNum\s*\(.*\)(?![\w_])
string|number
, ...multipliers: string|number
): string
;Multiplies multipliers
numbers to an initial value
.
BigNum are big positive integers provided as strings.
This function also convert numbers on arguments into BigNum string
Returns the multiplication as a BigNum string.
string|number
) - initial value (BigNum) string|number
) - value or values to be multiplied with (BigNum) [REST](?<![\w_])mulBigNum\s*\(.*\)(?![\w_])
^\{(.|[\r\n])*\}$
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
Helios Code to be compiled. Can be used not only to generate Plutus Validators and Parameterized Plutus Validators (Cardano Smart Contracts) but also Helios-compatible Plutus Data structures using parameter exports.
No Additional PropertiesHelios code as string that will be compiled. To avoid GCScript XSS filters to modify some Helios language operators, pass the code on other encoding, such as hexadecimal string. Dynamic code compilation allows you to generate parameterized plutus validator code on user wallet side.
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
"{hexToStr('0a7370656e64696e672074696d655f6c6f636b0a0a73747275637420446174756d207b0a202020206c6f636b556e74696c3a20202054696d650a202020206f776e65723a202020202020205075624b657948617368202f2f20746865206f776e65722063616e20616c7761797320756e6c6f636b20746865206173736574730a2020202062656e65666963696172793a205075624b657948617368202f2f2062656e65666963696172792063616e206f6e6c7920756e6c6f636b207468652061737365747320616674657220276c6f636b556e74696c270a7d0a0a66756e63206d61696e28646174756d3a20446174756d2c205f2c206374783a20536372697074436f6e7465787429202d3e20426f6f6c207b0a2020202074783a205478203d206374782e74783b0a202020206e6f773a2054696d65203d2074782e74696d655f72616e67652e73746172743b0a0a2020202074782e69735f7369676e65645f627928646174756d2e6f776e657229207c7c20280a202020202020202074782e69735f7369676e65645f627928646174756d2e62656e6566696369617279292026260a20202020202020206e6f77203e20646174756d2e6c6f636b556e74696c0a20202020290a7d0a20202020202020200a636f6e7374204558414d504c455f444154554d203a446174756d203d20446174756d7b0a2020202054696d653a3a6e6577284578616d706c6554696d65292c0a202020205075624b6579486173683a3a6e657728233031323334353637383961626364663031323334353637383961626364663031323334353637383961626364663031323334353637383961292c0a202020205075624b6579486173683a3a6e657728236664636261393837363534333231306664636261393837363534333231306664636261393837363534333231306664636261393837363534290a7d0a0a')}"
"{replaceAll(hexToStr('0a7370656e64696e672074696d655f6c6f636b0a0a73747275637420446174756d207b0a202020206c6f636b556e74696c3a20202054696d650a202020206f776e65723a202020202020205075624b657948617368202f2f20746865206f776e65722063616e20616c7761797320756e6c6f636b20746865206173736574730a2020202062656e65666963696172793a205075624b657948617368202f2f2062656e65666963696172792063616e206f6e6c7920756e6c6f636b207468652061737365747320616674657220276c6f636b556e74696c270a7d0a0a66756e63206d61696e28646174756d3a20446174756d2c205f2c206374783a20536372697074436f6e7465787429202d3e20426f6f6c207b0a2020202074783a205478203d206374782e74783b0a202020206e6f773a2054696d65203d2074782e74696d655f72616e67652e73746172743b0a0a2020202074782e69735f7369676e65645f627928646174756d2e6f776e657229207c7c20280a202020202020202074782e69735f7369676e65645f627928646174756d2e62656e6566696369617279292026260a20202020202020206e6f77203e20646174756d2e6c6f636b556e74696c0a20202020290a7d0a20202020202020200a636f6e7374204558414d504c455f444154554d203a446174756d203d20446174756d7b0a2020202054696d653a3a6e6577284578616d706c6554696d65292c0a202020205075624b6579486173683a3a6e657728233031323334353637383961626364663031323334353637383961626364663031323334353637383961626364663031323334353637383961292c0a202020205075624b6579486173683a3a6e657728236664636261393837363534333231306664636261393837363534333231306664636261393837363534333231306664636261393837363534290a7d0a0a'),'ExampleTime','1234')}"
Simplifies produced CBOR hexadecimal output and removes debugging traces. This will produce script changes, and can lead to script hash, address, policy id and other unwanted changes.
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
Helios compiler version. A change in version can produce script changes, and this can lead to script hash, address, policy id and other unwanted changes.
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
List or Key-Value Map of Exported Parameters. Must be in uppercase and compatible with Helios parameter naming conventions. Useful to build Plutus Data from Helios Code
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
Must contain a minimum of 1
items
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:
Inline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
"EXPORTS"
"DATUM_EXAMPLE"
Plutus Code to be compiled
No Additional PropertiesInline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.
Marlowe Code to be compiled
No Additional PropertiesInline Scripting Language (ISL) is a complementary programming language to process, format, reuse, link, or pipe GCScript function results with other function arguments, designed to avoid bad practices such as deep nested code and complex code logic expressed in JSON.
Code functions help you to perform memory, string, arithmetic, cryptographic, encoding, logging, debugging, and other useful secondary operations not supported by primary GCScript API functions.
Almost all GCScript function arguments supports ISL.
All arguments passing a string value starting with {
and terminating with }
and containing calls of one or many ISL functions separated with ;
will be interpreted as an ISL code block and will be executed.
The entire ISL code block will be replaced by it's results prior executing the GCScript function, key behavior that makes GCScript more flexible and dynamic.
Otherwise, if syntax rules are not met on GCScript function arguments, interpreter will use these strings as string values instead of ISL executable code.
ISL syntax is a subset of Javascript syntax. It's a deterministic, non-turing complete language, same as GCScript language itself.