Protocol Documentation
Table of Contents
Top
x/wasm/internal/types/genesis.proto
Code
Code struct encompasses CodeInfo and CodeBytes
Contract
Contract struct encompasses ContractAddress, ContractInfo, and ContractState
GenesisState
GenesisState - genesis state of x/wasm
Sequence
Sequence key and value of an id generation counter
Top
x/wasm/internal/types/msg.proto
MsgClearAdmin
MsgClearAdmin removes any admin stored for a smart contract
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| contract |
string |
|
Contract is the address of the smart contract |
MsgExecuteContract
MsgExecuteContract submits the given message data to a smart contract
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| contract |
string |
|
Contract is the address of the smart contract |
| msg |
bytes |
|
Msg json encoded message to be passed to the contract |
| sent_funds |
cosmos.base.v1beta1.Coin |
repeated |
SentFunds coins that are transferred to the contract on execution |
MsgInstantiateContract
MsgInstantiateContract create a new smart contract instance for the given code id.
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| admin |
string |
|
Admin is an optional address that can execute migrations |
| code_id |
uint64 |
|
CodeID is the reference to the stored WASM code |
| label |
string |
|
Label is optional metadata to be stored with a contract instance. |
| init_msg |
bytes |
|
InitMsg json encoded message to be passed to the contract on instantiation |
| init_funds |
cosmos.base.v1beta1.Coin |
repeated |
InitFunds coins that are transferred to the contract on instantiation |
MsgMigrateContract
MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| contract |
string |
|
Contract is the address of the smart contract |
| code_id |
uint64 |
|
CodeID references the new WASM code |
| migrate_msg |
bytes |
|
MigrateMsg json encoded message to be passed to the contract on migration |
MsgStoreCode
MsgStoreCode submit Wasm code to the system
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| wasm_byte_code |
bytes |
|
WASMByteCode can be raw or gzip compressed |
| source |
string |
|
Source is a valid absolute HTTPS URI to the contract's source code, optional |
| builder |
string |
|
Builder is a valid docker image name with tag, optional |
| instantiate_permission |
AccessConfig |
|
InstantiatePermission access control to apply on contract creation, optional |
MsgUpdateAdmin
MsgUpdateAdmin sets a new admin for a smart contract
| Field |
Type |
Label |
Description |
| sender |
string |
|
Sender is the that actor that signed the messages |
| new_admin |
string |
|
NewAdmin address to be set |
| contract |
string |
|
Contract is the address of the smart contract |
Top
x/wasm/internal/types/proposal.proto
ClearAdminProposal
ClearAdminProposal gov proposal content type to clear the admin of a contract.
| Field |
Type |
Label |
Description |
| title |
string |
|
Title is a short summary |
| description |
string |
|
Description is a human readable text |
| contract |
string |
|
Contract is the address of the smart contract |
InstantiateContractProposal
InstantiateContractProposal gov proposal content type to instantiate a contract.
| Field |
Type |
Label |
Description |
| title |
string |
|
Title is a short summary |
| description |
string |
|
Description is a human readable text |
| run_as |
string |
|
RunAs is the address that is passed to the contract's environment as sender |
| admin |
string |
|
Admin is an optional address that can execute migrations |
| code_id |
uint64 |
|
CodeID is the reference to the stored WASM code |
| label |
string |
|
Label is optional metadata to be stored with a constract instance. |
| init_msg |
bytes |
|
InitMsg json encoded message to be passed to the contract on instantiation |
| init_funds |
cosmos.base.v1beta1.Coin |
repeated |
InitFunds coins that are transferred to the contract on instantiation |
MigrateContractProposal
MigrateContractProposal gov proposal content type to migrate a contract.
| Field |
Type |
Label |
Description |
| title |
string |
|
Title is a short summary |
| description |
string |
|
Description is a human readable text |
| run_as |
string |
|
RunAs is the address that is passed to the contract's environment as sender |
| contract |
string |
|
Contract is the address of the smart contract |
| code_id |
uint64 |
|
CodeID references the new WASM code |
| migrate_msg |
bytes |
|
MigrateMsg json encoded message to be passed to the contract on migration |
StoreCodeProposal
StoreCodeProposal gov proposal content type to submit WASM code to the system
| Field |
Type |
Label |
Description |
| title |
string |
|
Title is a short summary |
| description |
string |
|
Description is a human readable text |
| run_as |
string |
|
RunAs is the address that is passed to the contract's environment as sender |
| wasm_byte_code |
bytes |
|
WASMByteCode can be raw or gzip compressed |
| source |
string |
|
Source is a valid absolute HTTPS URI to the contract's source code, optional |
| builder |
string |
|
Builder is a valid docker image name with tag, optional |
| instantiate_permission |
AccessConfig |
|
InstantiatePermission to apply on contract creation, optional |
UpdateAdminProposal
UpdateAdminProposal gov proposal content type to set an admin for a contract.
| Field |
Type |
Label |
Description |
| title |
string |
|
Title is a short summary |
| description |
string |
|
Description is a human readable text |
| new_admin |
string |
|
NewAdmin address to be set |
| contract |
string |
|
Contract is the address of the smart contract |
Top
x/wasm/internal/types/query.proto
CodeInfoResponse
CodeInfoResponse contains code meta data from CodeInfo
ContractInfoWithAddress
ContractInfoWithAddress adds the address (key) to the ContractInfo representation
QueryAllContractStateRequest
QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method
QueryAllContractStateResponse
QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method
QueryCodeRequest
QueryCodeRequest is the request type for the Query/Code RPC method
| Field |
Type |
Label |
Description |
| code_id |
uint64 |
|
grpc-gateway_out does not support Go style CodID |
QueryCodeResponse
QueryCodeResponse is the response type for the Query/Code RPC method
QueryCodesRequest
QueryCodesRequest is the request type for the Query/Codes RPC method
QueryCodesResponse
QueryCodesResponse is the response type for the Query/Codes RPC method
QueryContractHistoryRequest
QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method
QueryContractHistoryResponse
QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method
QueryContractInfoRequest
QueryContractInfoRequest is the request type for the Query/ContractInfo RPC method
| Field |
Type |
Label |
Description |
| address |
string |
|
address is the address of the contract to query |
QueryContractInfoResponse
QueryContractInfoResponse is the response type for the Query/ContractInfo RPC method
| Field |
Type |
Label |
Description |
| address |
string |
|
address is the address of the contract |
| contract_info |
ContractInfo |
|
|
QueryContractsByCodeRequest
QueryContractsByCodeRequest is the request type for the Query/ContractsByCode RPC method
QueryContractsByCodeResponse
QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method
QueryRawContractStateRequest
QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method
| Field |
Type |
Label |
Description |
| address |
string |
|
address is the address of the contract |
| query_data |
bytes |
|
|
QueryRawContractStateResponse
QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method
| Field |
Type |
Label |
Description |
| data |
bytes |
|
Data contains the raw store data |
QuerySmartContractStateRequest
QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method
| Field |
Type |
Label |
Description |
| address |
string |
|
address is the address of the contract |
| query_data |
bytes |
|
QueryData contains the query data passed to the contract |
QuerySmartContractStateResponse
QuerySmartContractStateResponse is the response type for the Query/SmartContractState RPC method
| Field |
Type |
Label |
Description |
| data |
bytes |
|
Data contains the json data returned from the smart contract |
Query
Query provides defines the gRPC querier service
Top
x/wasm/internal/types/types.proto
AbsoluteTxPosition
AbsoluteTxPosition is a unique transaction position that allows for global ordering of transactions.
| Field |
Type |
Label |
Description |
| block_height |
uint64 |
|
BlockHeight is the block the contract was created at |
| tx_index |
uint64 |
|
TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed) |
AccessConfig
AccessConfig access control type.
AccessTypeParam
AccessTypeParam
CodeInfo
CodeInfo is data for the uploaded contract WASM code
| Field |
Type |
Label |
Description |
| code_hash |
bytes |
|
CodeHash is the unique CodeID |
| creator |
string |
|
Creator address who initially stored the code |
| source |
string |
|
Source is a valid absolute HTTPS URI to the contract's source code, optional |
| builder |
string |
|
Builder is a valid docker image name with tag, optional |
| instantiate_config |
AccessConfig |
|
InstantiateConfig access control to apply on contract creation, optional |
ContractCodeHistoryEntry
ContractCodeHistoryEntry metadata to a contract.
ContractInfo
ContractInfo stores a WASM contract instance
| Field |
Type |
Label |
Description |
| code_id |
uint64 |
|
CodeID is the reference to the stored Wasm code |
| creator |
string |
|
Creator address who initially instantiated the contract |
| admin |
string |
|
Admin is an optional address that can execute migrations |
| label |
string |
|
Label is optional metadata to be stored with a contract instance. |
| created |
AbsoluteTxPosition |
|
Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting |
Model
Model is a struct that holds a KV pair
| Field |
Type |
Label |
Description |
| key |
bytes |
|
hex-encode key to read it better (this is often ascii) |
| value |
bytes |
|
base64-encode raw value |
Params
Params defines the set of wasm parameters.
AccessType
AccessType permission types
| Name |
Number |
Description |
| ACCESS_TYPE_UNSPECIFIED |
0 |
AccessTypeUnspecified placeholder for empty value |
| ACCESS_TYPE_NOBODY |
1 |
AccessTypeNobody forbidden |
| ACCESS_TYPE_ONLY_ADDRESS |
2 |
AccessTypeOnlyAddress restricted to an address |
| ACCESS_TYPE_EVERYBODY |
3 |
AccessTypeEverybody unrestricted |
ContractCodeHistoryOperationType
ContractCodeHistoryOperationType actions that caused a code change
| Name |
Number |
Description |
| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED |
0 |
ContractCodeHistoryOperationTypeUnspecified placeholder for empty value |
| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT |
1 |
ContractCodeHistoryOperationTypeInit on chain contract instantiation |
| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE |
2 |
ContractCodeHistoryOperationTypeMigrate code migration |
| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS |
3 |
ContractCodeHistoryOperationTypeGenesis based on genesis data |
Scalar Value Types
| .proto Type |
Notes |
C++ |
Java |
Python |
Go |
C# |
PHP |
Ruby |
| double |
|
double |
double |
float |
float64 |
double |
float |
Float |
| float |
|
float |
float |
float |
float32 |
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. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
| int64 |
Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
| uint32 |
Uses variable-length encoding. |
uint32 |
int |
int/long |
uint32 |
uint |
integer |
Bignum or Fixnum (as required) |
| uint64 |
Uses variable-length encoding. |
uint64 |
long |
int/long |
uint64 |
ulong |
integer/string |
Bignum or Fixnum (as required) |
| sint32 |
Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
| sint64 |
Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
| fixed32 |
Always four bytes. More efficient than uint32 if values are often greater than 2^28. |
uint32 |
int |
int |
uint32 |
uint |
integer |
Bignum or Fixnum (as required) |
| fixed64 |
Always eight bytes. More efficient than uint64 if values are often greater than 2^56. |
uint64 |
long |
int/long |
uint64 |
ulong |
integer/string |
Bignum |
| sfixed32 |
Always four bytes. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
| sfixed64 |
Always eight bytes. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
| bool |
|
bool |
boolean |
boolean |
bool |
bool |
boolean |
TrueClass/FalseClass |
| string |
A string must always contain UTF-8 encoded or 7-bit ASCII text. |
string |
String |
str/unicode |
string |
string |
string |
String (UTF-8) |
| bytes |
May contain any arbitrary sequence of bytes. |
string |
ByteString |
str |
[]byte |
ByteString |
string |
String (ASCII-8BIT) |