Skip to content

Commit 8cd783c

Browse files
authored
clarify addresses (#2821)
1 parent d7a9887 commit 8cd783c

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

src/content/ccip/tutorials/svm/destination/build-messages.mdx

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ struct EVM2AnyMessage {
3232

3333
### receiver
3434

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.
3842

3943
<Aside title="Program ID Format">
4044
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
194198

195199
### tokenReceiver
196200

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.
198202

199203
<Tabs client:visible>
200204
<Fragment slot="tab.1">Transfer to Wallet</Fragment>
@@ -203,31 +207,31 @@ The Solana account that will initially receive tokens, represented as a 32-byte
203207
<Fragment slot="panel.1">
204208
For transfers to wallets or multi-sig wallets:
205209

206-
- Set to the user's wallet address
210+
- **Use**: The user's wallet address **converted to 32-byte hex format**.
207211
- **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.
208212

209213
</Fragment>
210214
<Fragment slot="panel.2">
211215
For transfers to programs:
212216

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**.
214218
- **Note**: If the receiver program does not have authority over the provided `tokenReceiver`, the tokens will be inaccessible.
215219

216220
</Fragment>
217221
<Fragment slot="panel.3">
218222
For data-only messaging (no tokens):
219223

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.
222226

223227
</Fragment>
224228
</Tabs>
225229

226230
<Aside title="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:
228232

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).
231235

232236
Below is a JavaScript example using the [bs58](https://www.npmjs.com/package/bs58) library:
233237

@@ -268,7 +272,7 @@ Use this configuration when sending only tokens from EVM to Solana:
268272
```
269273
{
270274
destinationChainSelector: SVM_CHAIN_SELECTOR,
271-
receiver: DEFAULT_PUBKEY,
275+
receiver: "0x0000000000000000000000000000000000000000000000000000000000000000",
272276
tokenAmounts: [{ token: tokenAddress, amount: tokenAmount }],
273277
feeToken: feeTokenAddress,
274278
data: "0x",
@@ -286,7 +290,7 @@ Use this configuration when sending only tokens from EVM to Solana:
286290
```javascript
287291
const message = {
288292
destinationChainSelector: 16423721717087811551, // Solana Devnet
289-
receiver: "11111111111111111111111111111111", // Default PubKey
293+
receiver: "0x0000000000000000000000000000000000000000000000000000000000000000",
290294
tokenAmounts: [{
291295
token: "0x779877A7B0D9E8603169DdbD7836e478b4624789", // LINK on Ethereum Sepolia
292296
amount: "1000000000000000000" // 1 LINK (18 decimals)
@@ -296,7 +300,7 @@ Use this configuration when sending only tokens from EVM to Solana:
296300
extraArgs: encodeExtraArgs({
297301
computeUnits: 0,
298302
allowOutOfOrderExecution: true,
299-
tokenReceiver: "EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB", // Recipient wallet
303+
tokenReceiver: "0xc6ea0f22160ac820ce7cd983587acd07557c7d9c79cc15dd818f50d2c554e848", // Recipient wallet EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB encoded in 32-byte hex format
300304
accountIsWritableBitmap: 0,
301305
accounts: []
302306
})
@@ -308,10 +312,10 @@ Use this configuration when sending only tokens from EVM to Solana:
308312
<Aside type="note" title="Key Requirements">
309313

310314
- `computeUnits` **MUST** be 0
311-
- `receiver` should be the default PublicKey
315+
- `receiver` should be `0x0000000000000000000000000000000000000000000000000000000000000000` for token-only transfers
312316
- `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
315319
- `allowOutOfOrderExecution` **MUST** be set to `true`
316320

317321
</Aside>
@@ -334,7 +338,7 @@ Use this configuration when sending only data messages to SVM:
334338
extraArgs: {
335339
computeUnits: determinedComputeUnits,
336340
allowOutOfOrderExecution: true,
337-
tokenReceiver: DEFAULT_PUBKEY,
341+
tokenReceiver: "0x0000000000000000000000000000000000000000000000000000000000000000",
338342
accountIsWritableBitmap: calculatedBitmap,
339343
accounts: [PDA, account, another program ID...]
340344
}
@@ -345,9 +349,9 @@ Use this configuration when sending only data messages to SVM:
345349
```javascript
346350
// Identify which accounts need to be writable
347351
const accounts = [
348-
"8xPzoFtAL8D2Vea9GZgkPkcLgEr9LEBYoJP2L6WNNjDM", // account1 (not writable)
349-
"HSQpP9L7wgJpNYdK2Vp8nTpvbULLqB8quiUXL7AGGS3y", // account2 (writable)
350-
"4wBqpRvipCi5k5zCZ4NFPiFPEM5gitBKRiSgZ8NZh3nk" // account3 (not writable)
352+
"0x7632c1560daece8311938a50279740e5a2307aeca65f17d251f96b57a1397d2c", // account1 (not writable) - 8xPzoFtAL8D2Vea9GZgkPkcLgEr9LEBYoJP2L6WNNjDM encoded in 32-byte hex format
353+
"0xf43d70e10f1177756dfb75ee3a887a2b7d788c6b5161bfba053798db9ef18518", // account2 (writable) - HSPQpP9L7wgJpNYdK2Vp8nTpvbULLqB8quiUXL7AGGS3y encoded in 32-byte hex format
354+
"0x3a74aee651d257c867d8c08013f228b099e023a978bf6b206b15c568212bb3c5" // account3 (not writable) - 4wBqpRvipCi5k5zCZ4NFPiFPEM5gitBKRiSgZ8NZh3nk encoded in 32-byte hex format
351355
];
352356

353357
// account 1 at index0 , not writable --> bit 0 = 0
@@ -360,7 +364,7 @@ Use this configuration when sending only data messages to SVM:
360364

361365
const message = {
362366
destinationChainSelector: 16423721717087811551, // Solana Devnet
363-
receiver: "GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH", // Program ID
367+
receiver: "0xe54c8b87d7468bcb060b16f10d7ed2d9fb7f3412df32278bae7fc1d8d7716a18", // Program ID - GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH encoded in 32-byte hex format
364368
tokenAmounts: [], // No tokens for data-only message
365369
feeToken: "0x779877A7B0D9E8603169DdbD7836e478b4624789", // LINK for fees
366370
data: "0x68656c6c6f", // "hello" in hex
@@ -415,13 +419,13 @@ Use this configuration when sending both tokens and data in a single message:
415419
```javascript
416420
// Identify all required accounts
417421
const accounts = [
418-
"8xPzoFtAL8D2Vea9GZgkPkcLgEr9LEBYoJP2L6WNNjDM", // account1 (not writable)
419-
"HSQpP9L7wgJpNYdK2Vp8nTpvbULLqB8quiUXL7AGGS3y", // account2 (writable)
420-
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // account3 (not writable)
421-
"57y3NXjkiAzP5Gw9WuUwzJMJbJQAHH6jUYBQfZdTE5zJ", // account4 (writable)
422-
"H4irvMb7oLqGRcaC2RDB7r1ynJsmHgbpQeJH8qZkDuiT", // account5 (not writable)
423-
"EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB", // account6 (writable)
424-
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" // account7 (not writable)
422+
"0x7632c1560daece8311938a50279740e5a2307aeca65f17d251f96b57a1397d2c", // account1 (not writable) - 8xPzoFtAL8D2Vea9GZgkPkcLgEr9LEBYoJP2L6WNNjDM encoded in 32-byte hex format
423+
"0xf43d70e10f1177756dfb75ee3a887a2b7d788c6b5161bfba053798db9ef18518", // account2 (writable) - HSPQpP9L7wgJpNYdK2Vp8nTpvbULLqB8quiUXL7AGGS3y encoded in 32-byte hex format
424+
"0xc6fa7af3bedbad3a3d65f36aabc97431b1bbe4c2d2f6e0e47ca60203452f5d61", // account3 (not writable) - EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v encoded in 32-byte hex format
425+
"0x3d379922db649fe03267da8d2fa5316d9c9e44ebe5ebb9650ba0fb7748a539b3", // account4 (writable) - 57y3NXjkiAzP5Gw9WuUwzJMJbJQAHH6jUYBQfZdTE5zJ encoded in 32-byte hex format
426+
"0xeeaf10b62e59f55bfe88c35074cd8ca9927d1bfb6489660859387f0eef4a6fc4", // account5 (not writable) - H4irvMb7oLqGRcaC2RDB7r1ynJsmHgbpQeJH8qZkDuiT encoded in 32-byte hex format
427+
"0xc6ea0f22160ac820ce7cd983587acd07557c7d9c79cc15dd818f50d2c554e848", // account6 (writable) - EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB encoded in 32-byte hex format
428+
"0x06ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a9" // account7 (not writable) - TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA encoded in 32-byte hex format
425429
];
426430

427431
// account 1 at index0 , not writable --> bit 0 = 0
@@ -439,7 +443,7 @@ Use this configuration when sending both tokens and data in a single message:
439443

440444
const message = {
441445
destinationChainSelector: 16423721717087811551, // Solana Devnet
442-
receiver: "GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH", // Program ID
446+
receiver: "0xe54c8b87d7468bcb060b16f10d7ed2d9fb7f3412df32278bae7fc1d8d7716a18", // Program ID - GS64TXeEb5qDnYK2TpcGZCXBcQpSdVMzJrB8nVTeHJKH encoded in 32-byte hex format
443447
tokenAmounts: [{
444448
token: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
445449
amount: "1000000000000000000" // 1 LINK (18 decimals)
@@ -449,7 +453,7 @@ Use this configuration when sending both tokens and data in a single message:
449453
extraArgs: encodeExtraArgs({
450454
computeUnits: 300000, // compute units required by the program for executing the ccip_receive instruction
451455
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
453457
accountIsWritableBitmap: 42, // Decimal representation of bitmap
454458
accounts: accounts
455459
})

0 commit comments

Comments
 (0)