Getting Started with nXCC
Welcome to nXCC! This guide will get you up and running with your first cross-chain worker in just a few steps.
Quick Start
Section titled “Quick Start”The fastest way to try nXCC is using our all-in-one local setup:
# Clone the repo and start everythinggit clone https://github.com/nxcc-bridge/nxcc.gitcd nxcc/node./run.shThat’s it! You now have a local nXCC node running at http://localhost:6922.
Your First Worker
Section titled “Your First Worker”Create a simple worker that runs in a secure environment:
# Install the CLInpm install -g @nxcc/cli
# Create a new project with proper structurenxcc init my-nxcc-appcd my-nxcc-appnpm installThe CLI creates a complete project structure. Let’s look at the generated worker:
// workers/my-worker.ts (generated by nxcc init)import { worker } from "@nxcc/sdk";
export default worker({ async launch(eventPayload, { userdata }) { console.log("Worker launched!", eventPayload, userdata); },
async fetch(request, { userdata }) { return { message: "Hello from nXCC! 🚀", path: new URL(request.url).pathname, }; },});Build and deploy it:
# Build the TypeScript workernpm run build
# Deploy to your local nodenxcc worker deploy workers/manifest.template.json --rpc-url http://localhost:6922Your worker is now running! The CLI automatically creates a launch event when deploying.
What Just Happened?
Section titled “What Just Happened?”- Secure Execution: Your JavaScript code runs inside a Trusted Execution Environment (TEE)
- No Infrastructure: No need to manage servers, containers, or VMs
- Cross-Chain Ready: Your worker can listen to events from 400+ blockchains
Next Steps
Section titled “Next Steps”Build an Event-Driven Worker
Section titled “Build an Event-Driven Worker”Create a worker that reacts to blockchain events:
# Install the CLI for advanced featuresnpm install -g @nxcc/cli
# Initialize a new project with TypeScriptnxcc init my-event-workercd my-event-worker && npm installEdit workers/my-worker.ts:
import { worker } from "@nxcc/sdk";
export default worker({ async fetch(event, { userdata }) { console.log("Received blockchain event:", event);
// Your cross-chain logic here // - Call APIs // - Send transactions to other chains // - Access secrets securely
return new Response("Event processed!"); },});Build and deploy:
npm run buildnxcc worker deploy workers/manifest.template.json --rpc-url http://localhost:6922Connect to Real Blockchains
Section titled “Connect to Real Blockchains”Workers are event-driven. Currently, the CLI automatically adds a launch event, but you can create work orders with blockchain event triggers. Note that events are specified in the work order, not the manifest itself.
For production blockchain integration, you would typically use the work order API to create workers that listen to specific on-chain events.
Use Docker for Production
Section titled “Use Docker for Production”For production deployments:
docker run -p 6922:6922 ghcr.io/nxcc-bridge/node:latestCore Concepts
Section titled “Core Concepts”Workers: JavaScript/TypeScript code that runs in secure environments and can:
- React to blockchain events across 400+ chains
- Handle HTTP requests
- Access secrets and make API calls
- Send transactions
Secure by Default: All code runs in Trusted Execution Environments (TEEs) with memory encryption and remote attestation.
Multi-Chain Native: Built-in support for Ethereum, Polygon, Arbitrum, and 400+ other EVM chains.
What’s Next?
Section titled “What’s Next?”Follow our progressive tutorial series:
-
Blockchain Events ← Start here next Build workers that react to on-chain events across multiple blockchains
-
Identities & Policies
Add secure credential management and access controls
Reference Docs
Section titled “Reference Docs”- Core Concepts - System architecture deep dive
- Worker Runtime - Complete JavaScript API reference
- CLI Reference - All CLI commands and options
Need Help?
Section titled “Need Help?”Ready to build the future of cross-chain applications? Let’s go! 🚀