API Reference

Comprehensive documentation for NovaLayer's APIs and SDKs. Integrate seamlessly with your applications.

Core RPC API

Interact directly with NovaLayer nodes for blockchain data and transaction submission.

Endpoints & Methods

  • POST
    /rpc

    Standard JSON-RPC endpoint for L2s

  • GET
    /status

    Get network status and health

Example Usage

curl -X POST -H "Content-Type: application/json" \
     -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
     https://rpc.testnet.novalayer.dev

NovaLayer SDK (TypeScript)

A comprehensive TypeScript SDK for building dApps and interacting with NovaLayer programmatically.

Endpoints & Methods

  • SDK
    nova.createL2()

    Deploy a new modular L2

  • SDK
    nova.chain.getTransactions()

    Retrieve transactions for a chain

  • SDK
    nova.validator.stake()

    Stake $NOVA tokens as a validator

Example Usage

import { NovaLayer } from '@novalayer/sdk';

const nova = new NovaLayer({
  network: 'mainnet',
  apiKey: 'nv_YOUR_API_KEY'
});

async function getLatestBlock() {
  const blockNumber = await nova.chain.getBlockNumber('my-chain-id');
  console.log('Latest block:', blockNumber);
}

GraphQL API

Query complex blockchain data efficiently using GraphQL.

Endpoints & Methods

  • POST
    /graphql

    GraphQL endpoint for indexed data

Example Usage

query GetChainData {
  chain(id: "my-chain-id") {
    name
    status
    blocks(first: 10) {
      id
      timestamp
      transactions {
        count
      }
    }
  }
}

WebSocket Events

Subscribe to real-time blockchain events and updates.

Endpoints & Methods

  • WS
    /ws

    WebSocket endpoint for live events

Example Usage

const ws = new WebSocket('wss://ws.testnet.novalayer.dev');

ws.onopen = () => {
  console.log('WebSocket connected');
  ws.send(JSON.stringify({
    type: 'subscribe',
    event: 'newBlock',
    chainId: 'my-chain-id'
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('New block received:', data);
};

Manage Your API Keys

Securely generate and manage your API keys for seamless integration with NovaLayer services.

Go to API Settings