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
        • 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 v4 and v3] Built-in functions

          ⚠️ This is the documentation for the Standard library version 4 and 3. 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 100 for Standard Library version 3
          10 for Standard Library version 4
          getBinaryValue(Address|Alias, String): ByteVector Gets an array of bytes by key. Fails if there is no data 100 for Standard Library version 3
          10 for Standard Library version 4
          getBoolean(Address|Alias, String): Boolean|Unit Gets a boolean value by key 100 for Standard Library version 3
          10 for Standard Library version 4
          getBooleanValue(Address|Alias, String): Boolean Gets a boolean value by key. Fails if there is no data 100 for Standard Library version 3
          10 for Standard Library version 4
          getInteger(Address|Alias, String): Int|Unit Gets an integer by key 100 for Standard Library version 3
          10 for Standard Library version 4
          getIntegerValue(Address|Alias, String): Int Gets an integer by key. Fails if there is no data 100 for Standard Library version 3
          10 for Standard Library version 4
          getString(Address|Alias, String): String|Unit Gets a string by key 100 for Standard Library version 3
          10 for Standard Library version 4
          getStringValue(Address|Alias, String): String Gets a string by key. Fails if there is no data 100 for Standard Library version 3
          10 for Standard Library version 4

          # Blockchain functions

          Name Description Complexity
          addressFromRecipient(Address|Alias): Address Gets the corresponding address of the alias 100 for Standard Library version 3
          5 for Standard Library version 4
          assetBalance(Address|Alias, ByteVector): Int Gets account balance by token ID 100 for Standard Library version 3
          10 for Standard Library version 4
          assetInfo(ByteVector): Asset|Unit Gets the information about a token 100 for Standard Library version 3
          15 for Standard Library version 4
          blockInfoByHeight(Int): BlockInfo |Unit Gets the information about a block by the block height 100 for Standard Library version 3
          5 for Standard Library version 4
          calculateAssetId(Issue): ByteVector Calculates the ID of the asset, created by Issue structure during invoke script transaction execution 10
          transactionHeightById(ByteVector): Int|Unit Gets the block height of a transaction 100 for Standard Library version 3
          20 for Standard Library version 4
          transferTransactionById(ByteVector): TransferTransaction|Unit Gets the data of a transfer transaction 100 for Standard Library version 3
          60 for Standard Library version 4
          wavesBalance(Address|Alias): Int Gets account balance in WAVES 100 for Standard Library version 3
          10 for Standard Library version 4

          # Byte array functions

          Name Description Complexity
          drop(ByteVector, Int): ByteVector Returns the byte array without the first N bytes 1 for Standard Library version 3
          6 for Standard Library version 4
          dropRight(ByteVector, Int): ByteVector Returns the byte array without the last N bytes 19 for Standard Library version 3
          6 for Standard Library version 4
          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 1 for Standard Library version 3
          6 for Standard Library version 4
          takeRight(ByteVector, Int): ByteVector Returns the last N bytes of the byte array 19 for Standard Library version 3
          6 for Standard Library version 4

          # Converting functions

          Name Description Complexity
          addressFromPublicKey(ByteVector): Address Converts account public key to address 82 for Standard Library version 3
          63 for Standard Library version 4
          parseInt(String): Int|Unit Converts the string representation of a number to its integer equivalent 20 for Standard Library version 3
          2 for Standard Library version 4
          parseIntValue(String): Int Converts the string representation of a number to its integer equivalent. Fails if the string cannot be parsed 20 for Standard Library version 3
          2 for Standard Library version 4
          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 1 for Standard Library version 3
          8 for Standard Library version 4
          toInt(ByteVector): Int Converts an array of bytes to an integer 10 for Standard Library version 3
          1 for Standard Library version 4
          toInt(ByteVector, Int): Int Converts an array of bytes to an integer starting from a certain index 10 for Standard Library version 3
          1 for Standard Library version 4
          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
          toUtf8String(ByteVector): String Converts an array of bytes to a UTF-8 string 20 for Standard Library version 3
          7 for Standard Library version 4
          transferTransactionFromProto(ByteVector): TransferTransaction|Unit Deserializes transfer transaction 5

          # Data transaction functions

          Name Description Complexity
          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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 4
          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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 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 30 for Standard Library version 3
          4 for Standard Library version 4

          # Decoding functions

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

          # 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 10 for Standard Library version 3
          3 for Standard Library version 4
          toBase64String(ByteVector): String Encodes array of bytes to base64 string 10 for Standard Library version 3
          35 for Standard Library version 4

          # 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 for Standard Library version 3
          10–200 for Standard Library version 4
          keccak256(ByteVector): ByteVector Range of functions.
          Hash an array of bytes using Keccak-256
          10 for Standard Library version 3
          10–200 for Standard Library version 4
          sha256(ByteVector): ByteVector Range of functions.
          Hash an array of bytes using SHA-256
          10 for Standard Library version 3
          10–200 for Standard Library version 4

          # List functions

          Name Description Complexity
          cons(T, List[T]): List[T] Inserts element to the beginning of the list 2 for Standard Library version 3
          1 for Standard Library version 4
          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: List[T], element: T): Int|Unit Returns the index of the first occurrence of the element in the list 5
          lastIndexOf(list: List[T], element: 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 3
          min(List[Int]): Int Returns the smallest item in the list 3
          removeByIndex(list: List[T], index: Int): List[T] Removes an element from the list by index 7
          size(List[T]): Int Returns the size of the list 2

          T means any valid type.

          # Math functions

          Name Description Complexity
          fraction(Int, Int, Int): Int Multiplies and divides integers to avoid overflow 1
          log(Int, Int, Int, Int, Int, Union): Int Calculates logarithm of a number with a base 100
          median(List[Int]): Int Returns the median of a list of integers 20
          pow(Int, Int, Int, Int, Int, Union): Int Raises a number to a given power 100

          # 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 1 for Standard Library version 3
          20 for Standard Library version 4
          dropRight(String, Int): String Drops the last n characters of a string 19 for Standard Library version 3
          20 for Standard Library version 4
          indexOf(String, String): Int|Unit Returns the index of the first occurrence of a substring 20 for Standard Library version 3
          3 for Standard Library version 4
          indexOf(String, String, Int): Int|Unit Returns the index of the first occurrence of a substring after a certain index 20 for Standard Library version 3
          3 for Standard Library version 4
          lastIndexOf(String, String): Int|Unit Returns the index of the last occurrence of a substring 20 for Standard Library version 3
          3 for Standard Library version 4
          lastindexOf(String, String, Int): Int|Unit Returns the index of the last occurrence of a substring before a certain index 20 for Standard Library version 3
          3 for Standard Library version 4
          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. 100 for Standard Library version 3
          75 for Standard Library version 4
          take(String, Int): String Takes the first n characters from a string 1 for Standard Library version 3
          20 for Standard Library version 4
          takeRight(String, Int): String Takes the last n characters from a string 19 for Standard Library version 3
          20 for Standard Library version 4

          # Union functions

          Name Description Complexity
          extract(T|Unit): T Gets a value from a union type argument. Fails if it is unit 13
          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 13 for Standard Library version 3
          2 for Standard Library version 4
          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 13 for Standard Library version 3
          2 for Standard Library version 4

          # 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
          checkMerkleProof(ByteVector, ByteVector, ByteVector): Boolean Checks that the data is part of the Merkle tree 30
          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
          300 for Standard Library version 3
          500–1000 for Standard Library version 4
          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
          100 for Standard library version 3
          47–200 for Standard Library version 4
          Built-in Variables
          Account Data Storage Functions
          Built-in Variables
          Account Data Storage Functions