cosmos/tx

Table of Contents

cosmos/tx/v1beta1/service.proto

Top

BroadcastTxRequest

BroadcastTxRequest is the request type for the Service.BroadcastTxRequest

RPC method.

FieldTypeLabelDescription
tx_bytes bytes

tx_bytes is the raw transaction.

mode BroadcastMode

BroadcastTxResponse

BroadcastTxResponse is the response type for the

Service.BroadcastTx method.

FieldTypeLabelDescription
tx_response cosmos.base.abci.v1beta1.TxResponse

tx_response is the queried TxResponses.

GetBlockWithTxsRequest

GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs

RPC method.

Since: cosmos-sdk 0.45.2

FieldTypeLabelDescription
height int64

height is the height of the block to query.

pagination cosmos.base.query.v1beta1.PageRequest

pagination defines a pagination for the request.

GetBlockWithTxsResponse

GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method.

Since: cosmos-sdk 0.45.2

FieldTypeLabelDescription
txs Tx repeated

txs are the transactions in the block.

block_id tendermint.types.BlockID

block tendermint.types.Block

pagination cosmos.base.query.v1beta1.PageResponse

pagination defines a pagination for the response.

GetTxRequest

GetTxRequest is the request type for the Service.GetTx

RPC method.

FieldTypeLabelDescription
hash string

hash is the tx hash to query, encoded as a hex string.

GetTxResponse

GetTxResponse is the response type for the Service.GetTx method.

FieldTypeLabelDescription
tx Tx

tx is the queried transaction.

tx_response cosmos.base.abci.v1beta1.TxResponse

tx_response is the queried TxResponses.

GetTxsEventRequest

GetTxsEventRequest is the request type for the Service.TxsByEvents

RPC method.

FieldTypeLabelDescription
events string repeated

events is the list of transaction event type.

pagination cosmos.base.query.v1beta1.PageRequest

pagination defines a pagination for the request.

order_by OrderBy

GetTxsEventResponse

GetTxsEventResponse is the response type for the Service.TxsByEvents

RPC method.

FieldTypeLabelDescription
txs Tx repeated

txs is the list of queried transactions.

tx_responses cosmos.base.abci.v1beta1.TxResponse repeated

tx_responses is the list of queried TxResponses.

pagination cosmos.base.query.v1beta1.PageResponse

pagination defines a pagination for the response.

SimulateRequest

SimulateRequest is the request type for the Service.Simulate

RPC method.

FieldTypeLabelDescription
tx Tx

Deprecated. tx is the transaction to simulate. Deprecated. Send raw tx bytes instead.

tx_bytes bytes

tx_bytes is the raw transaction. Since: cosmos-sdk 0.43

Fields with deprecated option

Name Option
tx

true

SimulateResponse

SimulateResponse is the response type for the

Service.SimulateRPC method.

FieldTypeLabelDescription
gas_info cosmos.base.abci.v1beta1.GasInfo

gas_info is the information about gas used in the simulation.

result cosmos.base.abci.v1beta1.Result

result is the result of the simulation.

BroadcastMode

BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method.

NameNumberDescription
BROADCAST_MODE_UNSPECIFIED 0

zero-value for mode ordering

BROADCAST_MODE_BLOCK 1

BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for the tx to be committed in a block.

BROADCAST_MODE_SYNC 2

BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for a CheckTx execution response only.

BROADCAST_MODE_ASYNC 3

BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns immediately.

OrderBy

OrderBy defines the sorting order

NameNumberDescription
ORDER_BY_UNSPECIFIED 0

ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case.

ORDER_BY_ASC 1

ORDER_BY_ASC defines ascending order

ORDER_BY_DESC 2

ORDER_BY_DESC defines descending order

Service

Service defines a gRPC service for interacting with transactions.

Method NameRequest TypeResponse TypeDescription
Simulate SimulateRequest SimulateResponse

Simulate simulates executing a transaction for estimating gas usage.

GetTx GetTxRequest GetTxResponse

GetTx fetches a tx by hash.

BroadcastTx BroadcastTxRequest BroadcastTxResponse

BroadcastTx broadcast transaction.

GetTxsEvent GetTxsEventRequest GetTxsEventResponse

