Signing and Broadcasting Transactions



This guide assumes knowledge of signing. For more detail, see our signing documentation here: Signing. In addition, you have to setup BramblSC

Signing Transactions

Transactions to be used in an offline signing capacity with BramblSc should use the Raw Transfer functions for this purpose. The Raw Transfer is similar to the BramblJS transaction, however, it does require some more involved steps.

In order to create and sign a raw transfer, the sequence of events is as follows:
1.) Send a raw transfer request
2.) Sign the returned raw transfer object
3.) Send the raw transfer object to a node for broadcasting

Step 1: Create your transaction object



  1. There are currently two types of raw transfers, RawPolyTransfer and RawAssetTransfer.
  2. You can create an address in BramblSc by following the Key Management documentation
val quantity = 10
val assetCode: AssetCode = AssetCode(1: Byte, senderAddress, "name")  
val rawTransfer: RawAssetTransfer = RawAssetTransfer(Seq(senderAddress), Seq((recipientAddress, quantity), assetCode, fee = 1L, minting = true)

Step 2: Retrieve the message to sign from the Topl network

val rawAssetTxF = brambl.rpc.getRawAssetTransfer(rawTransfer)
val rawAssetTx = Await.result(rawAssetTxF, 5.seconds).toOption.get.result.tx

where the key file has been loaded in per Key Management

Step 3: Sign the message

val signedTx = brambl.signTransaction(address)(rawAssetTx)

The transaction is then broadcasted using the broadcastTx function

val broadcastTx = brambl.rpc.broadcastTx(signedTx)