GRPC Transaction building

Can anyone give me an example of how we can execute transaction using GRPC in rust? I’m stuggling to create the Transaction object which is taken as input in GRPC transaction execution method.

Do you know Sui’s Full Node gRPC API?
It’s one of the most common cases where GRPC call takes Transaction protobuf message as input in the Rust ecosystem. Please check from Sui’s “sui/rpc/v2/transaction.proto”.
Please use the sui-rust-sdk. It has native GRPC support.
Let’s communicate together for the future.
i’m a smart contract and DeAI engineer with 7+ years.

The main thing I would avoid is manually constructing every protobuf field by hand. The gRPC Transaction message is the wire format; for Rust code, prefer building/signing a normal Sui transaction with the Rust SDK crates, then pass that transaction plus signatures into ExecuteTransactionRequest.

For current Sui Rust gRPC work, look at the sui-rust-sdk repository and its split crates:

  • sui-sdk-types: core Sui transaction/object/signature types.
  • sui-crypto: signing utilities.
  • sui-rpc: gRPC client/protobuf bindings.
  • sui-transaction-builder: transaction/PTB construction helpers.

The gRPC execution request expects:

  • transaction: the transaction to execute.
  • signatures: user signatures authorizing that transaction.
  • optional read_mask: fields to return, such as effects/status/checkpoint.

So the safer pattern is:

  1. Build the PTB/transaction using Sui Rust transaction types or builder helpers.
  2. Set sender, gas price, gas budget, expiration, and gas payment correctly.
  3. Sign the transaction bytes/data with the sender key.
  4. Convert/encode it into the gRPC Transaction representation expected by your sui-rpc version.
  5. Submit it through TransactionExecutionService.ExecuteTransaction.

I would not rely on a hand-written protobuf struct unless you are already mirroring the exact BCS/proto layout for your SDK version. The exact Rust imports and helper names are version-sensitive, so check the examples/docs for the specific sui-rust-sdk version you are using.

Also make sure you are connecting to a real gRPC endpoint. JSON-RPC and gRPC are different APIs; pointing a gRPC client at a JSON-RPC endpoint can produce misleading errors.

References: