ExecuteTransaction gRPC Method
Parameters
transaction
object
REQUIRED
Loading...
signatures
array
Loading...
read_mask
object
Loading...
Returns
finality
object
Loading...
certified
object
Loading...
checkpointed
string
Loading...
quorumExecuted
object
Loading...
transaction
object
Loading...
digest
string
Loading...
transaction
object
Loading...
signatures
array
Loading...
effects
object
Loading...
events
object
Loading...
checkpoint
string
Loading...
timestamp
string
Loading...
balanceChanges
array
Loading...
inputObjects
array
Loading...
outputObjects
array
Loading...
Request
1grpcurl \2-import-path . \3-proto sui/rpc/v2beta2/transaction_execution_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"transaction": {7"bcs": "BASE64_ENCODED_TX"8},9"options": {10"show_input": true,11"show_effects": true,12"show_events": true,13"show_object_changes": true,14"show_balance_changes": true15}16}' \17docs-demo.sui-mainnet.quiknode.pro:9000 \18sui.rpc.v2beta2.TransactionExecutionService/ExecuteTransaction19
1grpcurl \2-import-path . \3-proto sui/rpc/v2beta2/transaction_execution_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"transaction": {7"bcs": "BASE64_ENCODED_TX"8},9"options": {10"show_input": true,11"show_effects": true,12"show_events": true,13"show_object_changes": true,14"show_balance_changes": true15}16}' \17docs-demo.sui-mainnet.quiknode.pro:9000 \18sui.rpc.v2beta2.TransactionExecutionService/ExecuteTransaction19
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"log"9"time"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2beta2" // Your Generated .pb.go files path17)1819var (20token = "YOUR_TOKEN_NUMBER"21endpoint = "YOUR_QN_ENDPOINT:9000"22)2324// x-token Auth implementation25type auth struct {26token string27}2829func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {30return map[string]string{"x-token": a.token}, nil31}32func (a *auth) RequireTransportSecurity() bool {33return true34}3536func main() {37creds := credentials.NewTLS(&tls.Config{})38opts := []grpc.DialOption{39grpc.WithTransportCredentials(creds),40grpc.WithPerRPCCredentials(&auth{token}),41}4243conn, err := grpc.Dial(endpoint, opts...)44if err != nil {45log.Fatalf("Failed to connect: %v", err)46}47defer conn.Close()4849client := pb.NewTransactionExecutionServiceClient(conn)5051bcsTx := []byte("YOUR_BCS_SERIALIZED_TX_BYTES")5253sig := &pb.UserSignature{54Scheme: pb.SignatureScheme_ED25519,55Signature: []byte("YOUR_SIGNATURE_BYTES"),56PublicKey: []byte("YOUR_PUBLIC_KEY_BYTES"),57}5859// ReadMask specifies what response fields to return60readMask := &fieldmaskpb.FieldMask{61Paths: []string{"transaction", "finality"},62}6364// Build request65req := &pb.ExecuteTransactionRequest{66Transaction: &pb.Transaction{67Bcs: &pb.Bcs{68Bytes: bcsTx,69},70},71Signatures: []*pb.UserSignature{sig},72ReadMask: readMask,73}7475// Context with timeout76ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)77defer cancel()7879resp, err := client.ExecuteTransaction(ctx, req)80if err != nil {81log.Fatalf("ExecuteTransaction failed: %v", err)82}8384// Marshal response to pretty JSON85marshaler := protojson.MarshalOptions{86UseProtoNames: true,87EmitUnpopulated: true,88Indent: " ",89}90jsonBytes, err := marshaler.Marshal(resp)91if err != nil {92log.Fatalf("Failed to marshal response: %v", err)93}9495// Print result96var pretty map[string]interface{}97if err := json.Unmarshal(jsonBytes, &pretty); err != nil {98log.Fatalf("Failed to parse JSON: %v", err)99}100output, _ := json.MarshalIndent(pretty, "", " ")101fmt.Println(string(output))102}103
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"log"9"time"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2beta2" // Your Generated .pb.go files path17)1819var (20token = "YOUR_TOKEN_NUMBER"21endpoint = "YOUR_QN_ENDPOINT:9000"22)2324// x-token Auth implementation25type auth struct {26token string27}2829func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {30return map[string]string{"x-token": a.token}, nil31}32func (a *auth) RequireTransportSecurity() bool {33return true34}3536func main() {37creds := credentials.NewTLS(&tls.Config{})38opts := []grpc.DialOption{39grpc.WithTransportCredentials(creds),40grpc.WithPerRPCCredentials(&auth{token}),41}4243conn, err := grpc.Dial(endpoint, opts...)44if err != nil {45log.Fatalf("Failed to connect: %v", err)46}47defer conn.Close()4849client := pb.NewTransactionExecutionServiceClient(conn)5051bcsTx := []byte("YOUR_BCS_SERIALIZED_TX_BYTES")5253sig := &pb.UserSignature{54Scheme: pb.SignatureScheme_ED25519,55Signature: []byte("YOUR_SIGNATURE_BYTES"),56PublicKey: []byte("YOUR_PUBLIC_KEY_BYTES"),57}5859// ReadMask specifies what response fields to return60readMask := &fieldmaskpb.FieldMask{61Paths: []string{"transaction", "finality"},62}6364// Build request65req := &pb.ExecuteTransactionRequest{66Transaction: &pb.Transaction{67Bcs: &pb.Bcs{68Bytes: bcsTx,69},70},71Signatures: []*pb.UserSignature{sig},72ReadMask: readMask,73}7475// Context with timeout76ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)77defer cancel()7879resp, err := client.ExecuteTransaction(ctx, req)80if err != nil {81log.Fatalf("ExecuteTransaction failed: %v", err)82}8384// Marshal response to pretty JSON85marshaler := protojson.MarshalOptions{86UseProtoNames: true,87EmitUnpopulated: true,88Indent: " ",89}90jsonBytes, err := marshaler.Marshal(resp)91if err != nil {92log.Fatalf("Failed to marshal response: %v", err)93}9495// Print result96var pretty map[string]interface{}97if err := json.Unmarshal(jsonBytes, &pretty); err != nil {98log.Fatalf("Failed to parse JSON: %v", err)99}100output, _ := json.MarshalIndent(pretty, "", " ")101fmt.Println(string(output))102}103
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token6// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde1234567897// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}8// token will be : abcde123456789910const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';11const token = 'abcde123456789';1213const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2beta2/transaction_execution_service.proto');1415// Load protobuf definitions16const packageDefinition = protoLoader.loadSync(PROTO_PATH, {17keepCase: true,18longs: String,19enums: String,20defaults: true,21oneofs: true,22includeDirs: [path.join(__dirname, 'protos/proto')],23});2425const proto = grpc.loadPackageDefinition(packageDefinition) as any;26const TransactionExecutionService = proto.sui.rpc.v2beta2.TransactionExecutionService;2728// Create secure client29const client = new TransactionExecutionService(endpoint, grpc.credentials.createSsl());3031// Prepare metadata32const metadata = new grpc.Metadata();33metadata.add('x-token', token);3435// Placeholder request36const request = {37transaction: {38bcs: {39bytes: Buffer.from('YOUR_BCS_SERIALIZED_TX_BYTES', 'base64') // Replace with actual bytes40}41},42signatures: [43{44scheme: 0, // Usually 0 = ED2551945signature: Buffer.from('YOUR_SIGNATURE_BYTES', 'base64'), // Replace with actual bytes46public_key: Buffer.from('YOUR_PUBLIC_KEY_BYTES', 'base64') // Replace with actual bytes47}48],49read_mask: {50paths: ['transaction', 'finality']51}52};5354// Call ExecuteTransaction55client.ExecuteTransaction(request, metadata, (err: grpc.ServiceError | null, response: any) => {56if (err) {57console.error('gRPC Error:', err.message);58console.error('Details:', err.details);59} else {60console.log('Response:', JSON.stringify(response, null, 2));61}62});63
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token6// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde1234567897// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}8// token will be : abcde123456789910const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';11const token = 'abcde123456789';1213const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2beta2/transaction_execution_service.proto');1415// Load protobuf definitions16const packageDefinition = protoLoader.loadSync(PROTO_PATH, {17keepCase: true,18longs: String,19enums: String,20defaults: true,21oneofs: true,22includeDirs: [path.join(__dirname, 'protos/proto')],23});2425const proto = grpc.loadPackageDefinition(packageDefinition) as any;26const TransactionExecutionService = proto.sui.rpc.v2beta2.TransactionExecutionService;2728// Create secure client29const client = new TransactionExecutionService(endpoint, grpc.credentials.createSsl());3031// Prepare metadata32const metadata = new grpc.Metadata();33metadata.add('x-token', token);3435// Placeholder request36const request = {37transaction: {38bcs: {39bytes: Buffer.from('YOUR_BCS_SERIALIZED_TX_BYTES', 'base64') // Replace with actual bytes40}41},42signatures: [43{44scheme: 0, // Usually 0 = ED2551945signature: Buffer.from('YOUR_SIGNATURE_BYTES', 'base64'), // Replace with actual bytes46public_key: Buffer.from('YOUR_PUBLIC_KEY_BYTES', 'base64') // Replace with actual bytes47}48],49read_mask: {50paths: ['transaction', 'finality']51}52};5354// Call ExecuteTransaction55client.ExecuteTransaction(request, metadata, (err: grpc.ServiceError | null, response: any) => {56if (err) {57console.error('gRPC Error:', err.message);58console.error('Details:', err.details);59} else {60console.log('Response:', JSON.stringify(response, null, 2));61}62});63
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2beta2 import (6transaction_execution_service_pb2,7transaction_execution_service_pb2_grpc,8transaction_pb2,9signature_pb2,10bcs_pb211)1213# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token14# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678915# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}16# token will be: abcde1234567891718endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';19token = 'abcde123456789';2021def execute_transaction():22channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())23stub = transaction_execution_service_pb2_grpc.TransactionExecutionServiceStub(channel)2425# === PLACEHOLDER: BCS-serialized transaction ===26transaction = transaction_pb2.Transaction(27bcs=bcs_pb2.Bcs(28bytes=b"YOUR_BCS_SERIALIZED_TX_BYTES"29)30)3132signature = signature_pb2.UserSignature(33scheme=0, # e.g., 0 = ED2551934signature=b"YOUR_SIGNATURE_BYTES",35public_key=b"YOUR_PUBLIC_KEY_BYTES"36)3738read_mask = FieldMask(paths=["transaction", "finality"])3940request = transaction_execution_service_pb2.ExecuteTransactionRequest(41transaction=transaction,42signatures=[signature],43read_mask=read_mask44)4546metadata = [("x-token", token)]4748try:49response = stub.ExecuteTransaction(request, metadata=metadata)50return MessageToDict(response, preserving_proto_field_name=True)51except grpc.RpcError as e:52return {53"error": e.code().name,54"details": e.details()55}565758def main():59result = execute_transaction()60print(json.dumps(result, indent=2))616263if __name__ == "__main__":64main()65
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2beta2 import (6transaction_execution_service_pb2,7transaction_execution_service_pb2_grpc,8transaction_pb2,9signature_pb2,10bcs_pb211)1213# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token14# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678915# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}16# token will be: abcde1234567891718endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';19token = 'abcde123456789';2021def execute_transaction():22channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())23stub = transaction_execution_service_pb2_grpc.TransactionExecutionServiceStub(channel)2425# === PLACEHOLDER: BCS-serialized transaction ===26transaction = transaction_pb2.Transaction(27bcs=bcs_pb2.Bcs(28bytes=b"YOUR_BCS_SERIALIZED_TX_BYTES"29)30)3132signature = signature_pb2.UserSignature(33scheme=0, # e.g., 0 = ED2551934signature=b"YOUR_SIGNATURE_BYTES",35public_key=b"YOUR_PUBLIC_KEY_BYTES"36)3738read_mask = FieldMask(paths=["transaction", "finality"])3940request = transaction_execution_service_pb2.ExecuteTransactionRequest(41transaction=transaction,42signatures=[signature],43read_mask=read_mask44)4546metadata = [("x-token", token)]4748try:49response = stub.ExecuteTransaction(request, metadata=metadata)50return MessageToDict(response, preserving_proto_field_name=True)51except grpc.RpcError as e:52return {53"error": e.code().name,54"details": e.details()55}565758def main():59result = execute_transaction()60print(json.dumps(result, indent=2))616263if __name__ == "__main__":64main()65
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free