Developer Center

Developer Center

  • Getting Started
  • Built-in Features
  • REST API Endpoints
  • Guides
  • Cheat Sheet

›Account

Getting Started

  • What is Sirius Chain
  • Setting up your workstation
  • Writing your first application

Built-in Features

  • Account
  • Mosaic (SDA)
  • Namespace
  • Transfer Transaction
  • Aggregate Transaction
  • Multisig Account
  • Metadata
  • Account Restriction
  • Cross-Chain Swaps
  • Exchange Market
  • Decentralized Exchange Market
  • Liquidity Provider
  • Storage

Protocol

  • Node
  • Block
  • Cryptography
  • Transaction
  • Validating
  • Consensus Algorithms
  • Receipt
  • Inflation

REST API

  • Overview
  • Tools
  • Serialization
  • Websockets
  • Status Errors

SDKs

  • Overview
  • Architecture
  • Languages
  • Extending Sirius Chain Capabilities
  • SDK Development
  • SDK Documentation

Wallets & Explorers

  • Wallets & Explorers

Cheat Sheet

  • Sirius Chain Cheat Sheet

Guides

  • Overview
  • External Guides
  • Account

    • Creating and opening an account
    • Getting account information
    • Getting the amount of XPX sent to an account
    • Reading transactions from an account

    Account Restriction

    • Preventing spam attacks with account restrictions

    Aggregate Transaction

    • Sending payouts with aggregate-complete transaction
    • Creating an escrow with aggregate bonded transaction
    • Asking for mosaics with aggregate-bonded transaction
    • Signing announced aggregate-bonded transactions

    Block

    • Listening to New Blocks
    • Getting block by height

    Cross Chain Swaps

    • Atomic cross-chain swap between Sirius public and private chains

    Metadata

    • Account Metadata
    • Mosaic Metadata
    • Namespace Metadata
    • Account Metadata (Deprecated since 0.7.0 Sirius Chain release)
    • Mosaic Metadata (Deprecated since 0.7.0 Sirius Chain release)
    • Namespace Metadata (Deprecated since 0.7.0 Sirius Chain release)

    Monitoring

    • Monitor transaction

    Mosaic

    • Creating a mosaic (SDA)
    • Getting the mosaic information
    • Getting the asset identifier behind a namespace with receipts

    Mosaic Levy

    • Modifying Mosaic Supply

    Multisig Account

    • Converting an account to multisig
    • Modifying a multisig account
    • Creating a multi-level multisig-account
    • Sending a multisig transaction

    Namespace

    • Registering a namespace
    • Registering a subnamespace
    • Getting the Namespace information
    • Linking a namespace to a mosaic
    • Linking namespace to account

    Transfer Transaction

    • Transfer transaction
    • Sending an encrypted message

    Storage

    • Data Modification Cancel
    • Data Modification
    • Download Channel
    • Download Payment
    • Drive Closure
    • Finish Download Channel
    • Prepare Bc Drive
    • Replicator Offboarding
    • Replicator Onboarding
    • Storage Payment
    • Verification Payment

Storage

  • Overview
  • Participate
  • External Economy
  • Roles
  • Verification
  • Challenge
  • Rewards
  • Transaction Schemas
  • Built-In Features

    • Drive
    • Replicator
    • Verifier
    • Supercontracts

    Protocols

    • Cross-Block Protocol
    • Fair Streaming

    Storage User Application

    • Overview
    • Getting Started
    • Managing Drives
    • Managing Drive Files
    • Downloading Data

Getting the amount of XPX sent to an account

This guide will help you check the amount of XPX you have sent to any account.

Prerequisites

  • Finish the getting started section.
  • Have one account with xpx currency.
  • Have sent mosaics to another account.
  • Text editor or IDE.
  • XPX-Chain-SDK or XPX-Chain-CLI.

Getting into some code

In this example, we are going to check how many assets of a certain type we have sent to an account.

Golang
TypeScript
JavaScript
Java
conf, err := sdk.NewConfig(context.Background(), []string{"http://bctestnet1.brimstone.xpxsirius.io:3000"})
if err != nil {
panic(err)
}

// Use the default http client
client := sdk.NewClient(nil, conf)

address, err := sdk.NewAddressFromPublicKey("...", client.NetworkType())
if err != nil {
panic(err)
}

accountInfo, err := client.Account.GetAccountInfo(context.Background(), address)
if err != nil {
panic(err)
}

for _, mosaic := range accountInfo.Mosaics {
if mosaic.AssetId == sdk.XpxNamespaceId {
fmt.Println(mosaic.String())
}
}

import { mergeMap, map, filter, toArray } from 'rxjs/operators';

const accountHttp = new AccountHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');

const originPublicKey = '7D08373CFFE4154E129E04F0827E5F3D6907587E348757B0F87D2F839BF88246';
const originAccount = PublicAccount.createFromPublicKey(originPublicKey, NetworkType.TEST_NET);

