Developer Center

Developer Center

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

›Multisig 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

Sending a multisig transaction

Send a transaction involving a multisig.

Background

Multisig transaction

Sending an aggregate complete transaction

Alice and Bob have separate accounts. They also want to have a shared account to buy groceries, so that if Bob is out shopping, he can buy groceries for both himself and Alice.

This shared account appears in Sirius Chain as 1-of-2 multisig. Multisig accounts permit Alice and Bob sharing funds in a separate account, requiring only the signature from one of them to transact.

1-of-2 multisig account example

1-of-2 multisig account example

In this guide, you will send a transaction from a multisig account.

Prerequisites

  • XPX-Chain-SDK.
  • A text editor or IDE.
  • Finish sending a transfer transaction guide.
  • Finish converting an account to multisig guide.
  • A multisig account with XPX.
  • A cosignatory account with XPX.

Getting into some code

1-of-2 signatures required

Bob has finished filling the basket, and he is ready to pay. The cashier’s screen indicates that the cost of the purchase adds up to 10 XPX.

Let’s develop the piece of code present in Bob’s mobile wallet that enables him to send multisig transactions.

  1. Define the private key of Bob’s account and the public key of the multisig account shared with Alice.
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)

cosignatureAccount, err := client.NewAccountFromPrivateKey(os.Getenv("COSIGNATORY_PRIVATE_KEY"))
if err != nil {
panic(err)
}

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

recipientAddress, err := sdk.NewAddressFromRaw("VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54")
if err != nil {
panic(err)
}
const transactionHttp = new TransactionHttp( 'http://bctestnet1.brimstone.xpxsirius.io:3000');

const cosignatoryPrivateKey = process.env.COSIGNATORY_1_PRIVATE_KEY as string;
const cosignatoryAccount = Account.createFromPrivateKey(cosignatoryPrivateKey, NetworkType.TEST_NET);

const multisigAccountPublicKey = '202B3861F34F6141E120742A64BC787D6EBC59C9EFB996F4856AA9CBEE11CD31';
const multisigAccount = PublicAccount.createFromPublicKey(multisigAccountPublicKey, NetworkType.TEST_NET);

const recipientAddress = Address.createFromRawAddress('VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54');
const transactionHttp = new TransactionHttp( 'http://bctestnet1.brimstone.xpxsirius.io:3000');

const cosignatoryPrivateKey = process.env.COSIGNATORY_1_PRIVATE_KEY;
const cosignatoryAccount = Account.createFromPrivateKey(cosignatoryPrivateKey, NetworkType.TEST_NET);

const multisigAccountPublicKey = '202B3861F34F6141E120742A64BC787D6EBC59C9EFB996F4856AA9CBEE11CD31';
const multisigAccount = PublicAccount.createFromPublicKey(multisigAccountPublicKey, NetworkType.TEST_NET);

const recipientAddress = Address.createFromRawAddress('VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54');
    // Replace with a Cosignatory's private key
final String cosignatoryPrivateKey = "<privateKey>";

// Replace with a Multisig's public key
final String multisigAccountPublicKey = "<publicKey>";

// Replace with recipient address
final String recipientAddress = "VD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54";

final Account cosignatoryAccount = Account.createFromPrivateKey(cosignatoryPrivateKey, NetworkType.TEST_NET);

final PublicAccount multisigPublicAccount = PublicAccount.createFromPublicKey(multisigAccountPublicKey, NetworkType.TEST_NET);
  1. Define the following transfer transaction.
  • Recipient: Grocery’s address
  • Message: sending 10 XPX
  • Mosaics: [10 XPX]
