waves_logo Docs
  • Ride Programming Language
    Ride Programming Language
  • Getting Started
    Getting Started
  • Syntax Basics
    • Directives
      Directives
    • Definition
      Definition
    • Expression
      Expression
    • Variable
      Variable
    • Function
      Function
    • Exception
      Exception
    • Comment
      Comment
    Syntax Basics
  • Script Types
    • dApp Script
      • Annotations
        Annotations
      • Callable Function
        Callable Function
      • Verifier Function
        Verifier Function
      dApp Script
    • Account Script
      Account Script
    • Asset Script
      Asset Script
    Script Types
  • Standard Library
    Standard Library
  • Data types
    • Any
      Any
    • BigInt
      BigInt
    • Boolean
      Boolean
    • ByteVector
      ByteVector
    • Int
      Int
    • String
      String
    • Unit
      Unit
    • List
      List
    • Tuple
      Tuple
    • Union
      Union
    Data types
  • Structures
    • Script Actions
      • BinaryEntry
        BinaryEntry
      • BooleanEntry
        BooleanEntry
      • Burn
        Burn
      • DeleteEntry
        DeleteEntry
      • IntegerEntry
        IntegerEntry
      • Issue
        Issue
      • Lease
        Lease
      • LeaseCancel
        LeaseCancel
      • Reissue
        Reissue
      • ScriptTransfer
        ScriptTransfer
      • SponsorFee
        SponsorFee
      • StringEntry
        StringEntry
      Script Actions
    • Common Structures
      • Address
        Address
      • Alias
        Alias
      • Asset
        Asset
      • AssetPair
        AssetPair
      • AttachedPayment
        AttachedPayment
      • BalanceDetails
        BalanceDetails
      • BlockInfo
        BlockInfo
      • Invocation
        Invocation
      • Order
        Order
      • Transfer
        Transfer
      Common Structures
    • Transaction Structures
      • BurnTransaction
        BurnTransaction
      • CreateAliasTransaction
        CreateAliasTransaction
      • DataTransaction
        DataTransaction
      • ExchangeTransaction
        ExchangeTransaction
      • GenesisTransaction
        GenesisTransaction
      • InvokeScriptTransaction
        InvokeScriptTransaction
      • IssueTransaction
        IssueTransaction
      • LeaseCancelTransaction
        LeaseCancelTransaction
      • LeaseTransaction
        LeaseTransaction
      • MassTransferTransaction
        MassTransferTransaction
      • ReissueTransaction
        ReissueTransaction
      • SetAssetScriptTransaction
        SetAssetScriptTransaction
      • SetScriptTransaction
        SetScriptTransaction
      • SponsorFeeTransaction
        SponsorFeeTransaction
      • TransferTransaction
        TransferTransaction
      • UpdateAssetInfoTransaction
        UpdateAssetInfoTransaction
      Transaction Structures
    Structures
  • Built-in Variables
    Built-in Variables
  • Built-in Functions
    • Account Data Storage Functions
      Account Data Storage Functions
    • Blockchain Functions
      Blockchain Functions
    • Byte Array Functions
      Byte Array Functions
    • Converting Functions
      Converting Functions
    • dApp-to-dApp Invocation Function
      dApp-to-dApp Invocation Function
    • Data Transaction Functions
      Data Transaction Functions
    • Decoding Functions
      Decoding Functions
    • Encoding Functions
      Encoding Functions
    • Exception Functions
      Exception Functions
    • Hashing Functions
      Hashing Functions
    • List Functions
      List Functions
    • Math Functions
      Math Functions
    • String Functions
      String Functions
    • Union Functions
      Union Functions
    • Verification Functions
      Verification Functions
    Built-in Functions
  • Operators
    Operators
  • match ... case: Pattern Matching
    match ... case: Pattern Matching
  • Iterations with FOLD<N>
    Iterations with FOLD<N>
  • dApp-to-dApp Invocation
    dApp-to-dApp Invocation
  • Limitations
    • Complexity
      Complexity
    • Data Weight
      Data Weight
    Limitations
  • Previous Versions
    • Version 5
      • Callable Function
        Callable Function
      • Data types
        • Any
          Any
        • BigInt
          BigInt
        • Boolean
          Boolean
        • ByteVector
          ByteVector
        • Int
          Int
        • String
          String
        • Unit
          Unit
        • List
          List
        • Tuple
          Tuple
        • Union
          Union
        Data types
      • Structures
        • Script Actions
          • BinaryEntry
            BinaryEntry
          • BooleanEntry
            BooleanEntry
          • Burn
            Burn
          • DeleteEntry
            DeleteEntry
          • IntegerEntry
            IntegerEntry
          • Issue
            Issue
          • Lease
            Lease
          • LeaseCancel
            LeaseCancel
          • Reissue
            Reissue
          • ScriptTransfer
            ScriptTransfer
          • SponsorFee
            SponsorFee
          • StringEntry
            StringEntry
          Script Actions
        • Common Structures
          • Address
            Address
          • Alias
            Alias
          • Asset
            Asset
          • AssetPair
            AssetPair
          • AttachedPayment
            AttachedPayment
          • BalanceDetails
            BalanceDetails
          • BlockInfo
            BlockInfo
          • Invocation
            Invocation
          • Order
            Order
          • Transfer
            Transfer
          Common Structures
        • Transaction Structures
          • BurnTransaction
            BurnTransaction
          • CreateAliasTransaction
            CreateAliasTransaction
          • DataTransaction
            DataTransaction
          • ExchangeTransaction
            ExchangeTransaction
          • GenesisTransaction
            GenesisTransaction
          • InvokeScriptTransaction
            InvokeScriptTransaction
          • IssueTransaction
            IssueTransaction
          • LeaseCancelTransaction
            LeaseCancelTransaction
          • LeaseTransaction
            LeaseTransaction
          • MassTransferTransaction
            MassTransferTransaction
          • ReissueTransaction
            ReissueTransaction
          • SetAssetScriptTransaction
            SetAssetScriptTransaction
          • SetScriptTransaction
            SetScriptTransaction
          • SponsorFeeTransaction
            SponsorFeeTransaction
          • TransferTransaction
            TransferTransaction
          • UpdateAssetInfoTransaction
            UpdateAssetInfoTransaction
          Transaction Structures
        Structures
      • Built-in Variables
        Built-in Variables
      • Built-in Functions
        • Account Data Storage Functions
          Account Data Storage Functions
        • Blockchain Functions
          Blockchain Functions
        • Byte Array Functions
          Byte Array Functions
        • Converting Functions
          Converting Functions
        • dApp-to-dApp Invocation Function
          dApp-to-dApp Invocation Function
        • Data Transaction Functions
          Data Transaction Functions
        • Decoding Functions
          Decoding Functions
        • Encoding Functions
          Encoding Functions
        • Exception Functions
          Exception Functions
        • Hashing Functions
          Hashing Functions
        • List Functions
          List Functions
        • Math Functions
          Math Functions
        • String Functions
          String Functions
        • Union Functions
          Union Functions
        • Verification Functions
          Verification Functions
        Built-in Functions
      • Operators
        Operators
      • Limitations
        • Data Weight
          Data Weight
        Limitations
      Version 5
    • Version 4 and 3
      • Callable Function
        Callable Function
      • Data types
        • Boolean
          Boolean
        • ByteVector
          ByteVector
        • Int
          Int
        • String
          String
        • Unit
          Unit
        • List
          List
        • Tuple
          Tuple
        • Union
          Union
        Data types
      • Structures
        • Script Actions
          • BinaryEntry (v4)
            BinaryEntry (v4)
          • BooleanEntry (v4)
            BooleanEntry (v4)
          • Burn (v4)
            Burn (v4)
          • DataEntry (v3)
            DataEntry (v3)
          • DeleteEntry (v4)
            DeleteEntry (v4)
          • IntegerEntry (v4)
            IntegerEntry (v4)
          • Issue (v4)
            Issue (v4)
          • Reissue (v4)
            Reissue (v4)
          • ScriptTransfer (v3 and v4)
            ScriptTransfer (v3 and v4)
          • SponsorFee (v4)
            SponsorFee (v4)
          • StringEntry (v4)
            StringEntry (v4)
          Script Actions
        • Script Results (v3)
          • ScriptResult
            ScriptResult
          • TransferSet
            TransferSet
          • WriteSet
            WriteSet
          Script Results (v3)
        • Common Structures
          • Address
            Address
          • Alias
            Alias
          • Asset
            Asset
          • AssetPair
            AssetPair
          • AttachedPayment
            AttachedPayment
          • BalanceDetails
            BalanceDetails
          • BlockInfo
            BlockInfo
          • Invocation
            Invocation
          • Order
            Order
          • Transfer
            Transfer
          Common Structures
        • Transaction Structures
          • BurnTransaction
            BurnTransaction
          • CreateAliasTransaction
            CreateAliasTransaction
          • DataTransaction
            DataTransaction
          • ExchangeTransaction
            ExchangeTransaction
          • GenesisTransaction
            GenesisTransaction
          • InvokeScriptTransaction
            InvokeScriptTransaction
          • IssueTransaction
            IssueTransaction
          • LeaseCancelTransaction
            LeaseCancelTransaction
          • LeaseTransaction
            LeaseTransaction
          • MassTransferTransaction
            MassTransferTransaction
          • ReissueTransaction
            ReissueTransaction
          • SetAssetScriptTransaction
            SetAssetScriptTransaction
          • SetScriptTransaction
            SetScriptTransaction
          • SponsorFeeTransaction
            SponsorFeeTransaction
          • TransferTransaction
            TransferTransaction
          • UpdateAssetInfoTransaction
            UpdateAssetInfoTransaction
          Transaction Structures
        Structures
      • Built-in Variables
        Built-in Variables
      • Built-in Functions
        • Account Data Storage Functions
          Account Data Storage Functions
        • Blockchain Functions
          Blockchain Functions
        • Byte Array Functions
          Byte Array Functions
        • Converting Functions
          Converting Functions
        • Data Transaction Functions
          Data Transaction Functions
        • Decoding Functions
          Decoding Functions
        • Encoding Functions
          Encoding Functions
        • Exception Functions
          Exception Functions
        • Hashing Functions
          Hashing Functions
        • List Functions
          List Functions
        • Math Functions
          Math Functions
        • String Functions
          String Functions
        • Union Functions
          Union Functions
        • Verification Functions
          Verification Functions
        Built-in Functions
      • Operators
        Operators
      • Limitations
        • Data Weight
          Data Weight
        Limitations
      Version 4 and 3
    Previous Versions
  • Import Libraries
    Import Libraries
  • Ride Components
    Ride Components
      • English
      • Русский
      On this page
        • Account data storage functions
        • Blockchain functions
        • Byte array functions
        • Converting functions
        • dApp-to-dApp invocation functions
        • Data transaction functions
        • Decoding functions
        • Encoding functions
        • Exception functions
        • Hashing functions
        • List functions
        • Math functions
        • String functions
        • Union functions
        • Verification functions
      waves_logo Docs

          # [Ride v5] Built-in functions

          ⚠️ This is the documentation for the Standard library version 5. We recommend to use version 6. Go to version 6

          A built-in function is a function of the Standard library.

          # Account data storage functions

          Name Description Complexity
          getBinary(Address|Alias, String): ByteVector|Unit Gets an array of bytes by key 10
          getBinary(String): ByteVector|Unit Gets an array of bytes by key from dApp's own data storage 10
          getBinaryValue(Address|Alias, String): ByteVector Gets an array of bytes by key. Fails if there is no data 10
          getBinaryValue(String): ByteVector Gets an array of bytes by key from dApp's own data storage. Fails if there is no data 10
          getBoolean(Address|Alias, String): Boolean|Unit Gets a boolean value by key 10
          getBoolean(String): Boolean|Unit Gets a boolean value by key from dApp's own data storage 10
          getBooleanValue(Address|Alias, String): Boolean Gets a boolean value by key. Fails if there is no data 10
          getBooleanValue(String): Boolean Gets a boolean value by key from dApp's own data storage. Fails if there is no data 10
          getInteger(Address|Alias, String): Int|Unit Gets an integer by key 10
          getInteger(String): Int|Unit Gets an integer by key from dApp's own data storage 10
          getIntegerValue(Address|Alias, String): Int Gets an integer by key. Fails if there is no data 10
          getIntegerValue(String): Int Gets an integer by key from dApp's own data storage. Fails if there is no data 10
          getString(Address|Alias, String): String|Unit Gets a string by key 10
          getString(String): String|Unit Gets a string by key from dApp's own data storage 10
          getStringValue(Address|Alias, String): String Gets a string by key. Fails if there is no data 10
          getStringValue(String): String Gets a string by key from dApp's own data storage. Fails if there is no data 10
          isDataStorageUntouched(Address|Alias): Boolean Checks if the data storage of a given account never contained any entries 10

          # Blockchain functions

          Name Description Complexity
          addressFromRecipient(Address|Alias): Address Gets the corresponding address of the alias 5
          assetBalance(Address|Alias, ByteVector): Int Gets account balance by token ID 10
          assetInfo(ByteVector): Asset|Unit Gets the information about a token 15
          blockInfoByHeight(Int): BlockInfo |Unit Gets the information about a block by the block height 5
          calculateAssetId(Issue): ByteVector Calculates ID of the token formed by the Issue structure when executing the callable function 10
          calculateLeaseId(Lease): ByteVector Calculates ID of the lease formed by the Lease structure when executing the callable function 1
          scriptHash(Address|Alias): ByteVector|Unit Returns BLAKE2b-256 hash of the script assigned to a given account 200
          transactionHeightById(ByteVector): Int|Unit Gets the block height of a transaction 20
          transferTransactionById(ByteVector): TransferTransaction|Unit Gets the data of a transfer transaction 60
          wavesBalance(Address|Alias): BalanceDetails Gets account balance in WAVES 10

          # Byte array functions

          Name Description Complexity
          drop(ByteVector, Int): ByteVector Returns the byte array without the first N bytes 6
          dropRight(ByteVector, Int): ByteVector Returns the byte array without the last N bytes 6
          size(ByteVector): Int Returns the number of bytes in the byte array 1
          take(ByteVector, Int): ByteVector Returns the first N bytes of the byte array 6
          takeRight(ByteVector, Int): ByteVector Returns the last N bytes of the byte array 6

          # Converting functions

          Name Description Complexity
          addressFromPublicKey(ByteVector): Address Converts account public key to address 63
          parseBigInt(String): BigInt|Unit Converts the string representation of a number to its big integer equivalent 65
          parseBigIntValue(String): BigInt Converts the string representation of a number to its big integer equivalent.
          Fails if the string cannot be parsed
          65
          parseInt(String): Int|Unit Converts the string representation of a number to its integer equivalent 2
          parseIntValue(String): Int Converts the string representation of a number to its integer equivalent. Fails if the string cannot be parsed 2
          toBigInt(ByteVector): BigInt Converts an array of bytes to a big integer 65
          toBigInt(ByteVector, Int, Int): BigInt Converts an array of bytes starting from a certain index to a big integer 65
          toBigInt(Int): BigInt Converts an integer to a big integer 1
          toBytes(Boolean): ByteVector Converts a boolean to an array of bytes 1
          toBytes(Int): ByteVector Converts an integer to an array of bytes 1
          toBytes(String): ByteVector Converts a string to an array of bytes 8
          toBytes(BigInt): ByteVector Converts a big integer to an array of bytes 65
          toInt(BigInt): Int Converts a big integer to an integer.
          Fails if the number cannot be converted
          1
          toInt(ByteVector): Int Converts an array of bytes to an integer 1
          toInt(ByteVector, Int): Int Converts an array of bytes to an integer starting from a certain index 1
          toString(Address): String Converts an address to a string 10
          toString(Boolean): String Converts a boolean to a string 1
          toString(Int): String Converts an integer to a string 1
          toString(BigInt): String Converts a big integer to a string 65
          toUtf8String(ByteVector): String Converts an array of bytes to a UTF-8 string 7
          transferTransactionFromProto(ByteVector): TransferTransaction|Unit Deserializes transfer transaction 5

          # dApp-to-dApp invocation functions

          Name Description Complexity
          invoke(Address|Alias, String, List[Any], List[AttachedPayments]): Any Invokes a dApp callable function, with reentrancy restriction 75
          reentrantInvoke(Address|Alias, String, List[Any], List[AttachedPayments]): Any Invokes a dApp callable function, without reentrancy restriction 75

          # Data transaction functions

          Name Description Complexity
          getBinary(List[], String): ByteVector|Unit Gets a binary value from a list of data entires by key 10
          getBinary(List[], Int): ByteVector|Unit Gets a binary value from a list of data entires by index 4
          getBinaryValue(List[], String): ByteVector Gets a binary value from a list of data entires by key. Fails if there is no data 10
          getBinaryValue(List[], Int): ByteVector Gets a binary value from a list of data entires by index. Fails if there is no data 4
          getBoolean(List[], String): Boolean|Unit Gets a boolean value from a list of data entires by key 10
          getBoolean(List[], Int): Boolean|Unit Gets a boolean value from a list of data entires by index 4
          getBooleanValue(List[], String): Boolean Gets a boolean value from a list of data entires by key. Fails if there is no data 10
          getBooleanValue(List[], Int): Boolean Gets a boolean value from a list of data entires by index. Fails if there is no data 4
          getInteger(List[], String): Int|Unit Gets an integer value from a list of data entires by key 10
          getInteger(List[], Int): Int|Unit Gets an integer value from a list of data entires by index 4
          getIntegerValue(List[], String): Int Gets an integer value from a list of data entires by key. Fails if there is no data 10
          getIntegerValue(List[], Int): Int Gets an integer value from a list of data entires by index. Fails if there is no data 4
          getString(List[] String): String|Unit Gets a string value from a list of data entires by key 10
          getString(List[], Int): String|Unit Gets a string value from a list of data entires by index 4
          getStringValue(List[], String): String Gets a string value from a list of data entires by key. Fails if there is no data 10
          getStringValue(List[], Int): String Gets a string value from a list of data entires by index. Fails if there is no data 4

          # Decoding functions

          Name Description Complexity
          addressFromString(String): Address|Unit Decodes address from base58 string 1
          addressFromStringValue(String): Address Decodes address from base58 string. Fails if the address cannot be decoded 1
          fromBase16String(String): ByteVector Decodes base16 string to an array of bytes 10
          fromBase58String(String): ByteVector Decodes base58 string to an array of bytes 1
          fromBase64String(String): ByteVector Decodes base64 string to an array of bytes 40

          # Encoding functions

          Name Description Complexity
          toBase16String(ByteVector): String Encodes array of bytes to base16 string 10
          toBase58String(ByteVector): String Encodes array of bytes to base58 string 3
          toBase64String(ByteVector): String Encodes array of bytes to base64 string 35

          # Exception functions

          Name Description Complexity
          throw() Raises an exception 1
          throw(String) Raises an exception with a message 1

          # Hashing functions

          Name Description Complexity
          blake2b256(ByteVector): ByteVector Range of functions.
          Hash an array of bytes using BLAKE2b-256
          10–200
          keccak256(ByteVector): ByteVector Range of functions.
          Hash an array of bytes using Keccak-256
          10–200
          sha256(ByteVector): ByteVector Range of functions.
          Hash an array of bytes using SHA-256
          10–200

          # List functions

          Name Description Complexity
          cons(A, List[B]): List[A|B] Inserts element to the beginning of the list 1
          containsElement(list: List[T], element: T): Boolean Check if the element is in the list 5
          getElement(List[T], Int): T Gets element from the list 2
          indexOf(List[T], T): Int|Unit Returns the index of the first occurrence of the element in the list 5
          lastIndexOf(List[T], T): Int|Unit Returns the index of the last occurrence of the element in the list 5
          max(List[Int]): Int Returns the largest element in the list of integers 3
          max(List[BigInt]): BigInt Returns the largest element in the list of big integers 192
          min(List[Int]): Int Returns the smallest element in the list of integers 3
          min(List[BigInt]): BigInt Returns the smallest element in the list of big integers 192
          removeByIndex(List[T], Int): List[T] Removes an element from the list by index 7
          size(List[T]): Int Returns the size of the list 2

          A, B, T means any valid type.

          # Math functions

          Name Description Complexity
          fraction(Int, Int, Int): Int Multiplies and divides integers to avoid overflow 14
          fraction(Int, Int, Int, Union): Int Multiplies and divides integers to avoid overflow, applying the specified rounding method 17
          fraction(BigInt, BigInt, BigInt): BigInt Multiplies and divides big integers to avoid overflow 128
          fraction(BigInt, BigInt, BigInt, Union): BigInt Multiplies and divides big integers to avoid overflow, applying the specified rounding method 128
          log(Int, Int, Int, Int, Int, Union): Int Calculates logarithm of a number with a base 100
          log(BigInt, Int, BigInt, Int, Int, Union): BigInt Calculates logarithm of a number to a given base with high accuracy 200
          median(List[Int]): Int Returns the median of a list of integers 20
          median(List[BigInt]): BigInt Returns the median of a list of big integers 160
          pow(Int, Int, Int, Int, Int, Union): Int Raises a number to a given power 100
          pow(BigInt, Int, BigInt, Int, Int, Union): BigInt Raises a number to a given power with high accuracy 200

          # String functions

          Name Description Complexity
          contains(String, String): Boolean Checks whether the string contains substring 3
          drop(String, Int): String Drops the first n characters of a string 20
          dropRight(String, Int): String Drops the last n characters of a string 20
          indexOf(String, String): Int|Unit Returns the index of the first occurrence of a substring 3
          indexOf(String, String, Int): Int|Unit Returns the index of the first occurrence of a substring after a certain index 3
          lastIndexOf(String, String): Int|Unit Returns the index of the last occurrence of a substring 3
          lastindexOf(String, String, Int): Int|Unit Returns the index of the last occurrence of a substring before a certain index 3
          makeString(List[String], String): String Concatenates list strings adding a separator 30
          size(String): Int Returns the size of a string 1
          split(String, String): List[String] Splits a string delimited by a separator into a list of substrings. 75
          take(String, Int): String Takes the first n characters from a string 20
          takeRight(String, Int): String Takes the last n characters from a string 20

          # Union functions

          Name Description Complexity
          isDefined(T|Unit): Boolean Checks if an argument is not unit 1
          value(T|Unit): T Gets a value from a union type argument. Fails if it is unit 2
          valueOrElse(T|Unit, T): T Returns a value from a union type argument if it's not unit. Otherwise, returns the second argument 2
          valueOrErrorMessage(T|Unit, String): T Gets a value from a union type argument if it's not unit. Otherwise, fails with the message specified in the second argument 2

          # Verification functions

          Name Description Complexity
          bn256Groth16Verify(ByteVector, ByteVector, ByteVector): Boolean Range of functions.
          Check zk-SNARK by groth16 protocol on the bn254 curve
          800–1650
          createMerkleRoot(List[ByteVector], ByteVector, Int) : ByteVector Calculates the Merkle root hash for transactions of block 30
          ecrecover(messageHash: ByteVector, signature: ByteVector) Recovers public key from the message hash and the ECDSA digital signature 70
          groth16Verify(ByteVector, ByteVector, ByteVector): Boolean Range of functions.
          Check zk-SNARK by groth16 protocol on the bls12-381 curve
          1200–2700
          rsaVerify(digestAlgorithmType, ByteVector, ByteVector, ByteVector): Boolean Range of functions.
          Check that the RSA digital signature is valid, i.e. it was created by the owner of the public key
          500–1000
          sigVerify(ByteVector, ByteVector, ByteVector): Boolean Range of functions.
          Check that the Curve25519 digital signature is valid, i.e. it was created by the owner of the public key
          47–200
          Built-in Variables
          Account Data Storage Functions
          Built-in Variables
          Account Data Storage Functions