Developer Center

Developer Center

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

›Aggregate Transaction

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

Sending payouts with aggregate-complete transaction

Send transactions to different accounts atomically, using an aggregate complete transaction.

Background Information

Dan wants to send mosaics to Alice and Bob. He chooses to send an aggregate complete transaction, so both will receive the funds at the same time.

Aggregate Sending Payout

Sending transactions to different recipients atomically

Prerequisites

  • XPX-Chain-SDK.
  • A text editor or IDE.
  • Finish sending a transfer transaction guide.
  • An account with XPX.

Geting into some code

  1. Create two transfer transactions with two different recipients, wrapping them in an aggregate transaction.

As one private key can sign all the transactions in the aggregate, define the aggregate as complete. That means that there is no need to lock funds to send the transaction. If valid, it will be accepted by the network.

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)


sender, err := client.NewAccountFromPrivateKey(os.Getenv("SENDER_PRIVATE_KEY"))
if err != nil {
panic(err)
}
aliceAccount, err := client.NewAccountFromPublicKey(os.Getenv("ALICE_PUBLIC_KEY"))
if err != nil {
panic(err)
}

bobAccount, err := client.NewAccountFromPublicKey(os.Getenv("BOB_PUBLIC_KEY"))
if err != nil {
panic(err)
}

amount := []*sdk.Mosaic{sdk.XpxRelative(10)}

aliceTransferTransaction, err := client.NewTransferTransaction(sdk.NewDeadline(time.Hour), aliceAccount.Address, amount, sdk.NewPlainMessage("payout"))
aliceTransferTransaction.ToAggregate(sender.PublicAccount)
if err != nil {
panic(err)
}

bobTransferTransaction, err := client.NewTransferTransaction(sdk.NewDeadline(time.Hour), bobAccount.Address, amount, sdk.NewPlainMessage("payout"))
bobTransferTransaction.ToAggregate(sender.PublicAccount)
if err != nil {
panic(err)
}

aggregateTransaction, err := client.NewCompleteAggregateTransaction(sdk.NewDeadline(time.Hour), []sdk.Transaction{aliceTransferTransaction, bobTransferTransaction})
if err != nil {
panic(err)
}
const transactionHttp = new TransactionHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');

const privateKey = process.env.PRIVATE_KEY as string;
const danAccount = Account.createFromPrivateKey(privateKey, NetworkType.TEST_NET);

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

const bobAddress = 'VCGPXB-2A7T4I-W5MQCX-FQY4UQ-W5JNU5-F55HGK-HBUN';
const bobAccount = Address.createFromRawAddress(bobAddress);

const amount = NetworkCurrencyMosaic.createRelative(10); // 10 xpx represent 10 000 000 micro xpx

const aliceTransferTransaction = TransferTransaction.create(Deadline.create(), aliceAccount, [amount], PlainMessage.create('payout'), NetworkType.TEST_NET);
const bobTransferTransaction = TransferTransaction.create(Deadline.create(), bobAddress, [amount], PlainMessage.create('payout'), NetworkType.TEST_NET);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
[
aliceTransferTransaction.toAggregate(danAccount.publicAccount),
bobTransferTransaction.toAggregate(danAccount.publicAccount)
],
NetworkType.TEST_NET
);
const transactionHttp = new TransactionHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');

const privateKey = process.env.PRIVATE_KEY;
const danAccount = Account.createFromPrivateKey(privateKey, NetworkType.TEST_NET);

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

const bobAddress = 'VCGPXB-2A7T4I-W5MQCX-FQY4UQ-W5JNU5-F55HGK-HBUN';
const bobAccount = Address.createFromRawAddress(bobAddress);

const amount = NetworkCurrencyMosaic.createRelative(10); // 10 xpx represent 10 000 000 micro xpx

const aliceTransferTransaction = TransferTransaction.create(Deadline.create(), aliceAccount, [amount], PlainMessage.create('payout'), NetworkType.TEST_NET);
const bobTransferTransaction = TransferTransaction.create(Deadline.create(), bobAddress, [amount], PlainMessage.create('payout'), NetworkType.TEST_NET);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
[
aliceTransferTransaction.toAggregate(danAccount.publicAccount),
bobTransferTransaction.toAggregate(danAccount.publicAccount)
],
NetworkType.TEST_NET
);
        // Replace with private key
final String privateKey = "<privateKey>";

final Address aliceAddress = Address.createFromRawAddress("VDG4WG-FS7EQJ-KFQKXM-4IUCQG-PXUW5H-DJVIJB-OXJG");
final Address bobAddress = Address.createFromRawAddress("VCGPXB-2A7T4I-W5MQCX-FQY4UQ-W5JNU5-F55HGK-HBUN");

final Account danAccount = Account.createFromPrivateKey(privateKey, NetworkType.TEST_NET);

final NetworkCurrencyMosaic xpx = NetworkCurrencyMosaic.createRelative(BigInteger.valueOf(10)); // 10 xpx represent 10 000 000 micro xpx

final TransferTransaction aliceTransferTransaction = TransferTransaction.create(
Deadline.create(2, HOURS),
aliceAddress,
Collections.singletonList(xpx),
PlainMessage.create("payout"),
NetworkType.TEST_NET
);

final TransferTransaction bobTransferTransaction = TransferTransaction.create(
Deadline.create(2, HOURS),
bobAddress,
Collections.singletonList(xpx),
PlainMessage.create("payout"),
NetworkType.TEST_NET
);

final AggregateTransaction aggregateTransaction = new TransactionBuilderFactory().aggregateComplete()
.innerTransactions(Arrays.asList(
aliceTransferTransaction.toAggregate(danAccount.getPublicAccount()),
bobTransferTransaction.toAggregate(danAccount.getPublicAccount())
)).deadline(new Deadline(2, ChronoUnit.HOURS)).networkType(NetworkType.TEST_NET);


  1. Sign and announce the transaction.
Golang
TypeScript
JavaScript
Java
signedTransaction, err := sender.Sign(aggregateTransaction)
if err != nil {
panic(err)
}

_, err = client.Transaction.Announce(context.Background(), signedTransaction)
if err != nil {
panic(err)
}
const signedTransaction = danAccount.sign(aggregateTransaction, generationHash);

transactionHttp
.announce(signedTransaction)
.subscribe(x => console.log(x), err => console.error(err));
const signedTransaction = danAccount.sign(aggregateTransaction, generationHash);

transactionHttp
.announce(signedTransaction)
.subscribe(x => console.log(x), err => console.error(err));
    final TransactionHttp transactionHttp = new TransactionHttp("http://bctestnet1.brimstone.xpxsirius.io:3000");

final SignedTransaction signedTransaction = danAccount.sign(aggregateTransaction, generationHash);

transactionHttp.announce(signedTransaction).toFuture().get();

What’s next?

Send an aggregate bonded transaction by following the creating an escrow with aggregate bonded transaction guide.

← Preventing spam attacks with account restrictionsCreating an escrow with aggregate bonded transaction →
  • Background Information
  • Prerequisites
  • Geting into some code
  • What’s next?
  • 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