ETH RPC Abstraction
Command Syntax
sekaid tx ethereum relay --from=<RELAYER> <HEX_ENCODED_TX> --keyring-backend=<KEYRING> --chain-id=<CHAIN_ID> --fees=<FEE>
Example
sekaid tx ethereum relay --from=genesis 0a2a307831323334353637383930616263646566313233343536373839306162636465663132333435363738122c30786162636465666162636465666162636465666162636465666162636465666162636465666162636465661a07313030303030302201312a0b32303030303030303030303201303ac703307866323432343332613030303030303030303030303030303030303030303030303132333435363738393061626364656631323334353637383930616263646566313233343536373830303030303030303030303030303030303030303030303061626364656661626364656661626364656661626364656661626364656661626364656661626364656630303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303634307830613237306132383061313432643739373833313332323933333232323433313733326336343332333832653533366233333232366533343437323236653333363436393333346533333765333336343665333336343665333436653333376533333765326133363261323136313633363336663735366537343264373336333662326634643733363735333635366536343132316230613132326436353733363832323333323133313332333332633331333433343232323665366636343232333431343131326333313161313030613039363336313732363436313634363436393133313034303131303030303661393230303030303040014a043078323652423078346233613765366635643663386233613766356334623361366437653866356334623361376635653464356136623363376436653866356234633361376536665a42307836623738393362346636643561376535633762336136643765386635633462336137663565346435613662336337643665386635623463336137653666356434 --keyring-backend=test --chain-id=testnet-1 --fees=100ukex
Output Example
{
"body": {
"messages": [
{
"@type": "/kira.evm.v1beta1.MsgRelay",
"relayer_address": "kira197g9k7x7f3n3l7n3lfdsfgdsgds3l7n3l7n3"
}
],
"memo": "",
"data": "0a2a307831323334353637383930616263646566313233343536373839306162636465663132333435363738122c30786162636465666162636465666162636465666162636465666162636465666162636465666162636465661a07313030303030302201312a0b32303030303030303030303201303ac703307866323432343332613030303030303030303030303030303030303030303030303132333435363738393061626364656631323334353637383930616263646566313233343536373830303030303030303030303030303030303030303030303061626364656661626364656661626364656661626364656661626364656661626364656661626364656630303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303634307830613237306132383061313432643739373833313332323933333232323433313733326336343332333832653533366233333232366533343437323236653333363436393333346533333765333336343665333336343665333436653333376533333765326133363261323136313633363336663735366537343264373336333662326634643733363735333635366536343132316230613132326436353733363832323333323133313332333332633331333433343232323665366636343232333431343131326333313161313030613039363336313732363436313634363436393133313034303131303030303661393230303030303040014a043078323652423078346233613765366635643663386233613766356334623361366437653866356334623361376635653464356136623363376436653866356234633361376536665a42307836623738393362346636643561376535633762336136643765386635633462336137663565346435613662336337643665386635623463336137653666356434"
},
"auth_info": {
"signer_infos": [
{
"public_key": {
"@type": "/cosmos.crypto.secp256k1.PubKey",
"key": "A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0"
},
"mode_info": {
"single": {
"mode": "SIGN_MODE_DIRECT"
}
},
"sequence": "123"
}
],
"fee": {
"amount": [
{
"denom": "ukex",
"amount": "200"
}
],
"gas_limit": "200000",
"payer": "",
"granter": ""
}
},
"signatures": [
"0xa6b7893b4f6d5a7e5c7b3a6d7e8f5c4b3a7f5e4d5a6b3c7d6e8f5b4c3a7e6f"
]
}
Explanation of Key Elements
How It Works
- Ethereum Transaction Wrapping:
- A raw Ethereum transaction is serialized and encoded into a protobuf-compatible format.
- The encoded Ethereum transaction becomes the
data
payload of a Cosmos transaction, enabling its execution on the KIRA blockchain.
- Hex-Encoded Protobuf Representation of Ethereum Transaction:
- The
data
field in the Cosmos transaction contains the serialized and hex-encoded Ethereum transaction. It includes:from
: Ethereum sender address.to
: Ethereum recipient address.value
: Amount transferred (in Wei).gas
andgasPrice
: Gas limit and price.nonce
: Transaction sequence number.data
: Additional transaction payload (e.g., contract call data).
- The
Example Ethereum transaction JSON before encoding:
{
"from": "0x1234567890abcdef1234567890abcdef12345678",
"to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
"value": "1000000",
"gas": "21000",
"gasPrice": "20000000000",
"nonce": "0",
"data": "0xf242432a0000000000000000000000001234567890abcdef1234567890abcdef12345678000000"
}
After protobuf serialization and hex encoding, it becomes:
0a2a307831323334353637383930616263646566313233343536373839306162636465663132333435363738122c30786162636465666162636465666162636465666162636465666162636465666162636465666162636465661a0731303030303030220131
- Cosmos Transaction Structure:
- Encapsulates the Ethereum transaction within a Cosmos-compatible message.
- The relayer (
-from
) submits this transaction to the Cosmos chain for execution.
- Signature and Relayer Information:
- The
auth_info
andsignatures
fields ensure the transaction's integrity and traceability to the relayer.
- The
Modules and Types
/kira.evm.v1beta1.MsgRelay
: Handles Ethereum transaction relaying on the Cosmos chain./cosmos.crypto.secp256k1.PubKey
: Public key format for signing transactions.SIGN_MODE_DIRECT
: Signature mode used for directly signed transactions.
Key Considerations
- Frontrunning Protection:
- Transactions must be relayed securely to avoid being intercepted.
- Nonce tracking ensures proper sequencing of multiple transactions.
- Relayer Incentives:
- Relayers are reimbursed in KEX for transaction fees and may earn additional incentives for their service.
Notes
- Ensure the relayer account (
-from
) has sufficient funds for fees. - Use the correct chain ID and keyring backend to avoid transaction errors.
- Hex-encoded transactions must be properly serialized and marshaled to avoid rejection.