NodeMasterX is a Serverless Web3 Gateway built by Neural Inverse that provides developers instant access to blockchain networks (Polygon, Bitcoin) through a standard JSON-RPC 2.0 API. It serves as a drop-in replacement for Alchemy, Infura, or QuickNode.
Philosophy: No UI. No Lock-in. Better B2D (Business-to-Developer).
┌──────────────────────────────────────────────────────────────────────────────┐
│ CLIENT (Developer App) │
└─────────────────────────────────┬────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────────────────┐
│ AWS API Gateway (HTTP API) │
│ https://nodemasterx.com │
└────┬──────────┬──────────┬──────────┬──────────┬──────────┬─────────────────┘
│ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Status │ │ OAuth │ │ RPC │ │ V2 RPC │ │Interface│ │ Billing │
│Endpoint │ │Callback │ │Endpoint │ │ Handler │ │ APIs │ │ APIs │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │ │ │
└──────────┴──────────┴────┬─────┴──────────┴──────────┘
│
┌───────────┴───────────┐
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ Shared │ │ External │
│ Modules │ │ Services │
│ │ │ │
│ • Validator │ │ • GitHub API │
│ • Billing │ │ • AWS Blockchain │
│ Service │ │ • Azure OpenAI │
│ │ │ • Stripe │
└──────┬───────┘ └──────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ DynamoDB │
│ • nodemasterx-users │
│ • nodemasterx-token-cache │
│ • nodemasterx-interface-profiles │
└──────────────────────────────────────────┘
| Path | Purpose |
|---|---|
lambdas/ |
All Lambda function source code |
lambdas/v2/ |
V2 Intelligence Layer functions |
lambdas/cron/ |
Scheduled jobs (billing) |
infrastructure/ |
AWS SAM/CloudFormation templates |
scripts/ |
Build, package, and deploy scripts |
local-dev/ |
Local testing harness and mocks |
docs/ |
Documentation (AWS permissions, deployment guides) |
- Route:
GET / - Purpose: Public health check and service info
- Auth: None required
- Response: Product info, supported networks, getting started guide
- Route:
GET /callback - Purpose: Handle GitHub OAuth flow, register new users
- Flow: GitHub OAuth code → Exchange for access token → Create user record in DynamoDB
- Type: Shared middleware (imported by other functions)
- Purpose: Validate GitHub Personal Access Tokens (PAT)
- Key Functions:
validateToken(token, requestId)- Main validation entry pointgetCachedToken(tokenHash)- DynamoDB cache lookupstoreCachedToken()- Cache new tokensextendTokenTTL()- Sliding window cache extension
- Security Features:
- SHA-256 token hashing (never stores raw tokens)
- Sliding window cache: 15min initial → extends up to 1hr on activity
- Force revalidation after 5 hours of inactivity
- User must exist in
nodemasterx-userstable (OAuth registration required)
- Route:
POST /v1/{network} - Purpose: Forward JSON-RPC requests to blockchain
- Networks:
polygon-mainnet,bitcoin-mainnet,bitcoin-testnet - Key Functions:
handler()- Main Lambda handlerforwardToBlockchain()- AWS SigV4 signed requests to AMBvalidateJsonRpcRequest()- JSON-RPC 2.0 validationdispatchUsageEvent()- Send usage to SQS for billing
- Route:
POST /v1/batch/{network} - Purpose: Handle batched JSON-RPC requests (array of requests)
The V2 API adds Programmable AI Middleware that allows developers to inject "intelligence" into the RPC stream.
- Interface Manifest - A JSON schema defining AI behavior, stored in
nodemasterx-interface-profiles - Dynamic Compiler - Builds AI system prompts at runtime from the Manifest
- Execution Gate - Enforces
block,flag, orshadow_modestrategies based on AI analysis
- Route:
POST /v2/interface/create - Purpose: Register a new Interface Manifest
- Billing: Deducts
$0.10creation fee from prepaid balance - Manifest Schema:
{
"interface_metadata": { "version": "...", "tier": "...", "label": "..." },
"intelligence_config": { "model": "...", "logic_mode": "..." },
"active_constraints": {
"heuristic_rules": ["..."],
"thresholds": {},
"fail_strategy": "block|flag|shadow_mode"
}
}- Route:
GET /v2/interface/list - Purpose: View user's registered interfaces
- Route:
POST /v2/interface/delete - Purpose: Soft-delete an interface (stops recurring billing)
- Security: IDOR check ensures user owns the interface
- Type: Internal module (not exposed as endpoint)
- Purpose: Core AI evaluation logic
- Key Functions:
evaluateTransaction(rpcRequest, interfaceId, context)- Main evaluationbuildDynamicPrompt(rpcRequest, profile, enrichment)- Compile AI promptexecuteDecisionGate(inferenceResult, constraints)- Enforce block/flag/shadowcallAzureOpenAI()- Azure OpenAI API integration
- Route:
POST /v2/{network}with headerX-NMX-Interface-ID - Purpose: Execute transactions through the Intelligence Layer
- Flow:
- Validate token
- Parse JSON-RPC request
- Call
evaluateTransaction()from interface-engine - If allowed, forward to blockchain
- If blocked, return custom error
| Item | Cost |
|---|---|
| Interface Creation | $0.10 (one-time) |
| Interface Monthly Storage | $0.50/month (~$0.0166/day) |
| RPC Requests | Token-based (via AI model execution) |
| Initial Free Credits | Provided on signup |
- Type: Shared module
- Purpose: Core billing logic and Stripe integration
- Key Functions:
createOrGetCustomer()- Stripe customer managementcreatePortalSession()- Generate Stripe billing portal URLdeductPrepaidBalance()- Synchronous credit deductioncheckPrepaidBalance()- Check if user has creditscalculateChargeThreshold()- Determine next auto-charge amountattemptCharge()- Charge Stripe payment methodshouldThrottle()- Determine if user should be rate-limited
- Route:
GET /v1/account/billing - Purpose: User billing dashboard endpoint
- Response: Account status, usage stats, prepaid balance, portal link
- Trigger: SQS (Usage Queue)
- Purpose: Async processing of usage events
- Flow:
- Receive usage event from SQS
- Calculate cost
- Deduct from prepaid credits OR increment unpaid balance
- Auto-charge when threshold reached
- Throttle user if charge fails
- Trigger: EventBridge (Daily schedule)
- Purpose: Deduct recurring storage fees for active interfaces
- Flow:
- Scan all active interfaces
- Aggregate by user
- Deduct daily rate from prepaid balance
- Mark insufficient funds (TODO: freeze interface logic)
- Primary Key:
github_user_id(Number) - GSI:
StripeCustomerIdIndexonstripe_customer_id - Contains: User profile, OAuth data, billing state, usage counters
- Primary Key:
token_hash(String, SHA-256) - TTL:
expires_at(automatic cleanup) - Contains: Cached token validation, user snapshot, timestamps
- Primary Key:
interface_id(String, UUID) - Contains: Interface manifest, owner, status, timestamps
| Script | Purpose |
|---|---|
package-all.sh |
Unified packager for all V1+V2 Lambdas → dist/ |
package-lambdas.sh |
Legacy V1 packager |
package-v2-lambdas.sh |
V2-only packager → dist-v2/ |
validate-packages.sh |
Validate zip contents and structure |
deploy-to-aws.sh |
Deploy to dev/staging/prod |
quick-deploy.sh |
Fast re-deploy of code only |
Defines all resources:
- 3 DynamoDB Tables (Users, Token Cache, Interface Profiles)
- 10+ Lambda Functions
- 1 SQS Queue (Usage processing)
- 1 HTTP API (API Gateway)
- IAM Policies (DynamoDB, SQS, Managed Blockchain)
Alternative CloudFormation template with similar resources.
cp .env.example .env
npm install| Variable | Purpose |
|---|---|
MOCK_GITHUB_API |
Set to true to mock GitHub OAuth (default) |
LOCAL_DEV_MODE |
Enable local DynamoDB |
GITHUB_CLIENT_ID/SECRET |
For real OAuth testing |
npm run test:status # Status endpoint
npm run test:auth # OAuth callback
npm run test:validator # Token validator
npm run test:rpc # RPC endpoint
npm run test:batch # Batch endpoint
npm run test:all # All tests
npm run dev # Watch mode| Service | Purpose | Required Credentials |
|---|---|---|
| GitHub API | OAuth authentication, PAT validation | GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET |
| AWS Managed Blockchain | Polygon/Bitcoin RPC access | AWS credentials with managedblockchain:InvokeRpcCall |
| Azure OpenAI | V2 Intelligence Layer inference | AZURE_OPENAI_KEY, AZURE_OPENAI_ENDPOINT |
| Stripe | Payment processing, billing portal | STRIPE_SECRET_KEY |
| AWS DynamoDB | Data persistence | Standard AWS credentials |
| AWS SQS | Async usage event processing | Standard AWS credentials |
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | / |
No | Service status |
| GET | /callback |
No | OAuth callback |
| POST | /v1/{network} |
Yes | JSON-RPC request |
| GET | /v1/account/billing |
Yes | Billing dashboard |
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /v2/interface/create |
Yes | Create interface |
| GET | /v2/interface/list |
Yes | List interfaces |
| POST | /v2/interface/delete |
Yes | Delete interface |
| POST | /v2/{network} |
Yes | AI-gated RPC |
-
v2.1.0-alpha (Current)
- V2 Intelligence Layer with Azure OpenAI
- Prepaid credit billing system
- Interface creation/deletion with billing
-
Future (v2.2.0)
- WebSocket support
- Additional networks (Ethereum, Solana)
- Usage analytics dashboard
-
Future (v3.0.0)
- GraphQL API
- SDK libraries (JS, Python, Go)
- Enterprise features
Built with ❤️ by Neural Inverse
No UI. No Lock-in. Better B2D.