const recipientAddress = 'VDG4WG-FS7EQJ-KFQKXM-4IUCQG-PXUW5H-DJVIJB-OXJG';
const address = Address.createFromRawAddress(recipientAddress);

accountHttp
.outgoingTransactions(originAccount)
.pipe(
mergeMap((_) => _), // Transform transaction array to single transactions to process them
filter((_) => _.type === TransactionType.TRANSFER), // Filter transfer transactions
map((_) => _ as TransferTransaction), // Map transaction as transfer transaction
filter((_) => _.recipient.equals(address)), // Filter transactions from to account
filter((_) => _.mosaics.length === 1 && _.mosaics[0].id.equals(NetworkCurrencyMosaic.NAMESPACE_ID)), // Filter xpx transactions
map((_) => _.mosaics[0].amount.compact() / Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)), // Map only amount in xpx
toArray(), // Add all mosaics amounts into one array
map((_) => _.reduce((a, b) => a + b, 0))
)
.subscribe(
total => console.log('Total xpx send to account', address.pretty(), 'is:', total),
err => console.error(err)
);
// es5
var { mergeMap, map, filter, toArray } = require('rxjs/operators');

// es6
import { mergeMap, map, filter, toArray } from 'rxjs/operators';

const accountHttp = new AccountHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');

const originPublicKey = '7D08373CFFE4154E129E04F0827E5F3D6907587E348757B0F87D2F839BF88246';
const originAccount = PublicAccount.createFromPublicKey(originPublicKey, NetworkType.TEST_NET);

const recipientAddress = 'VDG4WG-FS7EQJ-KFQKXM-4IUCQG-PXUW5H-DJVIJB-OXJG';
const address = Address.createFromRawAddress(recipientAddress);

accountHttp
.outgoingTransactions(originAccount)
.pipe(
mergeMap((_) => _), // Transform transaction array to single transactions to process them
filter((_) => _.type === TransactionType.TRANSFER), // Filter transfer transactions
filter((_) => _.recipient.equals(address)), // Filter transactions from to account
filter((_) => _.mosaics.length === 1 && _.mosaics[0].id.equals(NetworkCurrencyMosaic.NAMESPACE_ID)), // Filter xpx transactions
map((_) => _.mosaics[0].amount.compact() / Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)), // Map only amount in xpx
toArray(), // Add all mosaics amounts into one array
map((_) => _.reduce((a, b) => a + b, 0))
)
.subscribe(
total => console.log('Total xpx send to account', address.pretty(), 'is:', total),
err => console.error(err)
);
        // Replace with public key
final String originPublicKey = "<public_key>";

// Replace with recipient address
final String recipientAddress = "VB2RPH-EMTFMB-KELX2Y-Q3MZTD-RV7DQG-UZEADV-CYKC";

// Replace with public key
final PublicAccount originAccount = PublicAccount.createFromPublicKey(originPublicKey, NetworkType.TEST_NET);

// Replace with address
final Address address = Address.createFromRawAddress(recipientAddress);

final AccountHttp accountHttp = new AccountHttp("http://bctestnet1.brimstone.xpxsirius.io:3000");

final BigInteger total = accountHttp.outgoingTransactions(originAccount)
.flatMapIterable(tx -> tx) // Transform transaction array to single transactions to process them
.filter(tx -> tx.getType().equals(TransactionType.TRANSFER)) // Filter transfer transactions
.map(tx -> (TransferTransaction) tx) // Map transaction as transfer transaction
.filter(tx -> tx.getRecipient().equals(address)) // Filter transactions from to account
.filter(tx -> tx.getMosaics().size() == 1 && tx.getMosaics().get(0).getId().equals(NetworkCurrencyMosaic.ID)) // Filter xpx transactions
.map(tx -> tx.getMosaics().get(0).getAmount().divide(BigDecimal.valueOf(Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)).toBigInteger())) // Map only amount in xpx
.toList() // Add all mosaics amounts into one array
.map(amounts -> amounts.stream().reduce(BigInteger.ZERO, BigInteger::add))
.toFuture()
.get();

System.out.println("Total xpx send to account " + address.pretty() + " is: " + total.toString());

If you want to check another mosaic that is different from the native currency, change mosaicId for the target mosaic.

← Getting account informationReading transactions from an account →
  • Prerequisites
  • Getting into some code
  • Follow our profile
  • Ask development questions
  • Join our Discord channel
  • Explore our Youtube channel
  • Explore Github
Protocol
BlockConsensus AlgorithmsCryptographyInflationNodeReceiptTransactionValidating
Built-in Features
AccountAggregate TransactionCross-Chain SwapsExchange MarketDecentralized Exchange MarketMetadataMosaicMultisig AccountNamespaceTransfer TransactionStorageLiquidity Provider
References
REST APISDKsCheat Sheet
Includes Documentation Forked from NEM
Copyright © 2025 Sirius Chain