Skip to content

feat(go): add EVM facilitator signer helper#1884

Open
GrapeInTheTree wants to merge 2 commits intox402-foundation:mainfrom
GrapeInTheTree:feat/go-facilitator-signer-helper
Open

feat(go): add EVM facilitator signer helper#1884
GrapeInTheTree wants to merge 2 commits intox402-foundation:mainfrom
GrapeInTheTree:feat/go-facilitator-signer-helper

Conversation

@GrapeInTheTree
Copy link
Copy Markdown

Description

Add NewFacilitatorSignerFromPrivateKey helper to go/signers/evm, implementing the FacilitatorEvmSigner interface.

The Go SDK currently provides a client signer helper (NewClientSignerFromPrivateKey) but no facilitator equivalent — the signers README lists it as "planned". This PR delivers that missing helper.

What it provides:

  • NewFacilitatorSignerFromPrivateKey(privateKeyHex, rpcURL) — one-line facilitator signer creation
  • All 9 methods of FacilitatorEvmSigner: GetAddresses, ReadContract, VerifyTypedData, WriteContract, SendTransaction, WaitForTransactionReceipt, GetBalance, GetChainID, GetCode
  • EIP-1559 dynamic fee transactions with gas estimation + 300k fallback
  • EIP-712 signature verification via ecrecover
  • Private key stored as fixed-size [32]byte, zeroed on Close()

Background:
Built while developing a self-hosted x402 facilitator on Base Sepolia with real USDC transfers (EIP-3009 and Permit2). Without this helper, every Go facilitator requires ~300 lines of RPC boilerplate.

Tests

cd go && go test ./signers/evm/ -v -count=1

8 new tests added, all 12 tests pass (4 existing client + 8 new facilitator):

  • Invalid key handling (empty, not hex, too short)
  • Address derivation with known Hardhat test key
  • 0x prefix handling
  • GetAddresses returns correct address
  • Close() zeroes private key bytes
  • VerifyTypedData with valid EIP-712 signature
  • VerifyTypedData rejects wrong address
  • Compile-time interface implementation check

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge)
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

Note: Happy to add a changelog fragment and README updates if reviewers want them in this PR.

@cb-heimdall
Copy link
Copy Markdown

cb-heimdall commented Mar 31, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

@GrapeInTheTree is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added go sdk Changes to core v2 packages labels Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go sdk Changes to core v2 packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants