waves_logo Docs
  • Ride Programming Language
    Ride Programming Language
  • Getting started
    Getting started
  • Base concepts
    • Definition
      Definition
    • Expression
      Expression
    Base concepts
  • Comments
    Comments
  • Constants
    Constants
  • Data types
    • Boolean
      Boolean
    • ByteVector
      ByteVector
    • Int
      Int
    • String
      String
    • Unit
      Unit
    • List
      List
    • Tuple
      Tuple
    • Union
      Union
    Data types
  • Exceptions
    Exceptions
  • Functions
    • Annotations
      Annotations
    • 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
    • Callable function
      Callable function
    • Verifier function
      Verifier function
    Functions
  • FOLD<N> Macro
    FOLD<N> Macro
  • Operators
    • match-case
      match-case
    Operators
  • Script
    • Directives
      Directives
    • Script body
      Script body
    • Script context
      Script context
    • Script types
      • Account script
        Account script
      • Asset script
        Asset script
      • dApp script
        dApp script
      Script types
    • Standard Library
      Standard Library
    Script
  • 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
  • Variables
    • Built-in variables
      Built-in variables
    Variables
  • Limitations
    • Complexity
      Complexity
    • Data Weight
      Data Weight
    Limitations
  • Ride Components
    Ride Components
  • Script performance tests
    Script performance tests
      • 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

          # Built-in functions

          A built-in function is a function of the script context.

          # Account data storage functions

          Name Description Complexity
          assetBalancе(Address|Alias, ByteVector): Int Gets account balance by token ID 100 for Standard Library version 3
          10 for Standard Library version 4
          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. Throws an exception 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. Throws an exception 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. Throws an exception 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. Throws an exception if there is no data 100 for Standard Library version 3
          10 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

          # Blockchain functions

          Name Description Complexity
          assetInfo(ByteVector): Аsset|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

          # 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
          addressFromRecipient(Address|Alias): Address Gets the corresponding address of the alias 100 for Standard Library version 3
          5 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.Raises an exception 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[DataEntry], String): Int|Unit Gets an integer value from a list of data entires by key 10
          getInteger(List[DataEntry], 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[DataEntry], String): Int Gets an integer value from a list of data entires by key. Throws an exception if there is no data 10
          getIntegerValue(List[DataEntry], Int): Int Gets an integer value from a list of data entires by index. Throws an exception if there is no data 30 for Standard Library version 3
          4 for Standard Library version 4
          getBoolean(List[DataEntry], String): Boolean|Unit Gets a boolean value from a list of data entires by key 10
          getBoolean(List[DataEntry], 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[DataEntry], String): Boolean Gets a boolean value from a list of data entires by key. Throws an exception if there is no data 10
          getBooleanValue(List[DataEntry], Int): Boolean Gets a boolean value from a list of data entires by index. Throws an exception if there is no data 30 for Standard Library version 3
          4 for Standard Library version 4
          getBinary(List[DataEntry], String): ByteVector|Unit Gets a binary value from a list of data entires by key 10
          getBinary(List[DataEntry], 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[DataEntry], String): ByteVector Gets a binary value from a list of data entires by key. Throws an exception if there is no data 10
          getBinaryValue(List[DataEntry], Int): ByteVector Gets a binary value from a list of data entires by index. Throws an exception if there is no data 30 for Standard Library version 3
          4 for Standard Library version 4
          getString(List[DataEntry] String): String|Unit Gets a string value from a list of data entires by key 10
          getString(List[DataEntry], 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[DataEntry], String): String Gets a string value from a list of data entires by key. Throws an exception if there is no data 10
          getStringValue(List[DataEntry], Int): String Gets a string value from a list of data entires by index. Throws an exception 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. Raises an exception 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 is a short designation for Boolean|ByteVector|Int|String.

          # Math functions

          Name Description Complexity
          fraction(Int, Int, Int): Int Multiplies and divides an integer to avoid the integer overflow 1
          log(Int, Int, Int, Int, Int, Union): Int Calculates logarithm of the number 100
          median(List[Int]): Int Returns the median of a list of integers 20
          pow(Int, Int, Int, Int, Int, Union): Int Raises the number to a 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 10
          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
          Annotations
          Account data storage functions
          Annotations
          Account data storage functions