You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/ccip/tutorials/svm/destination/build-messages.mdx
+35-31Lines changed: 35 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,9 +32,13 @@ struct EVM2AnyMessage {
32
32
33
33
### receiver
34
34
35
-
-**Definition**:This is the receiver program ID that will execute the CCIP message
36
-
-**For token-only transfers**: Should be set to the default value for the `Pubkey` type in Solana (`11111111111111111111111111111111`)
37
-
-**For arbitrary messaging** or **programmatic token transfers**: Must be the exact program ID of the SVM program that implements the `ccip_receive` instruction
35
+
-**Definition**: The receiver field specifies which program on the destination chain will process the incoming CCIP message.
36
+
-**Token-only transfers**:
37
+
-**Use**: `0x0000000000000000000000000000000000000000000000000000000000000000` (32-byte zero address)
38
+
-**Why**: No program execution needed for token-only transfers.
39
+
-**Arbitrary Messaging** or **Programmatic Token Transfers**:
40
+
-**Use**: The program ID of the SVM program that implements the `ccip_receive` instruction, converted to a 32-byte hex format.
41
+
-**Why**: The program will process the incoming CCIP message and execute the `ccip_receive` instruction.
38
42
39
43
<Asidetitle="Program ID Format">
40
44
When providing a SVM program ID as the receiver, it must be converted from [Solana's base58 format](https://solana.com/developers/guides/advanced/exchange#basic-verification) to a 32-byte hex format for CCIP messages.
@@ -194,7 +198,7 @@ A 64-bit bitmap indicating which accounts in the `accounts` array should be mark
194
198
195
199
### tokenReceiver
196
200
197
-
The Solana account that will initially receive tokens, represented as a 32-byte Solana public key.
201
+
The Solana account that will initially receive tokens, represented as a 32-byte hex-encoded Solana public key.
198
202
199
203
<Tabsclient:visible>
200
204
<Fragmentslot="tab.1">Transfer to Wallet</Fragment>
@@ -203,31 +207,31 @@ The Solana account that will initially receive tokens, represented as a 32-byte
203
207
<Fragmentslot="panel.1">
204
208
For transfers to wallets or multi-sig wallets:
205
209
206
-
- Set to the user's wallet address
210
+
- **Use**: The user's wallet address **converted to 32-byte hex format**.
207
211
- **Note**: Do not use an Associated Token Account (ATA) as the `tokenReceiver`. Instead, **use the user's wallet address directly**. The ATA will be automatically derived by the CCIP nodes.
208
212
209
213
</Fragment>
210
214
<Fragmentslot="panel.2">
211
215
For transfers to programs:
212
216
213
-
- Set to a Program Derived Address (PDA) that the program has authority over
217
+
- **Use**: A Program Derived Address (PDA) that the program has authority over, **converted to 32-byte hex format**.
214
218
- **Note**: If the receiver program does not have authority over the provided `tokenReceiver`, the tokens will be inaccessible.
215
219
216
220
</Fragment>
217
221
<Fragmentslot="panel.3">
218
222
For data-only messaging (no tokens):
219
223
220
-
- **MUST** set to the default Solana PublicKey (`11111111111111111111111111111111`)
221
-
- This is required even though no tokens are being transferred
224
+
- **Use**: `0x0000000000000000000000000000000000000000000000000000000000000000` (32-byte zero address).
225
+
- **Why**: This is required even though no tokens are being transferred.
222
226
223
227
</Fragment>
224
228
</Tabs>
225
229
226
230
<Asidetitle="Encoding tokenReceiver">
227
-
Similar to the receiver field, the tokenReceiver must be properly encoded as a 32-byte hex string:
231
+
Similar to the receiver field, the tokenReceiver must be properly encoded as a 32-byte hex format:
228
232
229
-
-**For token transfers and programmatic transfers**: Convert the Solana wallet address or PDA from [base58](https://solana.com/developers/guides/advanced/exchange#basic-verification) to a 32-byte hex string
230
-
-**For arbitrary messaging (data-only)**: Use the default Solana PublicKey (`11111111111111111111111111111111`) encoded as a 32-byte hex string
233
+
-**For token transfers and programmatic transfers**: Convert the Solana wallet address or PDA from [base58](https://solana.com/developers/guides/advanced/exchange#basic-verification) to a 32-byte hex string.
234
+
-**For arbitrary messaging (data-only)**: Use `0x0000000000000000000000000000000000000000000000000000000000000000` (32-byte zero address).
231
235
232
236
Below is a JavaScript example using the [bs58](https://www.npmjs.com/package/bs58) library:
233
237
@@ -268,7 +272,7 @@ Use this configuration when sending only tokens from EVM to Solana:
tokenReceiver:"0xc6ea0f22160ac820ce7cd983587acd07557c7d9c79cc15dd818f50d2c554e848", // Recipient wallet EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB encoded in 32-byte hex format
300
304
accountIsWritableBitmap:0,
301
305
accounts: []
302
306
})
@@ -308,10 +312,10 @@ Use this configuration when sending only tokens from EVM to Solana:
308
312
<Asidetype="note"title="Key Requirements">
309
313
310
314
-`computeUnits`**MUST** be 0
311
-
-`receiver` should be the default PublicKey
315
+
-`receiver` should be `0x0000000000000000000000000000000000000000000000000000000000000000` for token-only transfers
312
316
-`tokenReceiver`:
313
-
- For user transfers, `tokenReceiver` should be the user's wallet address
314
-
- For transfers to programs, `tokenReceiver` must be a PDA that the program has authority over
317
+
- For user transfers, `tokenReceiver` should be the user's wallet address, converted to 32-byte hex format
318
+
- For transfers to programs, `tokenReceiver` must be a PDA that the program has authority over, converted to 32-byte hex format
315
319
-`allowOutOfOrderExecution`**MUST** be set to `true`
316
320
317
321
</Aside>
@@ -334,7 +338,7 @@ Use this configuration when sending only data messages to SVM:
receiver:"GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH", // Program ID
367
+
receiver:"0xe54c8b87d7468bcb060b16f10d7ed2d9fb7f3412df32278bae7fc1d8d7716a18", // Program ID - GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH encoded in 32-byte hex format
364
368
tokenAmounts: [], // No tokens for data-only message
365
369
feeToken:"0x779877A7B0D9E8603169DdbD7836e478b4624789", // LINK for fees
366
370
data:"0x68656c6c6f", // "hello" in hex
@@ -415,13 +419,13 @@ Use this configuration when sending both tokens and data in a single message:
receiver:"GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH", // Program ID
446
+
receiver:"0xe54c8b87d7468bcb060b16f10d7ed2d9fb7f3412df32278bae7fc1d8d7716a18", // Program ID - GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH encoded in 32-byte hex format
amount:"1000000000000000000"// 1 LINK (18 decimals)
@@ -449,7 +453,7 @@ Use this configuration when sending both tokens and data in a single message:
449
453
extraArgs:encodeExtraArgs({
450
454
computeUnits:300000, // compute units required by the program for executing the ccip_receive instruction
451
455
allowOutOfOrderExecution:true,
452
-
tokenReceiver:"57y3NXjkiAzP5Gw9WuUwzJMJbJQAHH6jUYBQfZdTE5zJ", // a PDA that the program has authority over
456
+
tokenReceiver:"0x3d379922db649fe03267da8d2fa5316d9c9e44ebe5ebb9650ba0fb7748a539b3", // a PDA that the program has authority over - 57y3NXjkiAzP5Gw9WuUwzJMJbJQAHH6jUYBQfZdTE5zJ encoded in 32-byte hex format
453
457
accountIsWritableBitmap:42, // Decimal representation of bitmap
0 commit comments