Circle CCTP Message Transmitter v2 decoder
Decode Circle CCTP Message Transmitter v2 instructions, accounts and events in Rust with the carbon-circle-message-transmitter-v2-decoder crate.
On this page
carbon-circle-message-transmitter-v2-decoder decodes the instructions, accounts and events of the Circle CCTP Message Transmitter v2 program (CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC): 15 instructions, 3 account types, 11 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.
| Crate | carbon-circle-message-transmitter-v2-decoder 2.0.0 |
| Install | cargo add carbon-circle-message-transmitter-v2-decoder@2. |
| Program ID | CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC (carbon_) |
| Category | Bridges & messaging |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Event enum | instructions:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-circle-message-transmitter-v2-decoder/2.0.0 |
| Source | decoders/circle-message-transmitter-v2-decoder |
Other bridge and messaging decoders: Circle CCTP Token Messenger v2. To decode several in one pipeline, see bridge and messaging decoders.
The serde feature derives Serialize/Deserialize on every type, postgres adds tables and processors for Postgres, and graphql adds a schema for the GraphQL server.
Usage#
This program crawls recent Circle CCTP Message Transmitter v2 transactions from the public RPC and prints every decoded ReceiveMessage instruction. Add the dependencies:
cargo add carbon-core@2.0.0 carbon-circle-message-transmitter-v2-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/fulluse {
carbon_core::{
error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_circle_message_transmitter_v2_decoder::{
instructions::CircleMessageTransmitterV2Instruction, CircleMessageTransmitterV2Decoder,
PROGRAM_ID,
},
carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Fetches the program's recent transactions over JSON-RPC, newest first.
let datasource = RpcTransactionCrawler::new(
"https://api.mainnet-beta.solana.com".to_string(),
PROGRAM_ID,
ConnectionConfig::default(),
Filters::new(None, None, None),
None,
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.instruction(CircleMessageTransmitterV2Decoder, InstructionLogger)
.build()?
.run()
.await
}
struct InstructionLogger;
impl Processor<InstructionProcessorInputType<'_, CircleMessageTransmitterV2Instruction>> for InstructionLogger {
async fn process(
&mut self,
input: &InstructionProcessorInputType<'_, CircleMessageTransmitterV2Instruction>,
) -> CarbonResult<()> {
let signature = input.metadata.transaction_metadata.signature;
if let CircleMessageTransmitterV2Instruction::ReceiveMessage { data, accounts, .. } = input.decoded_instruction {
println!("receive_message {signature}: {data:?} payer={}", accounts.payer);
}
Ok(())
}
}RUST_LOG=info cargo runEach ReceiveMessage instruction prints one line with the transaction signature and the decoded ReceiveMessage data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See stream with RPC for the crawler options.
Events published with Anchor's emit_cpi! arrive as the CpiEvent instruction. Match them with CircleMessageTransmitterV2Instruction:: (import instructions::); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_.
Decode accounts#
The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with programSubscribe on the public WebSocket endpoint and prints every decoded MessageSent account as it changes. Add the datasource and the Solana RPC types it takes:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
carbon_core::{
account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_circle_message_transmitter_v2_decoder::{
accounts::CircleMessageTransmitterV2Account, CircleMessageTransmitterV2Decoder, PROGRAM_ID,
},
carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Streams every change to an account owned by the program (programSubscribe).
let config = RpcProgramAccountsConfig {
account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
..Default::default()
},
..Default::default()
};
let datasource = RpcProgramSubscribe::new(
"wss://api.mainnet-beta.solana.com".to_string(),
Filters::new(PROGRAM_ID, Some(config)),
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.account(CircleMessageTransmitterV2Decoder, AccountLogger)
.build()?
.run()
.await
}
struct AccountLogger;
impl Processor<AccountProcessorInputType<'_, CircleMessageTransmitterV2Account>> for AccountLogger {
async fn process(
&mut self,
input: &AccountProcessorInputType<'_, CircleMessageTransmitterV2Account>,
) -> CarbonResult<()> {
if let CircleMessageTransmitterV2Account::MessageSent(message_sent) = &input.decoded_account.data {
println!("message_sent {}: {message_sent:?}", input.metadata.pubkey);
}
Ok(())
}
}RUST_LOG=info cargo runEach update to a MessageSent account prints its address and decoded fields; the program runs until you stop it. Cargo resolves solana-client to 4.2.2, the exact version the datasource pins, so both use the same RpcProgramAccountsConfig type. To load every existing account once instead of streaming changes, see load account state.
Instructions#
Variants of CircleMessageTransmitterV2Instruction. Each is CircleMessageTransmitterV2Instruction::, where data and accounts are the types listed under the variant, exported from carbon_. Discriminators are the leading bytes of the instruction data, in hex.
How an instruction decodes. The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:
- The instruction's program ID is
CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).
Accounts. They are matched by position, in the order listed. An account marked optional is None only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for Some(PROGRAM_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.
AcceptOwnership#
Discriminator ac172b0deed55596 · data AcceptOwnership · accounts AcceptOwnershipInstructionAccounts.
| Field | Type |
|---|---|
params | AcceptOwnershipParams |
Required accounts: 4; extras go to remaining.
Fields of AcceptOwnershipInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | pending_ | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
DisableAttester#
Discriminator 3dab835fac0fe3e5 · data DisableAttester · accounts DisableAttesterInstructionAccounts.
| Field | Type |
|---|---|
params | DisableAttesterParams |
Required accounts: 6; extras go to remaining.
Fields of DisableAttesterInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | attester_ | Pubkey |
| 2 | message_ | Pubkey |
| 3 | system_ | Pubkey |
| 4 | event_ | Pubkey |
| 5 | program | Pubkey |
| 6… | remaining | Vec< |
EnableAttester#
Discriminator 020bc173059404c6 · data EnableAttester · accounts EnableAttesterInstructionAccounts.
| Field | Type |
|---|---|
params | EnableAttesterParams |
Required accounts: 6; extras go to remaining.
Fields of EnableAttesterInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | attester_ | Pubkey |
| 2 | message_ | Pubkey |
| 3 | system_ | Pubkey |
| 4 | event_ | Pubkey |
| 5 | program | Pubkey |
| 6… | remaining | Vec< |
Initialize#
Discriminator afaf6d1f0d989bed · data Initialize · accounts InitializeInstructionAccounts.
| Field | Type |
|---|---|
params | InitializeParams |
Required accounts: 8; extras go to remaining.
Fields of InitializeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | upgrade_ | Pubkey |
| 2 | message_ | Pubkey |
| 3 | message_ | Pubkey |
| 4 | message_ | Pubkey |
| 5 | system_ | Pubkey |
| 6 | event_ | Pubkey |
| 7 | program | Pubkey |
| 8… | remaining | Vec< |
IsNonceUsed#
Discriminator 90486b9423da1fbb · data IsNonceUsed · accounts IsNonceUsedInstructionAccounts.
No data fields.
Required accounts: 1; extras go to remaining.
Fields of IsNonceUsedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | used_nonce | Pubkey |
| 1… | remaining | Vec< |
Pause#
Discriminator d316ddfb4a79c12f · data Pause · accounts PauseInstructionAccounts.
| Field | Type |
|---|---|
params | PauseParams |
Required accounts: 4; extras go to remaining.
Fields of PauseInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | pauser | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
ReceiveMessage#
Discriminator 26907fe11fe1ee19 · data ReceiveMessage · accounts ReceiveMessageInstructionAccounts.
| Field | Type |
|---|---|
params | ReceiveMessageParams |
Required accounts: 9; extras go to remaining.
Fields of ReceiveMessageInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | caller | Pubkey |
| 2 | authority_ | Pubkey |
| 3 | message_ | Pubkey |
| 4 | used_nonce | Pubkey |
| 5 | receiver | Pubkey |
| 6 | system_ | Pubkey |
| 7 | event_ | Pubkey |
| 8 | program | Pubkey |
| 9… | remaining | Vec< |
ReclaimEventAccount#
Discriminator 5ec6b49f83ec0fae · data ReclaimEventAccount · accounts ReclaimEventAccountInstructionAccounts.
| Field | Type |
|---|---|
params | ReclaimEventAccountParams |
Required accounts: 3; extras go to remaining.
Fields of ReclaimEventAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payee | Pubkey |
| 1 | message_ | Pubkey |
| 2 | message_ | Pubkey |
| 3… | remaining | Vec< |
SendMessage#
Discriminator 392822b2bd0a411a · data SendMessage · accounts SendMessageInstructionAccounts.
| Field | Type |
|---|---|
params | SendMessageParams |
Required accounts: 6; extras go to remaining.
Fields of SendMessageInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | event_ | Pubkey |
| 1 | sender_ | Pubkey |
| 2 | message_ | Pubkey |
| 3 | message_ | Pubkey |
| 4 | sender_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
SetMaxMessageBodySize#
Discriminator a8b20875d9a7db1f · data SetMaxMessageBodySize · accounts SetMaxMessageBodySizeInstructionAccounts.
| Field | Type |
|---|---|
params | SetMaxMessageBodySizeParams |
Required accounts: 4; extras go to remaining.
Fields of SetMaxMessageBodySizeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
SetSignatureThreshold#
Discriminator a3139aa852d1d6db · data SetSignatureThreshold · accounts SetSignatureThresholdInstructionAccounts.
| Field | Type |
|---|---|
params | SetSignatureThresholdParams |
Required accounts: 4; extras go to remaining.
Fields of SetSignatureThresholdInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | attester_ | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
TransferOwnership#
Discriminator 41b1d749352d632f · data TransferOwnership · accounts TransferOwnershipInstructionAccounts.
| Field | Type |
|---|---|
params | TransferOwnershipParams |
Required accounts: 4; extras go to remaining.
Fields of TransferOwnershipInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
Unpause#
Discriminator a99004260a8dbcff · data Unpause · accounts UnpauseInstructionAccounts.
| Field | Type |
|---|---|
params | UnpauseParams |
Required accounts: 4; extras go to remaining.
Fields of UnpauseInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | pauser | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
UpdateAttesterManager#
Discriminator aff5b26855b34710 · data UpdateAttesterManager · accounts UpdateAttesterManagerInstructionAccounts.
| Field | Type |
|---|---|
params | UpdateAttesterManagerParams |
Required accounts: 4; extras go to remaining.
Fields of UpdateAttesterManagerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
UpdatePauser#
Discriminator 8cabd38439c910fe · data UpdatePauser · accounts UpdatePauserInstructionAccounts.
| Field | Type |
|---|---|
params | UpdatePauserParams |
Required accounts: 4; extras go to remaining.
Fields of UpdatePauserInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | message_ | Pubkey |
| 2 | event_ | Pubkey |
| 3 | program | Pubkey |
| 4… | remaining | Vec< |
CpiEvent#
Anchor self-CPI that carries one of the program's events. data is the CpiEvent enum.
Discriminator e445a52e51cb9a1d · data CpiEvent · accounts CpiEventInstructionAccounts.
Required accounts: 2; extras go to remaining.
Fields of CpiEventInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | program | Pubkey |
| 1 | event_ | Pubkey |
| 2… | remaining | Vec< |
Accounts#
Variants of CircleMessageTransmitterV2Account. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
MessageSent#
Discriminator 83648538a6e1973c · accounts::.
| Field | Type |
|---|---|
rent_payer | Pubkey |
created_at | i64 |
message | Vec<u8> |
MessageTransmitter#
Discriminator 4728b48e13cb23fc · accounts::.
| Field | Type |
|---|---|
owner | Pubkey |
pending_ | Pubkey |
attester_ | Pubkey |
pauser | Pubkey |
paused | bool |
local_ | u32 |
version | u32 |
signature_ | u32 |
enabled_ | Vec<Pubkey> |
max_ | u64 |
UsedNonce#
Discriminator d4de9dfc8247b3ee · accounts::.
| Field | Type |
|---|---|
is_used | bool |
Events#
Variants of instructions::, decoded from the CpiEvent instruction. Each wraps a struct from carbon_. The discriminator is the 8-byte event discriminator that follows the e445a52e51cb9a1d CPI-event tag.
AttesterDisabled#
Discriminator ba88ba0ee50279d3 · events::.
| Field | Type |
|---|---|
attester | Pubkey |
AttesterEnabled#
Discriminator 58390e8505db3ebe · events::.
| Field | Type |
|---|---|
attester | Pubkey |
AttesterManagerUpdated#
Discriminator 0561bf6c2cbd4558 · events::.
| Field | Type |
|---|---|
previous_ | Pubkey |
new_ | Pubkey |
MaxMessageBodySizeUpdated#
Discriminator 86ce976f890ba0e1 · events::.
| Field | Type |
|---|---|
new_ | u64 |
MessageReceived#
Discriminator e7442f4dadf19da6 · events::.
| Field | Type |
|---|---|
caller | Pubkey |
source_ | u32 |
nonce | [u8; 32] |
sender | Pubkey |
finality_ | u32 |
message_ | Vec<u8> |
OwnershipTransferStarted#
Discriminator b7fdeff68cb38569 · events::.
| Field | Type |
|---|---|
previous_ | Pubkey |
new_owner | Pubkey |
OwnershipTransferred#
Discriminator ac3dcdb7fa322662 · events::.
| Field | Type |
|---|---|
previous_ | Pubkey |
new_owner | Pubkey |
Pause#
Discriminator c2fbe8c4765f6fdb · events::.
No fields.
PauserChanged#
Discriminator 8e9d9e577f087737 · events::.
| Field | Type |
|---|---|
new_address | Pubkey |
SignatureThresholdUpdated#
Discriminator 9c6367c80f267abd · events::.
| Field | Type |
|---|---|
old_ | u32 |
new_ | u32 |
Unpause#
Discriminator f195685ac788db92 · events::.
No fields.
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
AcceptOwnershipParams#
Struct types::.
No fields.
AttesterDisabled#
Struct types::. Same fields as the AttesterDisabled event.
AttesterEnabled#
Struct types::. Same fields as the AttesterEnabled event.
AttesterManagerUpdated#
Struct types::. Same fields as the AttesterManagerUpdated event.
DisableAttesterParams#
Struct types::.
| Field | Type |
|---|---|
attester | Pubkey |
EnableAttesterParams#
Struct types::.
| Field | Type |
|---|---|
new_ | Pubkey |
InitializeParams#
Struct types::.
| Field | Type |
|---|---|
local_ | u32 |
attester | Pubkey |
max_ | u64 |
version | u32 |
MaxMessageBodySizeUpdated#
Struct types::. Same fields as the MaxMessageBodySizeUpdated event.
MessageReceived#
Struct types::. Same fields as the MessageReceived event.
OwnershipTransferred#
Struct types::. Same fields as the OwnershipTransferred event.
OwnershipTransferStarted#
Struct types::. Same fields as the OwnershipTransferStarted event.
Pause#
Struct types::. Same fields as the Pause event.
PauseParams#
Struct types::.
No fields.
PauserChanged#
Struct types::. Same fields as the PauserChanged event.
ReceiveMessageParams#
Struct types::.
| Field | Type |
|---|---|
message | Vec<u8> |
attestation | Vec<u8> |
ReclaimEventAccountParams#
Struct types::.
| Field | Type |
|---|---|
attestation | Vec<u8> |
destination_ | Vec<u8> |
SendMessageParams#
Struct types::.
| Field | Type |
|---|---|
destination_ | u32 |
recipient | Pubkey |
destination_ | Pubkey |
min_ | u32 |
message_ | Vec<u8> |
SetMaxMessageBodySizeParams#
Struct types::.
| Field | Type |
|---|---|
new_ | u64 |
SetSignatureThresholdParams#
Struct types::.
| Field | Type |
|---|---|
new_ | u32 |
SignatureThresholdUpdated#
Struct types::. Same fields as the SignatureThresholdUpdated event.
TransferOwnershipParams#
Struct types::.
| Field | Type |
|---|---|
new_owner | Pubkey |
Unpause#
Struct types::. Same fields as the Unpause event.
UnpauseParams#
Struct types::.
No fields.
UpdateAttesterManagerParams#
Struct types::.
| Field | Type |
|---|---|
new_ | Pubkey |
UpdatePauserParams#
Struct types::.
| Field | Type |
|---|---|
new_pauser | Pubkey |