Ride V7 Functions#
Note
Generated from node-scala commit 104ddc70e8 by docs/scripts/generate_ride_reference.py. The generator reads the compiled standard library the node evaluates scripts with, not the Scala source text, so every cost on this page is the one the node charges at STDLIB_VERSION 7. To change this page, change the generator or move it to a newer node-scala commit and regenerate. CI fails on any hand edit.
STDLIB_VERSION 7 has 212 built-in functions and operators, counting each overload separately: 0 are new in V7 and 0 cost a different amount than in V6. Each table row is one overload, so a function with several signatures has one row per signature.
Complexity is what one call adds to the script’s complexity, as charged by the node’s current estimator. The limits that complexity counts against are on Limitations. Unless the description says otherwise, a function is available in account scripts, asset scripts and dApp scripts alike.
Account data storage functions#
Function |
Complexity |
Description |
|---|---|---|
|
10 |
Gets account balance by token ID. |
|
10 |
Gets account dcc balance details. |
|
10 |
Gets an array of bytes by key. |
|
10 |
Gets an array of bytes by key. Throws an exception if there is no data. |
|
10 |
Gets a boolean value by key. |
|
10 |
Gets a boolean value by key. Throws an exception if there is no data. |
|
10 |
Gets an integer by key. |
|
10 |
Gets an integer by key. Throws an exception if there is no data. |
|
10 |
Gets a string by key. |
|
10 |
Gets a string by key. Throws an exception if there is no data. |
|
10 |
Check that no data was stored on account. |
Account self-data storage functions#
Function |
Complexity |
Description |
|---|---|---|
|
10 |
Gets an array of bytes by key from state of current account. Not available in asset scripts. |
|
10 |
Gets an array of bytes by key from state of current account. Throws an exception if there is no data. Not available in asset scripts. |
|
10 |
Gets a boolean value by key from state of current account. Not available in asset scripts. |
|
10 |
Gets a boolean value by key from state of current account. Throws an exception if there is no data. Not available in asset scripts. |
|
10 |
Gets an integer by key from state of current account. Not available in asset scripts. |
|
10 |
Gets an integer by key from state of current account. Throws an exception if there is no data. Not available in asset scripts. |
|
10 |
Gets a string by key from state of current account. Not available in asset scripts. |
|
10 |
Gets a string by key from state of current account. Throws an exception if there is no data. Not available in asset scripts. |
Blockchain functions#
Function |
Complexity |
Description |
|---|---|---|
|
15 |
Gets the information about a token. |
|
5 |
Gets the information about a block by the block height. |
|
10 |
Calculates ID of asset obtained by invoke script transaction’s call of the Issue structure. |
|
1 |
Calculates ID of lease obtained by invoke script transaction’s call of the Lease structure. |
|
75 |
Invoke function from other dApp. dApp scripts only. |
|
75 |
Invoke function from other dApp allowing reentrancy to the current one. dApp scripts only. |
|
200 |
blake2b hash of account’s script. |
|
20 |
Gets the block height of a transaction. |
|
60 |
Gets the data of a transfer transaction. |
|
5 |
Deserializes transfer transaction: converts protobuf-encoded binary format to a TransferTransaction structure. |
Byte array functions#
Function |
Complexity |
Description |
|---|---|---|
|
6 |
Drops the first n bytes of an array of bytes. |
|
6 |
Drops the first n bytes of an array of bytes. |
|
1 |
Returns the size of an array of bytes. |
|
6 |
Takes the first n bytes from an array of bytes. |
|
6 |
Takes the last n bytes from an array of bytes. |
Converting functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Converts account public key to address. |
|
5 |
Extract address or lookup alias. |
|
65 |
Converts an string to an integer. |
|
65 |
Converts an string to an integer. |
|
2 |
Converts the string representation of a number to its integer equivalent. |
|
2 |
Converts the string representation of a number to its integer equivalent. Raises an exception if the string cannot be parsed. |
|
65 |
Converts an array of bytes to an big integer. |
|
65 |
Converts an array of bytes to an big integer. |
|
1 |
Converts an integer to an integer. |
|
65 |
Converts an BigInt to an array of bytes. |
|
1 |
Converts a boolean to an array of bytes. |
|
1 |
Converts an integer to an array of bytes. |
|
8 |
Converts a string to an array of bytes. |
|
1 |
Converts a BigInt to an integer. |
|
1 |
Converts an array of bytes to an integer. |
|
1 |
Converts an array of bytes to an integer starting from a certain index. |
|
1 |
Convert address bytes to string. |
|
1 |
Convert BigInt to string. |
|
1 |
Converts a boolean to a string. |
|
1 |
Converts an integer to a string. |
|
7 |
Converts an array of bytes to a UTF-8 string. |
Encoding and decoding functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Decodes address from Base58 string. |
|
1 |
Decodes address from Base58 string. Raises an exception if the address cannot be decoded. |
|
136 |
BLAKE-256 hash function. |
|
115 |
BLAKE-256 hash function. For array with size <= 128Kb. |
|
13 |
BLAKE-256 hash function. For array with size <= 16Kb. |
|
29 |
BLAKE-256 hash function. For array with size <= 32Kb. |
|
58 |
BLAKE-256 hash function. For array with size <= 64Kb. |
|
70 |
Recovers the public key from hash of ECDSA-encoded message and signature. |
|
10 |
Decodes Base16 string to an array of bytes. |
|
1 |
Decodes Base58 string to an array of bytes. |
|
40 |
Decodes Base64 string to an array of bytes. |
|
195 |
Keccak-256 hash function. |
|
147 |
Keccak-256 hash function. For array with size <= 128Kb. |
|
20 |
Keccak-256 hash function. For array with size <= 16Kb. |
|
39 |
Keccak-256 hash function. For array with size <= 32Kb. |
|
74 |
Keccak-256 hash function. For array with size <= 64Kb. |
|
118 |
SHA-256 hash function. |
|
93 |
SHA-256 hash function. For array with size <= 128Kb. |
|
12 |
SHA-256 hash function. For array with size <= 16Kb. |
|
23 |
SHA-256 hash function. For array with size <= 32Kb. |
|
47 |
SHA-256 hash function. For array with size <= 64Kb. |
|
10 |
Encodes array of bytes to Base16 string. |
|
3 |
Encodes array of bytes to Base58 string. |
|
35 |
Encodes array of bytes to Base64 string. |
Exception functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Raises an exception. |
|
1 |
Raises an exception with a message. |
Extracting data functions#
Function |
Complexity |
Description |
|---|---|---|
|
4 |
Gets a binary value from a list of data entries by index. |
|
10 |
Gets a binary value from a list of data entries by key. |
|
4 |
Extract data by index (fail on error). |
|
10 |
Find and extract data by key (fail on error). |
|
4 |
Gets a boolean value from a list of data entries by index. |
|
10 |
Gets a boolean value from a list of data entries by key. |
|
4 |
Extract data by index (fail on error). |
|
10 |
Find and extract data by key (fail on error). |
|
4 |
Gets integer from a list of data entries by index. |
|
10 |
Gets integer from a list of data entries by key. |
|
4 |
Extract data by index (fail on error). |
|
10 |
Find and extract data by key (fail on error). |
|
4 |
Gets a string value from a list of data entries by index. |
|
10 |
Gets a string value from a list of data entries by key. |
|
4 |
Extract data by index (fail on error). |
|
10 |
Find and extract data by key (fail on error). |
Internal functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Issue action simplified constructor. |
|
1 |
Issue action detailed constructor. |
|
1 |
Lease action simplified constructor. |
|
1 |
Lease action detailed constructor. |
|
1 |
Number of elements of the tuple. |
List functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Prepends a new element to the list. |
|
5 |
Tests whether the list contains a given value as an element. |
|
2 |
Gets an element from a list by index. |
|
5 |
Returns the index of the first occurrence of given value. |
|
5 |
Returns the index of the last occurrence of given value. |
|
1 |
Returns all the elements of the list in a string using the separator string. Input list size limit = 70. Output string size limit = 500 bytes. |
|
11 |
Returns all the elements of the list in a string using the separator string. Input list size limit = 1000. Output string size limit = 32767 bytes. |
|
2 |
Returns all the elements of the list in a string using the separator string. Input list size limit = 100. Output string size limit = 6000 bytes. |
|
192 |
Returns the maximum of the list. |
|
3 |
Returns the maximum of the list. |
|
160 |
Returns the median of the list. |
|
20 |
Returns the median of the list. |
|
192 |
Returns the minimum of the list. |
|
3 |
Returns the minimum of the list. |
|
7 |
Removes the element at given index from the list and returns new list. |
|
2 |
Returns the size of a list. |
Math functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Multiply and division with unlimited intermediate representation. |
|
1 |
Multiply and division with unlimited intermediate representation. |
|
1 |
Multiply and division with unlimited intermediate representation. |
|
1 |
Multiply and division with big integer intermediate representation. |
|
200 |
Returns the logarithm of a number. |
|
100 |
Returns the logarithm of a number. |
|
270 |
Returns a number raised to a power. |
|
28 |
Returns a number raised to a power. |
|
5 |
Returns a square root. |
|
2 |
Returns a square root. |
Operators#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Unary negation. |
|
1 |
Check inequality. |
|
64 |
Calculate big modulo. |
|
1 |
Calculate modulo. |
|
64 |
Multiply big integers. |
|
1 |
Multiply integers. |
|
8 |
Sum big integers. |
|
2 |
Concat limited byte vectors. |
|
1 |
Sum integers. |
|
1 |
Concat limited strings. |
|
4 |
List Concatenation. |
|
8 |
Change integer sign. |
|
8 |
Subtract big integers. |
|
1 |
Change integer sign. |
|
1 |
Subtract integers. |
|
64 |
Divide big integers. |
|
1 |
Divide integers. |
|
1 |
Adding the element to the end of the list. |
|
1 |
Check equality. |
|
8 |
Check if integer greater comparison. |
|
1 |
Check if integer greater comparison. |
|
8 |
Check if integer greater or equal comparison. |
|
1 |
Check if integer greater or equal comparison. |
Optional value functions#
Function |
Complexity |
Description |
|---|---|---|
|
1 |
Checks if a value is not |
|
2 |
Extract value from option or fail. |
|
2 |
Returns value from union type argument if it’s not unit. Otherwise, returns the second argument. |
|
2 |
Extract value from option or fail with message. |
String functions#
Function |
Complexity |
Description |
|---|---|---|
|
3 |
Checks whether the string contains substring. |
|
20 |
Drops the first n characters of a string. |
|
20 |
Drops the last n characters of a string. |
|
3 |
Returns the index of the first occurrence of a substring. |
|
3 |
Returns the index of the first occurrence of a substring after a certain index. |
|
3 |
Returns the index of the last occurrence of a substring. |
|
3 |
Returns the index of the last occurrence of a substring after a certain index. |
|
1 |
Returns the size of a string. |
|
1 |
Splits a string delimited by a separator into a list of substrings. Input string size limit = 500 bytes. Output list size limit = 20. |
|
4 |
Splits a string delimited by a separator into a list of substrings. Input string size limit = 6000 bytes. Output list size limit = 100. |
|
51 |
Splits a string delimited by a separator into a list of substrings. Input string size limit = 32767 bytes. Output list size limit = 1000. |
|
20 |
Takes the first n characters from a string. |
|
20 |
Takes the last n characters from a string. |
Verification functions#
Function |
Complexity |
Description |
|---|---|---|
|
1650 |
Zero-knowledge proof verifier function. |
|
1300 |
Zero-knowledge proof verifier function. With 10 inputs. |
|
1350 |
Zero-knowledge proof verifier function. With 11 inputs. |
|
1400 |
Zero-knowledge proof verifier function. With 12 inputs. |
|
1450 |
Zero-knowledge proof verifier function. With 13 inputs. |
|
1550 |
Zero-knowledge proof verifier function. With 14 inputs. |
|
1600 |
Zero-knowledge proof verifier function. With 15 inputs. |
|
800 |
Zero-knowledge proof verifier function. With 1 input. |
|
850 |
Zero-knowledge proof verifier function. With 2 inputs. |
|
950 |
Zero-knowledge proof verifier function. With 3 inputs. |
|
1000 |
Zero-knowledge proof verifier function. With 4 inputs. |
|
1050 |
Zero-knowledge proof verifier function. With 5 inputs. |
|
1100 |
Zero-knowledge proof verifier function. With 6 inputs. |
|
1150 |
Zero-knowledge proof verifier function. With 7 inputs. |
|
1200 |
Zero-knowledge proof verifier function. With 8 inputs. |
|
1250 |
Zero-knowledge proof verifier function. With 9 inputs. |
|
30 |
Calculates the Merkle root hash for transactions of block. |
|
2700 |
Zero-knowledge proof verifier function. |
|
2100 |
Zero-knowledge proof verifier function. With 10 inputs. |
|
2200 |
Zero-knowledge proof verifier function. With 11 inputs. |
|
2300 |
Zero-knowledge proof verifier function. With 12 inputs. |
|
2400 |
Zero-knowledge proof verifier function. With 13 inputs. |
|
2500 |
Zero-knowledge proof verifier function. With 14 inputs. |
|
2600 |
Zero-knowledge proof verifier function. With 15 inputs. |
|
1200 |
Zero-knowledge proof verifier function. With 1 input. |
|
1300 |
Zero-knowledge proof verifier function. With 2 inputs. |
|
1400 |
Zero-knowledge proof verifier function. With 3 inputs. |
|
1500 |
Zero-knowledge proof verifier function. With 4 inputs. |
|
1600 |
Zero-knowledge proof verifier function. With 5 inputs. |
|
1700 |
Zero-knowledge proof verifier function. With 6 inputs. |
|
1800 |
Zero-knowledge proof verifier function. With 7 inputs. |
|
1900 |
Zero-knowledge proof verifier function. With 8 inputs. |
|
2000 |
Zero-knowledge proof verifier function. With 9 inputs. |
|
1000 |
Verifies an RSA signature. |
|
750 |
Verifies an RSA signature. For message size <= 128Kb. |
|
500 |
Verifies an RSA signature. For message size <= 16Kb. |
|
550 |
Verifies an RSA signature. For message size <= 32Kb. |
|
625 |
Verifies an RSA signature. For message size <= 64Kb. |
|
180 |
Verifies a Curve25519 signature. |
|
150 |
Verifies a Curve25519 signature. For message size <= 128Kb. |
|
50 |
Verifies a Curve25519 signature. For message size <= 16Kb. |
|
64 |
Verifies a Curve25519 signature. For message size <= 32Kb. |
|
93 |
Verifies a Curve25519 signature. For message size <= 64Kb. |
|
43 |
Verifies a Curve25519 signature. For message size <= 16Kb. |