Developer Center

Developer Center

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

›Transfer 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 a transfer transaction

Transfer mosaics and messages between two accounts.

Prerequisites

  • Finish the getting started section.
  • XPX-Chain-SDK or XPX-Chain-CLI.
  • A text editor or IDE.
  • An account with XPX.

Background Information

Transfer Transaction

Sending a transfer Transaction

Alice wants to send 10 XPX to Bob, whose address is VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54.

Monitoring the transaction

Once an account announces a transaction, the server will always return an OK response. Receiving an OK response does not mean the transaction is valid. A good practice is to monitor transactions before being announced.

To understand the transaction life cycle, we recommend you to open three new terminals. The first terminal monitors announced transactions validation errors.

xpx2-cli monitor status

Monitoring unconfirmed shows you which transactions have reached the network, but not are not included in a block yet.

xpx2-cli monitor unconfirmed

Once a transaction is included, you will see it under the confirmed terminal.

xpx2-cli monitor confirmed

Getting into some code

  1. Create the transfer transaction, including Bob's address as the recipient and 10 XPX.
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)

account, err := client.NewAccountFromPrivateKey(os.Getenv("PRIVATE_KEY"))
if err != nil {
panic(err)
}
address, err := sdk.NewAddressFromRaw("VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54")
if err != nil {
panic(err)
}

transferTransaction, err := client.NewTransferTransaction(
sdk.NewDeadline(time.Hour),
address,
[]*sdk.Mosaic{sdk.XpxRelative(10)},
sdk.NewPlainMessage("Welcome to Sirius Chain"),
)
if err != nil {
panic(err)
}
const recipientAddress = Address.createFromRawAddress('VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54');

const transferTransaction = TransferTransaction.create(
Deadline.create(),
recipientAddress,
[NetworkCurrencyMosaic.createRelative(10)],
PlainMessage.create('Welcome To Sirius Chain'),
NetworkType.TEST_NET);
const recipientAddress = Address.createFromRawAddress('VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54');

const transferTransaction = TransferTransaction.create(
Deadline.create(),
recipientAddress,
[NetworkCurrencyMosaic.createRelative(10)],
PlainMessage.create('Welcome To Sirius Chain'),
NetworkType.TEST_NET);
    final String recipientAddress = "VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54";

final TransferTransaction transferTransaction = TransferTransaction.create(
Deadline.create(2, HOURS),
Address.createFromRawAddress(recipientAddress),
Collections.singletonList(NetworkCurrencyMosaic.createRelative(BigInteger.valueOf(10))),
PlainMessage.create("Welcome To Sirius Chain"),
NetworkType.TEST_NET
);

As you may have noticed, transfer transactions require an array of mosaics as a parameter, allowing to send transfer transactions with multiple mosaics at the same time.

If you own more than one mosaic, you can send them together in the same transaction:

Golang
TypeScript
JavaScript
Java
mosaicId, err := sdk.NewMosaicIdFromNonceAndOwner(nonce, account.PublicAccount.PublicKey)
if err != nil {
panic(err)
}

myMosaic, err := sdk.NewMosaic(mosaicId, 10)
if err != nil {
panic(err)
}

mosaics := []*sdk.Mosaic{sdk.XpxRelative(10), myMosaic}
var myMosaicId = new MosaicId("<MosaicHexString>");

var myMosaic = new Mosaic(myMosaicId, UInt64.fromUint(10));

var mosaics = [
myMosaic,
NetworkCurrencyMosaic.createRelative(10)
];
var myMosaicId = new MosaicId("<MosaicHexString>");

var myMosaic = new Mosaic(myMosaicId, UInt64.fromUint(10));

var mosaics = [
myMosaic,
NetworkCurrencyMosaic.createRelative(10)
];

MosaicId myMosaicId = new MosaicId("<MosaicHexString>");

Mosaic myMosaic = new Mosaic(myMosaicId, BigInteger.valueOf(10));

List<Mosaic> mosaics = Arrays.asList(
myMosaic,
NetworkCurrencyMosaic.createRelative(BigInteger.valueOf(10))
);

Note

Sirius Chain mainly works with absolute amounts. To get an absolute amount, multiply the amount of assets you want to send by the power of 10 with divisibility as the exponent. For example, if the mosaic has a divisibility of 2, to send 10 units (relative), you should define 1000 (absolute) instead.

  1. Sign the transaction with Alice account.
Golang
TypeScript
JavaScript
Java
signedTransaction, err := account.Sign(transferTransaction)
if err != nil {
panic(err)
}
const privateKey = process.env.PRIVATE_KEY as string;

const account = Account.createFromPrivateKey(privateKey, NetworkType.TEST_NET);

const signedTransaction = account.sign(transferTransaction, generationHash);
const privateKey = process.env.PRIVATE_KEY;

const account = Account.createFromPrivateKey(privateKey, NetworkType.TEST_NET);

const signedTransaction = account.sign(transferTransaction, generationHash);
    // Replace with private key
final String privateKey = "<privateKey>";

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

final SignedTransaction signedTransaction = account.sign(transferTransaction, generationHash);
  1. Once signed, you can announce the transaction to the network.
Golang
TypeScript
JavaScript
Java
_, err = client.Transaction.Announce(context.Background(), signedTransaction)
if err != nil {
panic(err)
}
const transactionHttp = new TransactionHttp('http://bctestnet1.brimstone.xpxsirius.io:3000');

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

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

transactionHttp.announce(signedTransaction).toFuture().get();
  1. Open the terminal where you are monitoring account transactions status. It should be vacant. If there is an error, you can check the error code here.

A new transaction should have appeared in the terminal where you are monitoring unconfirmed. At this point, the transaction has reached the network, but it is not clear if it will get included in a block.

If it is included in a block, the transaction gets processed, and the amount stated in the transaction gets transferred from the sender’s account to the recipient’s account.

← Linking namespace to accountSending an encrypted message →
  • Prerequisites
  • Background Information
    • Monitoring the transaction
  • 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