Create Transaction

Overview

The transaction process is initiated with the Customer Application, where the end-user initiates the transaction via their user interface. Subsequently, the application must trigger a call to the customer backend, which invokes the Fireblocks API with all the necessary parameters to generate a new transaction. Learn how to initiate the create transaction API call to Fireblocks.

Following this, the Fireblocks API will provide a unique transaction ID for the newly established transaction. As the transaction is submitted, its lifecycle begins, and its status updates based on its phase within the system. Fireblocks will dispatch a webhook notification for each transaction status update.

The most important status for this step is the Pending Signature status, which signifies that the transaction requires the end-user's signature. In parallel, Fireblocks will dispatch another webhook (NCW_DEVICE_MESSAGE), which should be managed by the client application and transmitted to the NCW SDK via the handleIncomingMessage method.

The client application must receive notifications for any transaction in the Pending Signature status. This can be achieved using the same method as for handling asynchronous messages.

Once the application receives a transaction that requires signing, along with the transaction details, including the transaction identifier (txId), it should invoke the signTransaction(txId) method provided by the NCW SDK to initiate the signing process.

It's important to note that the MPC signing process is asynchronous and involves multiple rounds of communication between Fireblocks and the end user. Therefore, the same protocol for managing outgoing and incoming messages should also be applied in this context.

Example

const txArgs: TransactionArguments = {
  source: {
    type: PeerType.END_USER_WALLET,
    walletId: '<my_user_wallet_id>,
    id: '0',
  },
  destination: {
    PeerType.ONE_TIME_ADDRESS,
    oneTimeAddress: {
      address: '<some_ETH_address>'
    }
  },
  assetId: 'ETH',
  amount: '<amount>',
  note: "My First NCW Transaction"
};

const txId = await fireblocks.createTransaction(txArgs);

The transaction signing is done by calling signTransaction(txId) NCW SDK method:

await fireblocksNCW.signTransaction(txId);
let result = try await getSdkInstance()?.signTransaction(txId: transactionId)
Fireblocks.getInstance(deviceId).signTransaction(txId)