Create Transaction

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.

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 be applied in this context as well.

πŸ“˜

Process change

Beginning with [email protected], the MPC message loop between the client SDK and the backend is facilitated by the client and server SDKs. The following diagram illustrates the new loop.

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)