Golang
TypeScript
JavaScript
Java
transferTransaction, err := client.NewTransferTransaction(
sdk.NewDeadline(time.Hour),
recipientAddress,
[]*sdk.Mosaic{sdk.XpxRelative(10)},
sdk.NewPlainMessage("sending 10 xpx"),
)
if err != nil {
panic(err)
}
const transferTransaction = TransferTransaction.create(
Deadline.create(),
recipientAddress,
[NetworkCurrencyMosaic.createRelative(10)],
PlainMessage.create('sending 10 xpx'),
NetworkType.TEST_NET);
const transferTransaction = TransferTransaction.create(
Deadline.create(),
recipientAddress,
[NetworkCurrencyMosaic.createRelative(10)],
PlainMessage.create('sending 10 xpx'),
NetworkType.TEST_NET);
    final TransferTransaction transferTransaction = TransferTransaction.create(
Deadline.create(2, HOURS),
Address.createFromRawAddress(recipientAddress),
Collections.singletonList(NetworkCurrencyMosaic.createRelative(BigInteger.valueOf(10))),
PlainMessage.create("sending 10 xpx"),
NetworkType.TEST_NET
);
  1. Wrap the transfer transaction under an aggregate transaction, attaching multisig public key as the signer.

An aggregate transaction is complete if before announcing it to the network, all the required cosigners have signed it. In this case the multisig requires only one signature (1-of-2), so you can define the aggregate as complete.

Golang
TypeScript
JavaScript
Java
transferTransaction.ToAggregate(multisigAccount)
aggregateTransaction, err := client.NewCompleteAggregateTransaction(sdk.NewDeadline(time.Hour), []sdk.Transaction{transferTransaction})
if err != nil {
panic(err)
}
const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
[transferTransaction.toAggregate(multisigAccount)],
NetworkType.TEST_NET);
const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
[transferTransaction.toAggregate(multisigAccount)],
NetworkType.TEST_NET);

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

  1. Sign and announce the transaction with Bob’s account.
Golang
TypeScript
JavaScript
Java
signedTransaction, err := cosignatureAccount.Sign(aggregateTransaction)
if err != nil {
panic(err)
}

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

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

transactionHttp
.announce(signedTransaction)
.subscribe(x => console.log(x), err => console.error(err));
final SignedTransaction aggregateSignedTransaction = cosignatoryAccount.sign(aggregateTransaction, generationHash);

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

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

2-of-2 signatures required

What would have happened if the account was a 2-of-2 multisig instead of a 1-of-2? As all required cosigners did not sign the transaction, it should be announced as aggregate bonded and cosigned later with Alice’s account.

Multisig Transaction 2 of 2

Sending an aggregate bonded transaction

  1. Open a new terminal to monitor the aggregate bonded transaction.
CLI
xpx2-cli monitor aggregatebonded --address <your-address-here>
  1. Modify the previous code, defining the transaction as aggregate bonded.
Golang
TypeScript
JavaScript
Java
aggregateBoundedTransaction, err := client.NewBondedAggregateTransaction(
sdk.NewDeadline(time.Hour),
[]sdk.Transaction{transferTransaction},
)
if err != nil {
panic(err)
}

signedAggregateBoundedTransaction, err := cosignatureAccount.Sign(aggregateBoundedTransaction)
if err != nil {
panic(err)
}
const aggregateTransaction = AggregateTransaction.createBonded(
Deadline.create(),
[transferTransaction.toAggregate(multisigAccount)],
NetworkType.TEST_NET);

const signedTransaction = cosignatoryAccount.sign(aggregateTransaction, generationHash);
const aggregateTransaction = AggregateTransaction.createBonded(
Deadline.create(),
[transferTransaction.toAggregate(multisigAccount)],
NetworkType.TEST_NET);

const signedTransaction = cosignatoryAccount.sign(aggregateTransaction, generationHash);
final AggregateTransaction aggregateTransaction = new TransactionBuilderFactory().aggregateBonded()
.innerTransactions(Arrays.asList(
transferTransaction.toAggregate(multisigPublicAccount)
)).deadline(new Deadline(2, ChronoUnit.HOURS)).networkType(NetworkType.TEST_NET);

