waves_logo Docs
  • Ride Programming Language
    Ride Programming Language
  • Getting Started
    Getting Started
  • Syntax Basics
    • Directives
      Directives
    • Definition
      Definition
    • Expression
      Expression
    • Constant
      Constant
    • 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
    • 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
  • Pattern Matching: match-case
    Pattern Matching: match-case
  • Interations with FOLD<N>
    Interations with FOLD<N>
  • Limitations
    • Complexity
      Complexity
    • Data Weight
      Data Weight
    Limitations
  • Version 5 (Stagenet)
    • dApp-to-dApp Invocation
      dApp-to-dApp Invocation
    • Strict Variable
      Strict Variable
    • 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
      • Data Transaction Functions
        Data Transaction Functions
      • Decoding Functions
        Decoding Functions
      • Encoding Functions
        Encoding Functions
      • Exception Functions
        Exception Functions
      • Hashing Functions
        Hashing Functions
      • dApp-to-dApp Invocation Function
        dApp-to-dApp Invocation Function
      • 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 (Stagenet)
  • Ride Components
    Ride Components
  • Script performance tests
    Script performance tests
      • English
      • Русский
      On this page
        • addressFromRecipient(Address|Alias): Address
        • assetBalance
        • assetInfo
        • blockInfoByHeight
        • calculateAssetId
        • calculateLeaseId
        • hashScriptAtAddress
        • transactionHeightById
        • transferTransactionById
        • wavesBalance
      waves_logo Docs

          # [Ride v5] Blockchain functions

          ⚠️ This is the documentation for the Standard Library version 5, which is currently available for Stagenet only. Go to Mainnet version

          Name Description Complexity
          addressFromRecipient(Address|Alias): Address Gets the corresponding address of the alias 5
          assetBalancе(Address|Alias, ByteVector): Int Gets account balance by token ID 10
          assetInfo(ByteVector): Аsset|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
          hashScriptAtAddress(Address|Alias): ByteVector|Unit Returns BLAKE2b-256 (opens new window) 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

          # addressFromRecipient(Address|Alias): Address

          Gets the corresponding address of the alias.

          addressFromRecipient(AddressOrAlias: Address|Alias): Address
          

          For a description of the return value, see the Address article.

          # Parameters

          Parameter Description
          AddressOrAlias: Address|Alias
          Address or alias, usually tx.recipient

          # Examples

          let address =Address(base58'3NADPfTVhGvVvvRZuqQjhSU4trVqYHwnqjF')
          addressFromRecipient(address)
          

          # assetBalance

          Gets account balance by token ID.

          assetBalance(addressOrAlias: Address|Alias, assetId: ByteVector): Int
          

          # Parameters

          Parameter Description
          addressOrAlias: Address|Alias Address or alias of the account
          assetId: ByteVector Token ID

          # assetInfo

          Gets the information about a token.

          assetInfo(id: ByteVector): Аsset|Unit
          

          For a description of the return value, see the Asset article.

          # Parameters

          Parameter Description
          id: ByteVector ID of the token

          # Example

          let bitcoinId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS'
          let x = match assetInfo(bitcoinId) {
              case asset:Asset =>
                  asset.decimals # 8
              case _ => throw("Can't find asset")
          }
          

          # blockInfoByHeight

          Gets the information about a block by the block height.

          blockInfoByHeight(height: Int): BlockInfo|Unit
          

          For a description of the return value, see the BlockInfo article.

          # Parameters

          Parameter Description
          height: Int Block height

          # Example

          let x = match blockInfoByHeight(1234567) {
              case block:BlockInfo =>
                  block.generator.toString() # "3P38Z9aMhGKAWnCiyMW4T3PcHcRaTAmTztH"
              case _ => throw("Can't find block")
          }
          

          # calculateAssetId

          Calculates ID of the token formed by the Issue structure when executing the callable function.

          calculateAssetId(issue: Issue): ByteVector
          

          # Parameters

          Parameter Description
          issue: Issue Structure that sets the parameters of the token issue

          # Example

          {-# STDLIB_VERSION 5 #-}
          {-# CONTENT_TYPE DAPP #-}
          {-# SCRIPT_TYPE ACCOUNT #-}
            
          @Callable(inv)
          func issueAndId() = {
            let issue = Issue("CryptoRouble", "Description", 1000, 2, true)
            let id = calculateAssetId(issue)
            (
              [
                issue,
                BinaryEntry("id", id)
              ],
              null
            )
          }
          

          # calculateLeaseId

          Calculates ID of the lease formed by the Lease structure when executing the callable function.

          calculateLeaseId(lease: Lease): ByteVector
          

          # Parameters

          Parameter Description
          lease: Lease Structure that sets the lease parameters

          # Example

          {-# STDLIB_VERSION 5 #-}
          {-# CONTENT_TYPE DAPP #-}
          {-# SCRIPT_TYPE ACCOUNT #-}
            
          @Callable(i)
          func foo() = {
            let lease = Lease(Alias("merry"),100000000)
            let id = calculateLeaseId(lease)
            (
              [
                lease,
                BinaryEntry("lease", id)
              ],
              null
            )
          }
          

          # hashScriptAtAddress

          Returns BLAKE2b-256 (opens new window) hash of the script assigned to a given account. Returns unit if there is no script.

          The function can be used to verify that the script is exactly the same as expected.

          hashScriptAtAddress(addressOrAlias: Address|Alias): ByteVector|Unit
          

          # Parameters

          Parameter Description
          addressOrAlias: Address|Alias Address or alias of the account

          # Example

          let addr = Address(base58'3MxBZbnN8Z8sbYjjL5N3oG5C8nWq9NMeCEm')
          
          hashScriptAtAddress(addr) # Returns base58'G6ihnWN5mMedauCgNa8TDrSKWACPJKGQyYagmMQhPuja'
          

          # transactionHeightById

          Gets the block height of a transaction.

          transactionHeightById(id: ByteVector): Int|Unit
          

          # Parameters

          Parameter Description
          id: ByteVector ID of the transaction

          # Example

          let bitcoinId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS'
          let x = match transactionHeightById(bitcoinId) {
              case h:Int => h # 257457
              case _ => throw("Can't find transaction")
          }
          

          # transferTransactionById

          Gets the data of a transfer transaction.

          transferTransactionById(id: ByteVector): TransferTransaction|Unit
          

          For a description of the return value, see the TransferTransaction article.

          # Parameters

          Parameter Description
          id: ByteVector ID of the transfer transaction

          # Example

          let transferId = base58'J2rcMzCWCZ1P3SFZzvz9PR2NtBjomDh57HTcqptaAJHK'
          let x = match transferTransactionById(transferId) {
              case ttx:TransferTransaction =>
                  ttx.amount # 3500000000
              case _ => throw("Can't find transaction")
          }
          

          # wavesBalance

          Gets all types of WAVES balances. For description of balance types, see the Account Balance article.

          wavesBalance(addressOrAlias: Address|Alias): BalanceDetails
          

          For a description of the return value, see the BalanceDetails article.

          # Parameters

          Parameter Description
          addressOrAlias: Address|Alias Address or alias of the account
          Account Data Storage Functions
          Byte Array Functions
          Account Data Storage Functions
          Byte Array Functions