Connecting with an SDK offers Mainnet and Testnet access to Casper nodes. This guide demonstrates how to authenticate using an access token across various programming languages.


Connect to nodes using the following endpoints:


Service TypeURL

Casper Node RPC API

Casper Node SSE API


Service TypeURL

Casper Node RPC API

Casper Node SSE API

Remember, all endpoints require authorization. Learn how to obtain an access token here.

SDK examples

Replace "Your-Access-Token" with your actual access token in each example.

RPC examples

import { HTTPTransport } from '@open-rpc/client-js';
import casperSDK from 'casper-js-sdk';
const { CasperServiceByJsonRPC } = casperSDK;
const { CasperClient } = casperSDK;

class CustomCasperClient extends CasperServiceByJsonRPC {
    constructor(url, options) {
        const transport = new HTTPTransport(url, options);
        this.client.requestManager.transports = [transport];

const customCasperClient = new CustomCasperClient("", {
    headers: {
        "Authorization": "55f79117-fc4d-4d60-9956-65423f39a06a"
const casperClient = new CasperClient("");
casperClient.nodeClient = customCasperClient;

(async function(){
    const result = await casperClient.nodeClient.getStatus();
    console.log({ result });
    const deploy = await casperClient.getDeploy("88461218a5e972fcda1d764d7cc4edb2e0c3a538123b97890d484f43c55935f5");
    console.log({ deploy });

SSE examples

package main

import (


func main() {
	sseClient := sse.NewClient("")
	sseClient.Streamer.Connection.Headers = map[string]string{"Authorization": "Your-Access-Token"}

	sseClient.RegisterHandler(sse.APIVersionEventType, func(ctx context.Context, event sse.RawEvent) error {
		data, _ := event.ParseAsAPIVersionEvent()
		return nil
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()
	sseClient.Start(ctx, -1)

Last updated