GetTxsEvent fetches txs by event.

GetBlockWithTxs GetBlockWithTxsRequest GetBlockWithTxsResponse

GetBlockWithTxs fetches a block with decoded txs. Since: cosmos-sdk 0.45.2

Methods with HTTP bindings

Method Name Method Pattern Body
Simulate POST /cosmos/tx/v1beta1/simulate *
GetTx GET /cosmos/tx/v1beta1/txs/{hash}
BroadcastTx POST /cosmos/tx/v1beta1/txs *
GetTxsEvent GET /cosmos/tx/v1beta1/txs
GetBlockWithTxs GET /cosmos/tx/v1beta1/txs/block/{height}

cosmos/tx/v1beta1/tx.proto

Top

AuthInfo

AuthInfo describes the fee and signer modes that are used to sign a

transaction.

FieldTypeLabelDescription
signer_infos SignerInfo repeated

signer_infos defines the signing modes for the required signers. The number and order of elements must match the required signers from TxBody's messages. The first element is the primary signer and the one which pays the fee.

fee Fee

Fee is the fee and gas limit for the transaction. The first signer is the primary signer and the one which pays the fee. The fee can be calculated based on the cost of evaluating the body and doing signature verification of the signers. This can be estimated via simulation.

Fee

Fee includes the amount of coins paid in fees and the maximum

gas to be used by the transaction. The ratio yields an effective "gasprice",

which must be above some miminum to be accepted into the mempool.

FieldTypeLabelDescription
amount cosmos.base.v1beta1.Coin repeated

amount is the amount of coins to be paid as a fee

gas_limit uint64

gas_limit is the maximum gas that can be used in transaction processing before an out of gas error occurs

payer string

if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. the payer must be a tx signer (and thus have signed this field in AuthInfo). setting this field does *not* change the ordering of required signers for the transaction.

granter string

if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does not support fee grants, this will fail

ModeInfo

ModeInfo describes the signing mode of a single or nested multisig signer.

FieldTypeLabelDescription
single ModeInfo.Single

single represents a single signer

multi ModeInfo.Multi

multi represents a nested multisig signer

ModeInfo.Multi

Multi is the mode info for a multisig public key

FieldTypeLabelDescription
bitarray cosmos.crypto.multisig.v1beta1.CompactBitArray

bitarray specifies which keys within the multisig are signing

mode_infos ModeInfo repeated

mode_infos is the corresponding modes of the signers of the multisig which could include nested multisig public keys

ModeInfo.Single

Single is the mode info for a single signer. It is structured as a message

to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the

future

FieldTypeLabelDescription
mode cosmos.tx.signing.v1beta1.SignMode

mode is the signing mode of the single signer

SignDoc

SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT.

FieldTypeLabelDescription
body_bytes bytes

body_bytes is protobuf serialization of a TxBody that matches the representation in TxRaw.

auth_info_bytes bytes

auth_info_bytes is a protobuf serialization of an AuthInfo that matches the representation in TxRaw.

chain_id string

chain_id is the unique identifier of the chain this transaction targets. It prevents signed transactions from being used on another chain by an attacker

account_number uint64

account_number is the account number of the account in state

SignerInfo

SignerInfo describes the public key and signing mode of a single top-level

signer.

FieldTypeLabelDescription
public_key google.protobuf.Any

public_key is the public key of the signer. It is optional for accounts that already exist in state. If unset, the verifier can use the required \ signer address for this position and lookup the public key.

mode_info ModeInfo

mode_info describes the signing mode of the signer and is a nested structure to support nested multisig pubkey's

sequence uint64

sequence is the sequence of the account, which describes the number of committed transactions signed by a given address. It is used to prevent replay attacks.

Tx

Tx is the standard type used for broadcasting transactions.

FieldTypeLabelDescription
body TxBody

body is the processable content of the transaction

auth_info AuthInfo

auth_info is the authorization related content of the transaction, specifically signers, signer modes and fee

signatures bytes repeated

signatures is a list of signatures that matches the length and order of AuthInfo's signer_infos to allow connecting signature meta information like public key and signing mode by position.

TxBody

TxBody is the body of a transaction that all signers sign over.

FieldTypeLabelDescription
messages google.protobuf.Any repeated

