Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(solana): deploy agents with transaction v1 when the wallet supports it and verify the landed version

nirholas1d345f2a4345
diff --git a/api/_lib/solana/transaction-v1.js b/api/_lib/solana/transaction-v1.js
index 8079f9476..ba4708b58 100644
--- a/api/_lib/solana/transaction-v1.js
+++ b/api/_lib/solana/transaction-v1.js
@@ -82,6 +82,8 @@ export function toKitInstruction(instruction) {
* @param {string} input.feePayer Owner wallet; deliberately not server-signed.
* @param {{blockhash: string, lastValidBlockHeight: number|bigint}} input.lifetime
* @param {object} [input.config]
+ * @param {string[]} [input.clientSigners] Signer addresses whose keys live in the
+ * browser (e.g. a vanity asset keypair). Their slots stay empty for the client.
*/
export async function buildPartiallySignedV1Transaction({
instructions,
@@ -89,6 +91,7 @@ export async function buildPartiallySignedV1Transaction({
feePayer,
lifetime,
config = AGENT_DEPLOY_V1_CONFIG,
+ clientSigners = [],
}) {
const message = pipe(
createTransactionMessage({ version: SOLANA_TRANSACTION_V1 }),
@@ -107,12 +110,18 @@ export async function buildPartiallySignedV1Transaction({
const transaction = compileTransaction(message);
const signatures = { ...transaction.signatures };
+ const leaveEmpty = new Set([String(feePayer), ...clientSigners.map(String)]);
for (const signer of signers) {
const signerAddress = String(signer.publicKey);
- // The wallet fee payer is represented by Umi's noop signer. Keep its
- // signature null so the browser wallet can fill it.
- if (signerAddress === feePayer || signatures[signerAddress] === undefined) continue;
- signatures[signerAddress] = await signer.signMessage(transaction.messageBytes);
+ // The wallet fee payer and any browser-held key are represented by Umi
+ // noop signers, whose signMessage echoes the message back. Keep those
+ // slots null so the client fills them with real signatures.
+ if (leaveEmpty.has(signerAddress) || signatures[signerAddress] === undefined) continue;
+ const signature = await signer.signMessage(transaction.messageBytes);
+ if (!(signature instanceof Uint8Array) || signature.length !== 64) {
+ throw new Error(`signer ${signerAddress} did not return a 64-byte ed25519 signature`);
+ }
+ signatures[signerAddress] = signature;
}
const partiallySigned = Object.freeze({
diff --git a/api/agents/solana/_handlers.js b/api/agents/solana/_handlers.js
index 6b95ded07..23f7b0889 100644
--- a/api/agents/solana/_handlers.js
+++ b/api/agents/solana/_handlers.js
@@ -508,6 +508,7 @@ import { generateSigner, publicKey as umiPublicKey, signerIdentity, createNoopSi
import bs58 from 'bs58';
import { limits as _limits } from '../../_lib/rate-limit.js';
import { mplAgentIdentity, getAgentIdentityV2AccountDataSerializer, findAgentIdentityV1Pda } from '@metaplex-foundation/mpl-agent-registry';
+import { buildPartiallySignedV1Transaction, SOLANA_TRANSACTION_V1 } from '../../_lib/solana/transaction-v1.js';
const BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]+$/;
const VANITY_FREE_THRESHOLD = 5;
@@ -521,6 +522,9 @@ const registerPrepSchema = z.object({
network: z.enum(['mainnet', 'devnet']).default('mainnet'),
asset_pubkey: z.string().min(32).max(44).optional(),
vanity_prefix: z.string().min(1).max(6).optional(),
+ // 1 only when the signing wallet advertises Wallet Standard v1 support;
+ // every other wallet keeps the v0 envelope.
+ transaction_version: z.union([z.literal(0), z.literal(1)]).default(0),
});
export const handleRegisterPrep = wrap(async (req, res) => {
@@ -534,7 +538,7 @@ export const handleRegisterPrep = wrap(async (req, res) => {
if (!rl.success) return rateLimited(res, rl);
const body = parse(registerPrepSchema, await readJson(req));
- const { name, description, avatar_id, wallet_address, network, asset_pubkey, vanity_prefix } = body;
+ const { name, description, avatar_id, wallet_address, network, asset_pubkey, vanity_prefix, transaction_version } = body;
const [walletRow] = await sql`select id from user_wallets where user_id = ${user.id} and address = ${wallet_address} and chain_type = 'solana' limit 1`;
if (!walletRow) return error(res, 403, 'forbidden', 'wallet not linked to your account');
@@ -640,6 +644,15 @@ export const handleRegisterPrep = wrap(async (req, res) => {
createArgs.authority = collectionAuthoritySigner(umi);
}
const builder = create(umi, createArgs);
+ if (transaction_version === SOLANA_TRANSACTION_V1) {
+ return buildPartiallySignedV1Transaction({
+ instructions: builder.getInstructions(),
+ signers: builder.getSigners(umi),
+ feePayer: wallet_address,
+ lifetime: await umi.rpc.getLatestBlockhash({ commitment: 'confirmed' }),
+ clientSigners: asset_pubkey ? [asset_pubkey] : [],
+ });
+ }
const tx = await builder.buildAndSign(umi);
return umi.transactions.serialize(tx);
};
@@ -657,12 +670,13 @@ export const handleRegisterPrep = wrap(async (req, res) => {
const prepId = await randomToken(24);
const expiresAt = new Date(Date.now() + 30 * 60 * 1000);
- await sql`insert into agent_registrations_pending (user_id, cid, metadata_uri, payload, expires_at) values (${user.id}, ${assetSigner.publicKey}, ${metadataUri}, ${JSON.stringify({ name, description, avatar_id, wallet_address, asset_pubkey: assetSigner.publicKey, network, prep_id: prepId, vanity_prefix: vanity_prefix || null, collection: collectionAddr || null })}::jsonb, ${expiresAt})`;
+ await sql`insert into agent_registrations_pending (user_id, cid, metadata_uri, payload, expires_at) values (${user.id}, ${assetSigner.publicKey}, ${metadataUri}, ${JSON.stringify({ name, description, avatar_id, wallet_address, asset_pubkey: assetSigner.publicKey, network, prep_id: prepId, vanity_prefix: vanity_prefix || null, collection: collectionAddr || null, transaction_version })}::jsonb, ${expiresAt})`;
return json(res, 201, {
prep_id: prepId,
asset_pubkey: assetSigner.publicKey,
tx_base64: txBase64,
+ transaction_version,
network,
metadata_uri: metadataUri,
expires_at: expiresAt.toISOString(),
@@ -747,6 +761,11 @@ export const handleRegisterConfirm = wrap(async (req, res) => {
const [pending] = await sql`select payload from agent_registrations_pending where user_id=${user.id} and payload->>'asset_pubkey'=${asset_pubkey} and expires_at > now() order by created_at desc limit 1`;
const payload = pending?.payload || {};
+ // A live prep pins the envelope the server built. A different version on
+ // chain means the wallet re-encoded or replaced the prepared transaction.
+ if (pending && tx.version !== (payload.transaction_version ?? 0)) {
+ return error(res, 422, 'tx_wrong_version', `transaction version ${String(tx.version)} does not match the prepared v${payload.transaction_version ?? 0}`);
+ }
const name = body.name || payload.name || `Agent ${asset_pubkey.slice(0, 6)}`;
const description = body.description || payload.description || '';
const avatar_id = body.avatar_id || payload.avatar_id || null;
@@ -763,6 +782,7 @@ export const handleRegisterConfirm = wrap(async (req, res) => {
wallet: wallet_address,
metadata_uri: payload.metadata_uri || null,
confirmed_at: new Date().toISOString(),
+ transaction_version: tx.version,
};
const [agent] = await sql`insert into agent_identities (user_id, name, description, avatar_id, wallet_address, meta) values (${user.id}, ${name}, ${description}, ${avatar_id}, ${wallet_address}, ${JSON.stringify({ chain_type: 'solana', network, sol_mint_address: asset_pubkey, tx_signature, onchain: onchainBlock, ...(payload.vanity_prefix ? { vanity_prefix: payload.vanity_prefix } : {}), ...(payload.collection ? { collection: payload.collection, update_authority: 'threews' } : {}) })}::jsonb) returning id, name, description, wallet_address, meta, created_at`;
diff --git a/data/changelog.json b/data/changelog.json
index 0b6d90302..804859b23 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-09-16",
+ "title": "Deploy your agent on-chain with Solana's new transaction v1",
+ "summary": "Minting an agent to Solana now uses the new transaction v1 format whenever your wallet supports it, from both the agent deploy button and the registration wizard, including agents with a custom vanity address. Each deploy spells out its compute, account data, and priority fee limits instead of relying on defaults, and three.ws checks that the transaction that landed on-chain is the exact version it prepared before recording your agent. Wallets that have not added v1 yet keep working exactly as before, and a deployed agent now shows which transaction format it used.",
+ "tags": [
+ "feature",
+ "security"
+ ],
+ "link": "/deploy-onchain"
+ },
{
"date": "2026-09-16",
"title": "$THREE pages now show the real buyback ledger instead of a burn estimate",
diff --git a/docs/solana.md b/docs/solana.md
index 3bbd54546..4d0a5dc4e 100644
--- a/docs/solana.md
+++ b/docs/solana.md
@@ -146,10 +146,11 @@ const prep = await fetch('/api/agents/solana-register-prep', {
metadata_uri: 'https://...', // optional — else server synthesizes one
asset_pubkey: vanityPubkey, // optional: client-supplied asset keypair pubkey
vanity_prefix: '3ws', // optional: asserts asset_pubkey starts with it
+ transaction_version: 1, // optional: 1 for a v1-capable wallet, default 0
}),
}).then(r => r.json());
-// → { prep_id, asset_pubkey, tx_base64, network, metadata_uri, expires_at }
+// → { prep_id, asset_pubkey, tx_base64, transaction_version, network, metadata_uri, expires_at }
```
The server:
@@ -159,7 +160,42 @@ The server:
- Writes an on-chain Attributes plugin (the three.ws brand block) and an enforced Royalties plugin into the asset, and mints into the three.ws Agents collection when one is configured for the network.
- Stores a 30-minute pending record so step 4 can resolve `name` / `description` / `avatar_id` from the prep payload.
-The returned `tx_base64` is a fully built transaction missing only the user's signature.
+The returned `tx_base64` is a fully built transaction missing only the user's signature (and the asset signature, when the client supplied its own `asset_pubkey`).
+
+#### Transaction v1
+
+Solana transaction v1 raises the wire limit from 1,232 to 4,096 bytes and moves execution limits out of ComputeBudget instructions into the message itself. Send `transaction_version: 1` only when the signing wallet advertises it: the Wallet Standard `solana:signTransaction` feature lists `1` in `supportedTransactionVersions`. The three.ws deploy flows ([src/erc8004/solana-deploy.js](../src/erc8004/solana-deploy.js) and [src/onchain/adapters/solana.js](../src/onchain/adapters/solana.js)) negotiate this automatically and fall back to v0 for every other wallet.
+
+A v1 prep is compiled with `@solana/kit` ([api/_lib/solana/transaction-v1.js](../api/_lib/solana/transaction-v1.js)) and carries explicit caps, because v1 compute and loaded-account-data limits resolve to zero when omitted: 500,000 compute units, 8 MiB of loaded account data, and a 5,000-lamport priority fee. The collection authority co-signs on the server. A client-supplied vanity asset key is never signed on the server; its slot is left empty for the browser.
+
+`@solana/web3.js` can read v1 but cannot build or sign it, so sign the raw bytes instead of a `VersionedTransaction`:
+
+```js
+import { getWallets } from '@wallet-standard/app';
+import { createKeyPairFromBytes, getTransactionDecoder, getTransactionEncoder, partiallySignTransaction } from '@solana/kit';
+
+let bytes = Uint8Array.from(atob(prep.tx_base64), c => c.charCodeAt(0));
+
+// Only when you supplied asset_pubkey: fill the asset signature first.
+if (vanitySecretKey) {
+ const keyPair = await createKeyPairFromBytes(vanitySecretKey);
+ const signedByAsset = await partiallySignTransaction([keyPair], getTransactionDecoder().decode(bytes));
+ bytes = new Uint8Array(getTransactionEncoder().encode(signedByAsset));
+}
+
+const wallet = getWallets().get().find(w =>
+ w.features['solana:signTransaction']?.supportedTransactionVersions?.includes(1)
+ && w.accounts.some(a => a.address === walletPubkey));
+const account = wallet.accounts.find(a => a.address === walletPubkey);
+const [{ signedTransaction }] = await wallet.features['solana:signTransaction'].signTransaction({
+ account,
+ transaction: bytes,
+});
+
+const sig = await conn.sendRawTransaction(signedTransaction);
+```
+
+The confirm step rejects a transaction whose on-chain version differs from the prepared one (`422 tx_wrong_version`) and records the version as `meta.onchain.transaction_version`.
### 3. Sign and submit with the wallet
@@ -210,7 +246,9 @@ const result = await fetch('/api/agents/solana-register-confirm', {
The server re-fetches the parsed transaction from the cluster, asserts:
- the tx exists and did not error,
-- `asset_pubkey` appears in the transaction's account keys,
+- `asset_pubkey` appears in the transaction's account keys and the linked wallet signed it,
+- the asset exists on-chain as a Metaplex Core asset owned by that wallet,
+- the transaction version matches the prep (while the prep is still live),
- no agent has already been registered for this mint,
then inserts the `agent_identities` row and clears the pending record. If the agent has an avatar GLB, the server also records a best-effort on-chain glTF/schema validation attestation (`threews.validation.v1`, signed by the platform validator; see [api/_lib/solana-validation-attest.js](../api/_lib/solana-validation-attest.js)); a failure there never fails the registration.
@@ -231,6 +269,9 @@ Returned as `{ error, error_description }` from the prep / confirm endpoints.
| 422 | `tx_not_found` | RPC has not seen the signature yet — retry after a few seconds |
| 422 | `tx_failed` | Transaction landed on-chain but reverted |
| 422 | `asset_not_in_tx` | `asset_pubkey` is not among the transaction's account keys |
+| 422 | `not_signer` | The linked wallet did not sign the transaction |
+| 422 | `asset_not_found` / `not_core_asset` / `not_asset_owner` | The asset account is missing, is not a Metaplex Core asset, or is owned by another wallet |
+| 422 | `tx_wrong_version` | The landed transaction's version differs from the prepared `transaction_version` |
| 409 | `conflict` | An agent is already registered for this mint |
| 429 | `rate_limited` | Per-IP auth limiter tripped |
| 503 | `rpc_unavailable` | Every RPC endpoint in the failover chain failed while building the tx |
diff --git a/public/changelog-recent.json b/public/changelog-recent.json
index c9f6f74fb..475eab6e7 100644
--- a/public/changelog-recent.json
+++ b/public/changelog-recent.json
@@ -1,11 +1,11 @@
{
- "generated_at": "2026-09-16T16:58:37.768Z",
+ "generated_at": "2026-09-16T19:36:18.607Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
"url": "https://three.ws"
},
- "total": 3685,
+ "total": 3686,
"complete": false,
"full_feed": "/changelog.json",
"entries": [
@@ -41,6 +41,17 @@
"fix"
]
},
+ {
+ "date": "2026-09-16",
+ "type": "update",
+ "title": "GitHub fee claims now say what they actually prove",
+ "summary": "A GitHub fee claim on pump.fun proves that a GitHub account collected creator fees routed to it. It does not prove that person built the coin, owns the linked repository, or backs the project. Claim cards on /pumpfun used to read as a developer endorsing a coin even when the account was a lookalike name, the coin had no GitHub link at all, or one fee account was shared by several coins and the card simply picked the biggest one. Every claim now carries one of five labels: verified repository, verified creator wallet, identity mismatch, unverified, or unresolved pooled withdrawal. Only the two verified labels get trade buttons or count toward a coin's reputation score, mismatches are flagged in red, and the Telegram claims channel follows the same rules.",
+ "link": "/pumpfun",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-09-15",
"type": "launch",
@@ -1606,17 +1617,6 @@
"tags": [
"launch"
]
- },
- {
- "date": "2026-09-07",
- "type": "update",
- "title": "3D generation and the whole site keep working when our asset storage does not",
- "summary": "Early on 2026-09-07 our object storage stopped accepting the platform's credential, and because every generation parks its reference image there, 3D generation stopped on the website and in ChatGPT at the same time, agent registration could not store its manifest, and images loaded through our CDN stopped resolving. Three things changed so that a storage fault is never again a blank page. Avatars, thumbnails and models now fall back to the bucket's public domain automatically, so the site keeps rendering. When generation genuinely cannot run you get a plain message saying storage is recovering and to try again shortly, instead of a raw error from the storage vendor. And our own health checks now watch the storage credential directly and treat a silent forge as an outage rather than a quiet hour, so we hear about this class of failure before you do.",
- "link": null,
- "tags": [
- "fix",
- "infra"
- ]
}
]
}
diff --git a/public/features.json b/public/features.json
index 62698847b..93305cc53 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-09-16T16:41:04.170Z",
+ "generated_at": "2026-09-16T19:36:18.426Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/erc8004/register-ui.js b/src/erc8004/register-ui.js
index adc89da0b..5d9f82e75 100644
--- a/src/erc8004/register-ui.js
+++ b/src/erc8004/register-ui.js
@@ -2426,7 +2426,7 @@ export class RegisterUI {
if (grindRow) grindRow.hidden = true;
setPhase('confirm');
say(`Minted asset ${result.assetPubkey}`);
- say(`Tx ${result.txSignature}`);
+ say(`Tx ${result.txSignature} (Solana transaction v${result.transactionVersion})`);
setPhase('done');
this._vanityPrefix = '';
this._preGroundSecretKey = null;
diff --git a/src/erc8004/solana-deploy.js b/src/erc8004/solana-deploy.js
index ace2e4e54..d2c27a4ce 100644
--- a/src/erc8004/solana-deploy.js
+++ b/src/erc8004/solana-deploy.js
@@ -4,6 +4,8 @@
* Mirrors the EVM register flow in deploy-button.js but for Solana:
* 1. POST /api/agents/solana-register-prep — server builds an unsigned
* Metaplex Core createV1 transaction (base64) for `wallet_address`.
+ * The tx is Solana transaction v1 when the connected wallet advertises v1
+ * through Wallet Standard, otherwise v0.
* 2. Phantom (or any compatible Solana wallet) signs and submits the tx.
* 3. POST /api/agents/solana-register-confirm — server verifies the tx and
* upserts the agent_identity row with chain_type='solana'.
@@ -13,7 +15,9 @@
*/
import { Connection, Keypair, Transaction, VersionedTransaction } from '@solana/web3.js';
+import { getWallets } from '@wallet-standard/app';
import { grindVanity } from '../solana/vanity/grinder.js';
+import { findV1WalletStandardSigner } from '../onchain/adapters/solana.js';
/** Detect an injected Solana wallet (Phantom / Backpack / Solflare / Seeker). */
export function detectSolanaWallet() {
@@ -50,10 +54,16 @@ export function solanaTxExplorerUrl(network, sig) {
}
/** @param {string} b64 */
-function decodeBase64Tx(b64) {
+function base64ToBytes(b64) {
const bin = atob(b64);
const bytes = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
+ return bytes;
+}
+
+/** @param {string} b64 */
+function decodeBase64Tx(b64) {
+ const bytes = base64ToBytes(b64);
// Server uses Umi's buildAndSign which produces a versioned tx.
try {
return VersionedTransaction.deserialize(bytes);
@@ -86,6 +96,22 @@ async function waitForSolanaConfirmation(conn, signature, timeoutMs) {
throw new Error('Timed out waiting for Solana transaction confirmation.');
}
+/**
+ * Fill a browser-held signer's slot (the vanity asset key) in a v1 wire
+ * transaction. @solana/web3.js cannot parse v1, so this uses @solana/kit, loaded
+ * only on this path. Kit refuses a key that is not a required signer.
+ * @param {Uint8Array} wireBytes
+ * @param {Uint8Array} secretKey 64-byte ed25519 secret key
+ * @returns {Promise<Uint8Array>}
+ */
+export async function cosignV1Transaction(wireBytes, secretKey) {
+ const { createKeyPairFromBytes, getTransactionDecoder, getTransactionEncoder, partiallySignTransaction } =
+ await import('@solana/kit');
+ const keyPair = await createKeyPairFromBytes(secretKey);
+ const signed = await partiallySignTransaction([keyPair], getTransactionDecoder().decode(wireBytes));
+ return new Uint8Array(getTransactionEncoder().encode(signed));
+}
+
/**
* Wallet extensions (Phantom and Phantom-compatible injectors) throw
* `{ code: -32603, message: 'An internal error has occurred' }` when their
@@ -132,6 +158,50 @@ export function tagStep(e, step) {
return err;
}
+/** Sign a v0/legacy prep with the injected provider. */
+async function signV0({ prep, wallet, vanityKeypair }) {
+ const tx = decodeBase64Tx(prep.tx_base64);
+ // If we used a vanity keypair, the server built the tx with a noop signer
+ // for the asset slot, so fill it in before the wallet signs.
+ // VersionedTransaction.sign() only modifies signatures whose pubkey matches
+ // a provided signer, so the wallet sig slot is preserved as zero for Phantom.
+ if (vanityKeypair && tx instanceof VersionedTransaction) {
+ tx.sign([vanityKeypair]);
+ } else if (vanityKeypair && tx instanceof Transaction) {
+ tx.partialSign(vanityKeypair);
+ }
+ const signed = await withWalletRetry('sign', () => wallet.signTransaction(tx));
+ return signed.serialize();
+}
+
+/** Sign a v1 prep: vanity co-signature first, then the wallet over raw bytes. */
+async function signV1({ prep, v1Signer, vanityKeypair }) {
+ if (!v1Signer) {
+ const err = new Error('This wallet does not advertise Solana transaction v1 signing.');
+ err.code = 'TX_VERSION_UNSUPPORTED';
+ throw tagStep(err, 'sign');
+ }
+ let bytes = base64ToBytes(prep.tx_base64);
+ if (vanityKeypair) {
+ try {
+ bytes = await cosignV1Transaction(bytes, vanityKeypair.secretKey);
+ } catch (e) {
+ throw tagStep(e, 'sign');
+ }
+ }
+ const [result] = await withWalletRetry('sign', () =>
+ v1Signer.feature.signTransaction({
+ account: v1Signer.account,
+ transaction: bytes,
+ options: { preflightCommitment: 'confirmed' },
+ }),
+ );
+ if (!result?.signedTransaction) {
+ throw tagStep(new Error('Wallet returned no signed v1 transaction.'), 'sign');
+ }
+ return result.signedTransaction;
+}
+
/**
* Run the Solana deploy flow end-to-end.
*
@@ -146,7 +216,7 @@ export function tagStep(e, step) {
* (e.g. nirholas/solana-wallet-toolkit). When present, the in-browser grinder
* is skipped and this keypair is used directly. The caller is responsible for
* verifying the public key matches `vanity.prefix`.
- * @returns {Promise<{ assetPubkey: string, txSignature: string, network: string, agent: object, vanityPrefix?: string }>}
+ * @returns {Promise<{ assetPubkey: string, txSignature: string, network: string, agent: object, transactionVersion: 0|1, vanityPrefix?: string }>}
*/
export async function runSolanaDeploy({ agent, network, vanity }) {
const wallet = detectSolanaWallet();
@@ -159,6 +229,7 @@ export async function runSolanaDeploy({ agent, network, vanity }) {
const conn = await withWalletRetry('connect', () => wallet.connect());
const walletAddress = (conn?.publicKey || wallet.publicKey)?.toString();
if (!walletAddress) throw new Error('Could not read Solana wallet address.');
+ const v1Signer = findV1WalletStandardSigner(getWallets().get(), walletAddress);
// Optional: grind a vanity asset keypair before asking the server to build the tx.
// Or accept a pre-ground keypair from a CLI grinder (faster for prefixes >=5 chars).
@@ -187,6 +258,7 @@ export async function runSolanaDeploy({ agent, network, vanity }) {
avatar_id: agent.avatarId || agent.avatar_id,
wallet_address: walletAddress,
network,
+ transaction_version: v1Signer ? 1 : 0,
...(vanityKeypair ? {
asset_pubkey: vanityKeypair.publicKey.toBase58(),
vanity_prefix: vanity.prefix,
@@ -203,25 +275,15 @@ export async function runSolanaDeploy({ agent, network, vanity }) {
throw err;
}
const prep = await prepResp.json();
- const tx = decodeBase64Tx(prep.tx_base64);
-
- // If we used a vanity keypair, the server built the tx with a noop signer
- // for the asset slot — we must fill it in here before the wallet signs.
- // VersionedTransaction.sign() only modifies signatures whose pubkey matches
- // a provided signer, so the wallet sig slot is preserved as zero for Phantom.
- if (vanityKeypair && tx instanceof VersionedTransaction) {
- tx.sign([vanityKeypair]);
- } else if (vanityKeypair && tx instanceof Transaction) {
- tx.partialSign(vanityKeypair);
- }
// Always sign locally and submit via our Helius-backed proxy. Wallet
// `signAndSendTransaction` routes through the wallet's own RPC, which
// returns 403 "Access forbidden" intermittently on mainnet.
const endpoint = RPC[network] || RPC.mainnet;
- const signed = await withWalletRetry('sign', () => wallet.signTransaction(tx));
+ const raw = prep.transaction_version === 1
+ ? await signV1({ prep, v1Signer, vanityKeypair })
+ : await signV0({ prep, wallet, vanityKeypair });
const conn2 = new Connection(endpoint, 'confirmed');
- const raw = signed.serialize();
let signature;
try {
signature = await conn2.sendRawTransaction(raw, {
@@ -267,6 +329,7 @@ export async function runSolanaDeploy({ agent, network, vanity }) {
txSignature: signature,
network,
agent: confirmed.agent,
+ transactionVersion: prep.transaction_version === 1 ? 1 : 0,
...(vanity?.prefix ? { vanityPrefix: vanity.prefix } : {}),
};
}
diff --git a/tests/transaction-v1.test.js b/tests/transaction-v1.test.js
index 8b1c75e0f..2555f6092 100644
--- a/tests/transaction-v1.test.js
+++ b/tests/transaction-v1.test.js
@@ -9,6 +9,8 @@ import {
decodeFeatureActivationSlot,
inspectWireTransaction,
} from '../api/_lib/solana/transaction-v1.js';
+import { cosignV1Transaction } from '../src/erc8004/solana-deploy.js';
+import { getTransactionDecoder } from '@solana/kit';
function signedLegacyTransfer() {
const payer = Keypair.generate();
@@ -25,6 +27,32 @@ function signedLegacyTransfer() {
return tx.serialize().toString('base64');
}
+function createAccountInput(owner, asset) {
+ const instruction = SystemProgram.createAccount({
+ fromPubkey: owner.publicKey,
+ newAccountPubkey: asset.publicKey,
+ lamports: 1,
+ space: 0,
+ programId: SystemProgram.programId,
+ });
+ return {
+ feePayer: owner.publicKey.toBase58(),
+ lifetime: {
+ blockhash: Keypair.generate().publicKey.toBase58(),
+ lastValidBlockHeight: 123n,
+ },
+ instructions: [{
+ programId: instruction.programId.toBase58(),
+ keys: instruction.keys.map((key) => ({
+ pubkey: key.pubkey.toBase58(),
+ isSigner: key.isSigner,
+ isWritable: key.isWritable,
+ })),
+ data: instruction.data,
+ }],
+ };
+}
+
describe('Solana transaction V1 inspector', () => {
it('reports exact wire metrics for a signed legacy transaction', () => {
const wire = signedLegacyTransfer();
@@ -88,6 +116,36 @@ describe('Solana transaction V1 inspector', () => {
expect(inspected.sponsor).toMatchObject({ verdict: 'caps-explicit', safeToCosign: true });
});
+ it('leaves a browser-held vanity key slot empty, then the client co-signs it', async () => {
+ const owner = Keypair.generate();
+ const vanity = Keypair.generate();
+ const input = createAccountInput(owner, vanity);
+ const echoSigner = {
+ publicKey: vanity.publicKey.toBase58(),
+ signMessage: async (message) => message,
+ };
+
+ await expect(buildPartiallySignedV1Transaction({ ...input, signers: [echoSigner] }))
+ .rejects.toThrow(/64-byte ed25519 signature/);
+
+ const wire = await buildPartiallySignedV1Transaction({
+ ...input,
+ signers: [echoSigner],
+ clientSigners: [vanity.publicKey.toBase58()],
+ });
+ const vanityAddress = vanity.publicKey.toBase58();
+ expect(getTransactionDecoder().decode(wire).signatures[vanityAddress]).toBeNull();
+
+ const cosigned = await cosignV1Transaction(wire, vanity.secretKey);
+ expect(cosigned[0]).toBe(0x81);
+ const decoded = getTransactionDecoder().decode(cosigned);
+ const signature = decoded.signatures[vanityAddress];
+ expect(nacl.sign.detached.verify(decoded.messageBytes, signature, vanity.publicKey.toBytes())).toBe(true);
+ expect(decoded.signatures[owner.publicKey.toBase58()]).toBeNull();
+
+ await expect(cosignV1Transaction(wire, Keypair.generate().secretKey)).rejects.toThrow();
+ });
+
it('rejects malformed wire input without contacting an RPC', () => {
expect(() => inspectWireTransaction('not base64!')).toThrow(/base64-encoded/);
expect(() => inspectWireTransaction(Buffer.from('not a transaction').toString('base64'))).toThrow(/valid signed/);