Transaction Environment Identifier #413
Replies: 2 comments 4 replies
-
|
The first (DevEx) section isn't super convincing to me. The recent blockhash is already a protection against your transaction being accidentally submitted to the wrong network. If the blockhash does not exist, the transaction is dropped (expired). Therefore, you could fix the stated DevEx issue ("Transaction Expired") simply at the wallet/RPC level, say by requiring the cluster as input then querying to confirm the blockhash exists on the provided network. The malicious security section is more compelling. In most UI settings, a glowing blue label that says "Mainnet Blockhash" in the transaction details is probably enough for most users. However, the ability to inspect the transaction bytes directly and verify the proper byte for the intended cluster is set at the proper offset is very useful - for example in airgapped environments or for CLI-based workflows. I think the change is straightforward enough for the marginal benefit to be worth it. I suggest exploring more specifics of the validator side:
It's also important to consider any ramifications on asynchronous execution or concurrent leaders. I don't see any reason to treat "invalid environment" transactions any differently than "invalid signature" or "expired" transactions, therefore I don't see how they would interfere with such roadmaps. Nonetheless it would be good for devs working on these transaction workflows - like @2501babe - to weigh in. |
Beta Was this translation helpful? Give feedback.
-
|
i dont really understand the security argument. if a malicious dapp can create a mainnet transaction with a mainnet blockhash, why cant it also set the mainnet environment? if wallets already dont adequetely signal when you are connected to mainnet, why would they warn youre signing a transaction with a mainnet environment when connected to mainnet? this seems like yet another situation where better wallet security flows are the only thing that can realistically protect the user, and wallets have historically not been great on doing this
yea this isnt an issue since it can be checked statically from the transaction bytes. hell you could filter them on ingress |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This idea proposes the introduction of a new, mandatory
Environmentfield within the transaction message header. This change necessitates a newVersionedTransactionformat. TheEnvironmentfield will contain au8identifier that explicitly and unambiguously tags the transaction's intended destination cluster, limited toMainnetBeta,Testnet, orDevnet.The primary goals of this idea are twofold:
This SIMD specifies changes to the transaction message format, validator processing logic, wallet signing procedures, and RPC API responses to create an end-to-end, protocol-enforced mechanism for environment verification.
Motivation
The current Solana transaction format relies only on a
recentBlockhashfor transaction validity and liveness. This design, while simple, creates an implicit and brittle link to a specific cluster. A blockhash is merely a 32-byte value; it contains no intrinsic information about its cluster of origin. This ambiguity is the root cause of significant, persistent issues in user experience, developer experience, and network security.Addressing a Pervasive and Misleading User Experience Failure
The most frequent and frustrating error encountered by testers during interaction with in-development dApp is "Transaction Expired". It is most commonly results from a simple network mismatch between the dApp and the user's wallet.
This failure scenario is predictable and common:
Devnet. They instruct users to try it.MainnetBetaby default, connects to the dApp.DevnetRPC, fetches a recentDevnetblockhash and uses it to construct the transaction.MainnetBetaRPC, receives this transaction. It attempts to find theDevnetblockhash in itsMainnetBetaBlockhashQueue.The tester is confused and blames the dApp or the wallet. The developer is forced to add "Please make sure your wallet is set to Devnet" to their UI, a non-standard, high-friction workaround.
Mitigating a Latent Cross-Environment Security Vulnerability
The ambiguity of the recentBlockhash is not just a user experience inconvenience; it is a security vulnerability. As noted in, Solana transactions do not include an environment or network identifier in the message that gets signed. A user's signature only proves they approve of the transaction's instructions relative to a given blockhash.
This opens a phishing attack vector:
Devnetapplication for testing or receiving a "test" airdrop.MainnetBetaaction (e.g., "transfer 100 SOL" or "set token account authority" ).MainnetBetablockhash.Mainnetinstructions +Mainnetblockhash) to the user's wallet for signing.MainnetBeta, the blockhash will be found, the transaction will simulate, and it will be presented to the user.Devnetapplication, signs the transaction, resulting in the loss of real assets.This attack vector is particularly insidious. Phishing sites have been observed to present users with a "simulated failure message" and still prompt for approval. Because the user believes they are on a risk-free Devnet, they are more likely to approve the transaction without concern, even with the error, resulting in the loss of their assets.
The only defense against this today is a non-standard, client-side heuristic. Some wallets may check the blockhash they receive against their connected RPC , but this is not a protocol-level guarantee and could be bypassed by a sophisticated attack.
The Solana ecosystem already struggles with phishing attacks that exploit user ambiguity, such as token authority transfers and social account thefts. Leaving this protocol-level ambiguity unaddressed constitutes a latent, high-severity security risk. This proposal aims to eliminate this attack class entirely by making environment verification a non-bypassable part of the protocol.
Improving Developer Experience and Ecosystem Tooling
The entire burden of network synchronization is placed on the user. They must manually open their wallet, navigate to settings, and change the network to match the dApp's environment. This is a multi-click, high-friction process that breaks the flow of the application and leads to high rates of user drop-off.
By embedding the Environment in the transaction itself, we provide a clear, unambiguous, protocol-level signal. Ecosystem tools can finally build the solutions developers have been asking for. A wallet, upon receiving a transaction with a mismatched identifier, can prompt the user: "This dApp wants to sign a Devnet transaction. Would you like to switch your wallet to Devnet?"
Proposed Solution: The
EnvironmentFieldThis proposal introduces an
Environmentfield into the transaction message, to be enforced via a newVersionedTransactionformat.A New Transaction Version
This change adds a new field to the signed transaction message, which is a consensus-breaking change. It must therefore be introduced in a new transaction version. The
VersionedTransactionframework is designed precisely for this, allowing new formats to co-exist withlegacyandv0transactions.The community is already actively developing and discussing SIMD-0385. This new V1 format already modifies the transaction header to move compute budget and priority fee parameters into it. Instead of proposing a separate V2 transaction, which would force the entire ecosystem (validators, RPCs, wallets, SDKs) to undergo another major migration, it is strongly recommended that this Environment field be added to the specification of V1 transaction.
Specification
A new
enumwill be defined to represent the public Solana clusters. The namingMainnetBetais chosen to align with existing ecosystem terminology.The new
MessageV1Header(as proposed in SIMD-0385) will be modified to include this field. This proposal builds upon the concept of aMessagestruct and theV1format.Handling Local Test Environments
Developers heavily rely on solana-test-validator for local development. To ensure a seamless developer experience, the following behavior is proposed:
Rationale and Ecosystem-Wide Implications
This change requires coordinated updates across the four main components of the Solana ecosystem: RPC nodes, SDKs, Wallets, and Validators.
RPC Node Modifications
Requirement: RPC nodes must be aware of the environment they are serving and provide it to clients.
API Change: The
getLatestBlockhashRPC method (and the deprecatedgetRecentBlockhash) response must be updated to include the cluster's environment.{ "jsonrpc": "2.0", "result": { "context": { "slot": 2792 }, "value": { "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", "lastValidBlockHeight": 3090, "environment": 0 } }, "id": 1 }dApp and SDK Modifications
Requirement: Client-side SDKs, such as @solana/web3.js , must be updated to support the new transaction format and RPC response.
Logic: When constructing a
TransactionMessage, the SDK logic will be:getLatestBlockhash.blockhashand the newenvironmentfield from the response.MessageV1struct (recent_blockhashandheader.environment).This ensures the transaction is always tagged for the environment from which it sourced its blockhash.
Wallet and Signing Logic
Requirement: This is the most critical enforcement point for user safety and experience. Wallets must be upgraded to parse the new transaction version.
Proposed Signing Flow: When a dApp sends a
V1transaction to a wallet for signing :MessageV1Headerand read theenvironmentfield.environmentfield against the wallet's currently selected network.Devnet, but your wallet is set toMainnetBeta."[Switch Network]and[Cancel].This flow directly fixes the dApp-wallet communication gap by transforming a hard error into a guided UX flow.
Validator Enforcement
Requirement: Validators must enforce the
Environmentat the protocol level. This is the final, non-bypassable line of defense against the security vector.Logic:
Environment(e.g.,MainnetBetavalidators will be configured with 0).V1transaction, part of its initial validation (before simulation and parallel processing) will be to check:tx.message.header.environment == self.environment.Impact: This makes the phishing attack impossible. Even if a user is tricked into signing a
Devnettransaction (environment: 2) that contains a validMainnetBetablockhash, theMainnetBetavalidators (self.environment: 0) will see the mismatch and reject the transaction. The transaction will never be processed or included in a block. This provides a robust, protocol-level security guarantee that does not rely on wallet-side heuristics.Beta Was this translation helpful? Give feedback.
All reactions