messages is a list of messages to be executed. The required signers of those messages define the number and order of elements in AuthInfo's signer_infos and Tx's signatures. Each required signer address is added to the list only the first time it occurs. By convention, the first required signer (usually from the first message) is referred to as the primary signer and pays the fee for the whole transaction.

memo string

memo is any arbitrary note/comment to be added to the transaction. WARNING: in clients, any publicly exposed text should not be called memo, but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122).

timeout_height uint64

timeout is the block height after which this transaction will not be processed by the chain

extension_options google.protobuf.Any repeated

extension_options are arbitrary options that can be added by chains when the default options are not sufficient. If any of these are present and can't be handled, the transaction will be rejected

non_critical_extension_options google.protobuf.Any repeated

extension_options are arbitrary options that can be added by chains when the default options are not sufficient. If any of these are present and can't be handled, they will be ignored

TxRaw

TxRaw is a variant of Tx that pins the signer's exact binary representation

of body and auth_info. This is used for signing, broadcasting and

verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and

the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used

as the transaction ID.

FieldTypeLabelDescription
body_bytes bytes

body_bytes is a protobuf serialization of a TxBody that matches the representation in SignDoc.

auth_info_bytes bytes

auth_info_bytes is a protobuf serialization of an AuthInfo that matches the representation in SignDoc.

signatures bytes repeated

signatures is a list of signatures that matches the length and order of AuthInfo's signer_infos to allow connecting signature meta information like public key and signing mode by position.

cosmos/tx/signing/v1beta1/signing.proto

Top

SignatureDescriptor

SignatureDescriptor is a convenience type which represents the full data for

a signature including the public key of the signer, signing modes and the

signature itself. It is primarily used for coordinating signatures between

clients.

FieldTypeLabelDescription
public_key google.protobuf.Any

public_key is the public key of the signer

data SignatureDescriptor.Data

sequence uint64

sequence is the sequence of the account, which describes the number of committed transactions signed by a given address. It is used to prevent replay attacks.

SignatureDescriptor.Data

Data represents signature data

FieldTypeLabelDescription
single SignatureDescriptor.Data.Single

single represents a single signer

multi SignatureDescriptor.Data.Multi

multi represents a multisig signer

SignatureDescriptor.Data.Multi

Multi is the signature data for a multisig public key

FieldTypeLabelDescription
bitarray cosmos.crypto.multisig.v1beta1.CompactBitArray

bitarray specifies which keys within the multisig are signing

signatures SignatureDescriptor.Data repeated

signatures is the signatures of the multi-signature

SignatureDescriptor.Data.Single

Single is the signature data for a single signer

FieldTypeLabelDescription
mode SignMode

mode is the signing mode of the single signer

signature bytes

signature is the raw signature bytes

SignatureDescriptors

SignatureDescriptors wraps multiple SignatureDescriptor's.

FieldTypeLabelDescription
signatures SignatureDescriptor repeated

signatures are the signature descriptors

SignMode

SignMode represents a signing mode with its own security guarantees.

NameNumberDescription
SIGN_MODE_UNSPECIFIED 0

SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be rejected

SIGN_MODE_DIRECT 1

SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is verified with raw bytes from Tx

SIGN_MODE_TEXTUAL 2

SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable textual representation on top of the binary representation from SIGN_MODE_DIRECT

SIGN_MODE_LEGACY_AMINO_JSON 127

SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses Amino JSON and will be removed in the future

SIGN_MODE_EIP_191 191

SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, but is not implemented on the SDK by default. To enable EIP-191, you need to pass a custom `TxConfig` that has an implementation of `SignModeHandler` for EIP-191. The SDK may decide to fully support EIP-191 in the future. Since: cosmos-sdk 0.45.2

Scalar Value Types

.proto Type Notes Python Type
double float
float float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int/long
uint32 Uses variable-length encoding. int/long
uint64 Uses variable-length encoding. int/long
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int/long
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. int
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. int/long
sfixed32 Always four bytes. int
sfixed64 Always eight bytes. int/long
bool boolean
string A string must always contain UTF-8 encoded or 7-bit ASCII text. str/unicode
bytes May contain any arbitrary sequence of bytes. str