final SignedTransaction aggregateSignedTransaction = cosignatoryAccount.sign(aggregateTransaction, generationHash);
  1. When an aggregate transaction is bonded, Bob needs to lock at least 10 XPX to avoid network spamming. Once all cosigners sign the transaction, the amount of XPX locked becomes available again in Bob’s account. After hash lock transaction has been confirmed, announce the aggregate bonded transaction.
Golang
TypeScript
JavaScript
Java
lockFundsTransaction, err := client.NewLockFundsTransaction(
sdk.NewDeadline(time.Hour),
sdk.XpxRelative(10),
sdk.Duration(480),
signedAggregateBoundedTransaction,
)
if err != nil {
panic(err)
}

signedLockFundsTransaction, err := cosignatureAccount.Sign(lockFundsTransaction)
if err != nil {
panic(err)
}

_, err = client.Transaction.Announce(context.Background(), signedLockFundsTransaction)
if err != nil {
panic(err)
}
const lockFundsTransaction = LockFundsTransaction.create(
Deadline.create(),
NetworkCurrencyMosaic.createRelative(10),
UInt64.fromUint(480),
signedTransaction,
NetworkType.TEST_NET);

const lockFundsTransactionSigned = cosignatoryAccount.sign(lockFundsTransaction, generationHash);

listener.open().then(() => {

transactionHttp
.announce(lockFundsTransactionSigned)
.subscribe(x => console.log(x), err => console.error(err));

listener
.confirmed(cosignatoryAccount.address)
.pipe(
filter((transaction) => transaction.transactionInfo !== undefined
&& transaction.transactionInfo.hash === lockFundsTransactionSigned.hash),
mergeMap(ignored => transactionHttp.announceAggregateBonded(signedTransaction))
)
.subscribe(announcedAggregateBonded => console.log(announcedAggregateBonded),
err => console.error(err));
});
const lockFundsTransaction = LockFundsTransaction.create(
Deadline.create(),
NetworkCurrencyMosaic.createRelative(10),
UInt64.fromUint(480),
signedTransaction,
NetworkType.TEST_NET);

const lockFundsTransactionSigned = cosignatoryAccount.sign(lockFundsTransaction, generationHash);

listener.open().then(() => {

transactionHttp
.announce(lockFundsTransactionSigned)
.subscribe(x => console.log(x), err => console.error(err));

listener
.confirmed(cosignatoryAccount.address)
.pipe(
filter((transaction) => transaction.transactionInfo !== undefined
&& transaction.transactionInfo.hash === lockFundsTransactionSigned.hash),
mergeMap(ignored => transactionHttp.announceAggregateBonded(signedTransaction))
)
.subscribe(announcedAggregateBonded => console.log(announcedAggregateBonded),
err => console.error(err));
});

// Creating the lock funds transaction and announce it

final LockFundsTransaction lockFundsTransaction = LockFundsTransaction.create(
Deadline.create(2, HOURS),
NetworkCurrencyMosaic.createRelative(BigInteger.valueOf(10)),
BigInteger.valueOf(480),
aggregateSignedTransaction,
NetworkType.TEST_NET
);

final SignedTransaction lockFundsTransactionSigned = cosignatoryAccount.sign(lockFundsTransaction, generationHash);

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

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

System.out.println(lockFundsTransactionSigned.getHash());

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

listener.open().get();

final Transaction transaction = listener.confirmed(cosignatoryAccount.getAddress()).take(1).toFuture().get();

System.out.println(transaction);

transactionHttp.announceAggregateBonded(aggregateSignedTransaction).toFuture().get();
  1. Cosign the aggregate transaction with Alice's account. Use transaction hash output from step 1.
CLI
xpx2-cli transaction cosign --hash A6A374E66B32A3D5133018EFA9CD6E3169C8EEA339F7CCBE29C47D07086E068C --profile alice
← Creating a multi-level multisig-accountRegistering a namespace →
  • Background
  • Prerequisites
  • Getting into some code
    • 1-of-2 signatures required
    • 2-of-2 signatures required
  • 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