fix: correct Associated Token Program ID for Solana payments#2
Merged
1bcMax merged 4 commits intoBlockRunAI:mainfrom Mar 13, 2026
Merged
Conversation
The ASSOCIATED_TOKEN_PROGRAM_ID constant was set to ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJe1bRS (not a real program), instead of the correct Solana mainnet program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL. This caused _get_ata() to derive incorrect destination ATAs for every Solana payment, resulting in the facilitator rejecting all payments with `invalid_exact_svm_payload_recipient_mismatch`.
Verifies ASSOCIATED_TOKEN_PROGRAM_ID matches the real Solana mainnet program, and that _get_ata() produces correct ATAs using a known on-chain address as a reference.
Solana v0 transactions require signatures over [0x80 + message_body], but the SDK was signing just [message_body]. This caused the facilitator to reject all payments with transaction_simulation_failed (SignatureFailure) because the signatures didn't match what the validator expected.
Ensures the user signature in Solana payment payloads is over 0x80 + message_body, not just message_body. Without the prefix, the facilitator's sigVerify simulation rejects the transaction.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs in
x402.pythat break all Solana payments:1. Wrong Associated Token Program ID (line 247)
Causes
_get_ata()to derive wrong destination ATAs. Facilitator rejects withinvalid_exact_svm_payload_recipient_mismatch.2. Missing v0 version prefix when signing (line 386)
Causes
SignatureFailureduring the facilitator'ssimulateTransaction(sigVerify: true).Tests
ASSOCIATED_TOKEN_PROGRAM_IDmatches Solana mainnet0x80 + message_bodyNote
Both bugs would be eliminated by using the official
x402Python SDK (pip install x402[svm]) instead of manually reimplementing the x402 client logic. The official SDK'sExactSvmSchemehandles ATA derivation, v0 signing, token program detection, and decimals correctly. See BlockRunAI/blockrun-agent-wallet#X for a tracking issue.Reproduction