npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@suxinmin/plugin-casper

v1.0.6

Published

Casper blockchain plugin for Eliza AI agent framework

Downloads

856

Readme

@elizaos/plugin-casper

Casper blockchain plugin for Eliza AI agent framework. This plugin enables AI agents to interact with the Casper blockchain network, including wallet management, token transfers, smart contract deployment, and blockchain data queries.

Features

  • 🏦 Wallet Management: Generate new wallets and restore existing ones
  • 💰 Balance Queries: Check CSPR token balances for any account
  • 💸 Token Transfers: Send CSPR tokens between accounts
  • 📊 Transaction Status: Monitor transaction status by deploy hash
  • 🔗 Smart Contracts: Deploy and call smart contracts (WASM)
  • 🌐 Network Info: Query latest block and network status

Installation

npm install @elizaos/plugin-casper

Configuration

Add the following environment variables to your .env file:

# Casper Node URL (testnet or mainnet)
CASPER_ENABLED=true

CASPER_NODE_URL=https://node.testnet.casper.network/rpc
CASPER_RPC_URL=https://node.testnet.casper.network/rpc

Network URLs

Testnet Public Nodes:

  • https://rpc.testnet.cspr.cloud:443/rpc (Recommended)
  • https://node.testnet.casperlabs.org:7777/rpc
  • https://testnet.cspr.cloud:443/rpc

Mainnet Public Nodes:

  • https://rpc.cspr.cloud:443/rpc (Recommended)
  • https://node.mainnet.casperlabs.org:7777/rpc
  • https://cspr.cloud:443/rpc

Note: Some nodes (such as node.testnet.cspr.cloud) may require an API Key. It is recommended to use the public RPC endpoints listed above.

Usage

Basic Setup

import { casperPlugin } from '@elizaos/plugin-casper';

// Register the plugin with your Eliza agent
const agent = new Agent({
  plugins: [casperPlugin],
  // ... other configuration
});

Available Actions

1. Generate Wallet

Create a new Casper wallet with public/private key pair.

Example:

User: Create a new Casper wallet
Agent: I'll generate a new Casper wallet for you...

📍 Address: account-hash-xxx
🔑 Public Key: 02a1b2c3d4e5f6...
🔐 Private Key: xxxxx

⚠️ IMPORTANT: Store your private key securely! Never share it with anyone.

2. Check Balance

Query the CSPR balance of a Casper account.

Example:

User: Check balance for 02a1b2c3d4e5f6...
Agent: Let me check the balance...

💰 Balance for 02a1b2c3d4e5f6...:
100.500000000 CSPR

3. Transfer Tokens

Send CSPR tokens to another account.

Example:

User: Send 5 CSPR to 02a1b2c3d4e5f6...
Agent: I'll initiate the transfer...

✅ Transfer initiated!

Amount: 5 CSPR
To: 02a1b2c3d4e5f6...
Deploy Hash: abc123def456...

You can check the transaction status using the deploy hash.

4. Check Transaction Status

Monitor the status of a transaction by its deploy hash.

Example:

User: Check status of deploy abc123def456...
Agent: Let me check the transaction status...

📊 Transaction Status:
Deploy Hash: abc123def456...
Status: { ... }

Providers

The plugin includes several providers that automatically provide context:

  • casperNetworkProvider: Shows current network status
  • casperWalletProvider: Displays configured wallet information
  • casperGasProvider: Provides gas fee guidance

API Reference

CasperClient

The core client class for interacting with the Casper blockchain.

import { CasperClient } from '@elizaos/plugin-casper';

const client = new CasperClient({
  nodeUrl: 'https://node.testnet.cspr.cloud:443',
  chainName: 'casper-net-1'
});

Methods

generateWallet(): WalletInfo

Generate a new wallet with key pair.

const wallet = client.generateWallet();
console.log(wallet.address);      // Account address
console.log(wallet.publicKey);    // Public key
console.log(wallet.privateKey);   // Private key
getBalance(publicKey: string): Promise<string>

Get account balance in motes (1 CSPR = 1,000,000,000 motes).

const balance = await client.getBalance(publicKey);
const csprBalance = parseInt(balance) / 1000000000;
transfer(fromPrivateKey, toPublicKey, amount, paymentAmount?): Promise<string>

Transfer CSPR tokens. Amount should be in motes.

const deployHash = await client.transfer(
  privateKey,
  recipientPublicKey,
  5 * 1000000000, // 5 CSPR in motes
  2500000000      // Gas fee in motes
);
getDeployStatus(deployHash: string): Promise<any>

Check transaction status.

const status = await client.getDeployStatus(deployHash);
getLatestBlock(): Promise<any>

Get latest block information.

const block = await client.getLatestBlock();

Development

Build

npm run build

Watch Mode

npm run dev

Clean

npm run clean

Dependencies

  • casper-js-sdk: Official Casper JavaScript SDK
  • @elizaos/core: Eliza framework core

Security Notes

⚠️ Important Security Considerations:

  1. Never expose private keys in client-side code or logs
  2. Use environment variables for sensitive data
  3. Consider using hardware wallets or secure key storage solutions
  4. Always verify transaction details before signing
  5. Test on testnet before using mainnet

Gas Fees

Casper uses a fixed gas price model:

  • Standard Transfer: ~2.5 CSPR
  • Contract Deployment: ~10 CSPR
  • Contract Call: ~2.5 CSPR

Gas fees are relatively stable compared to other networks.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Support

For issues and questions:

Acknowledgments