Skip to main content


ProtocolService provides a set of stateless APIs for constructing and broadcasting blockchain-specific cryptographic payloads.

The central sequence of API invocations is constructing, signing, and broadcasting a transaction. Signing a transaction requires the use of MPCKeyService or an external signing mechanism, because ProtocolService is stateless and signing algorithms require a private key (i.e., user state).

ProtocolService, however, can be used to construct, and then subsequently, broadcast a transaction.

Sample Code

The following code snippet demonstrates how a transaction to transfer Ethereum from one address (the sender) to another (the recipient) is constructed and broadcast.


The code snippet assumes the existence of a keyManager with a CreateSignature API. In reality, you would use the MPCKeyService’s CreateSignature method in coordination with the WaaS SDK.

sendAmount := big.NewInt(0.75 * params.Ether).String()
feeAmount := big.NewInt(10 * params.Gwei).String()

// 1. Construct an unsigned transfer transaction.
constructTxReq := &protocols.ConstructTransferTransactionRequest{
Network: "networks/ethereum-mainnet", // The resource name of the Ethereum Mainnet Network.
Asset: "networks/ethereum-mainnet/assets/2f26f7f2-6bc4-5669-9759-57a8743bff2d", // The resource name for the ETH Asset.
Sender: "0x974CaA59e49682CdA0AD2bbe82983419A2ECC400",
Recipient: "0x4ba6b8F1eBc3c14233F7917c721A64b2DA1b80C6",
Amount: sendAmount,
Nonce: 0,
Fee: feeAmount,

tx, _ := client.ConstructTransferTransaction(ctx, constructTxReq)

// 2. Create a signature. Here we assume the existence of a keyManager with a CreateSignature
// API that ouputs a signature. In reality you would use a combination of the MPCKeyService
// and the WaaS SDK to produce this signature, but we abstract out that complexity here.
sig, _ := keyManager.CreateSignature(ctx, tx, ...)

// Set the signature on the Transaction.
tx.RawSignedTransaction = sig

// 3. Broadcast the transaction.
broadcastReq := &protocolsRpc.BroadcastTransactionRequest{
Network: "networks/ethereum-mainnet",
Transaction: tx,

broadcastTx, _ := client.BroadcastTransaction(ctx, broadcastReq)

Was this helpful?