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

@p2p-org/signer-sdk

v0.0.2

Published

A unified blockchain transaction signing SDK that provides secure, local signing for 15+ blockchain networks. Sign transactions offline without exposing private keys to external services.

Readme

@p2p-org/signer-sdk

A unified blockchain transaction signing SDK that provides secure, local signing for 15+ blockchain networks. Sign transactions offline without exposing private keys to external services.

Features

  • 🔐 Secure Local Signing - Private keys never leave your environment
  • 🌐 Multi-Blockchain Support - 15+ integrated blockchain networks
  • 🛠️ Unified Interface - Consistent API across all supported chains
  • 📦 TypeScript First - Full type safety and IntelliSense support
  • 🖥️ CLI & SDK - Use as a library or command-line tool

Table of Contents

Installation

As a Library

# Using npm
npm install @p2p-org/signer-sdk

# Using yarn
yarn add @p2p-org/signer-sdk

# Using pnpm
pnpm add @p2p-org/signer-sdk

As a CLI Tool

# Install globally
npm install -g @p2p-org/signer-sdk

# Or use directly with npx
npx @p2p-org/signer-sdk --help

Quick Start

Basic Example

import { SignerFactory, Signers } from '@p2p-org/signer-sdk';

// Create configuration for your blockchain
const config = {
  networkName: 'mainnet',
  btcPrivateKey: 'YOUR_PRIVATE_KEY',
};

// Create a signer instance
const signer = SignerFactory.createSigner(Signers.Btc, config);

// Sign a transaction
const unsignedTransaction = '70736274ff01007d...';
const signedTx = await signer.sign({ unsignedTransaction });

console.log('Signed transaction:', signedTx);

Supported Blockchains

| Blockchain | Status | Networks | Configuration | Transaction Format | |------------|--------|----------|---------------|-------------------| | Aptos | ✅ Available | mainnet, testnet | Config | Transaction | | Avail | ✅ Available | mainnet, testnet | Config | Transaction | | Babylon | ✅ Available | babylon-mainnet, babylon-testnet | Config | Transaction | | Bitcoin | ✅ Available | mainnet, testnet | Config | Transaction | | Celestia | ✅ Available | mainnet, testnet | Config | Transaction | | Cosmos | ✅ Available | cosmoshub-4, theta-testnet-001 | Config | Transaction | | dYdX | ✅ Available | mainnet, testnet | Config | Transaction | | Ethereum | ✅ Available | mainnet, sepolia, holesky | Config | Transaction | | Polkadot | ✅ Available | westend, kusama, polkadot | Config | Transaction | | Sei | ✅ Available | pacific-1, atlantic-2 | Config | Transaction | | Solana | ✅ Available | mainnet-beta, testnet, devnet | Config | Transaction | | Story | ✅ Available | mainnet, aeneid | Config | Transaction | | Sui | ✅ Available | mainnet, testnet | Config | Transaction | | The Graph | ✅ Available | mainnet | Config | Transaction | | Tezos | ✅ Available | mainnet | Config | Transaction | | TON | ✅ Available | mainnet, testnet | Config | Transaction | | Tron | ✅ Available | mainnet, nile | Config | Transaction | | Cardano | 🚧 Coming Soon | - | - | - | | Near | 🚧 Coming Soon | - | - | - |

Usage Examples

Solana - Simple Transaction Signing

import { SignerFactory, Signers } from '@p2p-org/signer-sdk';

const config = {
  networkName: 'mainnet-beta',
  solanaAddress: 'YOUR_SOLANA_ADDRESS',
  solanaPrivateKeys: ['YOUR_PRIVATE_KEY'], // Array of private keys
};

const signer = SignerFactory.createSigner(Signers.Solana, config);

const unsignedTransaction = 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAg...';
const signedTx = await signer.sign({ unsignedTransaction });

console.log('Signed transaction:', signedTx);

Cosmos - Staking Transaction

import { SignerFactory, Signers } from '@p2p-org/signer-sdk';
import axios from 'axios';

const config = {
  cosmosNodeRpc: 'https://cosmos-rpc.example.com',
  networkName: 'cosmoshub-4',
  cosmosAddress: 'cosmos1...',
  cosmosMnemonic: 'your twelve word mnemonic phrase here ...',
};

// Create a staking transaction (example with P2P Staking API)
const stakingData = await axios.post(
  'https://api.p2p.org/api/v1/cosmos/cosmoshub-4/staking/stake',
  {
    stashAccountAddress: config.cosmosAddress,
    amount: 1.5,
  },
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
    },
  }
);

// Sign the transaction
const signer = SignerFactory.createSigner(Signers.Cosmos, config);
const signedTx = await signer.sign(stakingData.data.result.transactionData);

console.log('Signed staking transaction:', signedTx);

Polkadot - Multiple Operations

import { SignerFactory, Signers } from '@p2p-org/signer-sdk';

const config = {
  polkadotNodeRpc: 'wss://westend-rpc.polkadot.io',
  networkName: 'westend',
  polkadotAddress: '5...',
  polkadotFileContent: 'ENCRYPTED_KEYSTORE_JSON',
  polkadotFilePassword: 'YOUR_PASSWORD',
};

const signer = SignerFactory.createSigner(Signers.Polkadot, config);

// Sign multiple transactions
const bondTx = await signer.sign({ unsignedTransaction: 'BOND_TX_DATA' });
const nominateTx = await signer.sign({ unsignedTransaction: 'NOMINATE_TX_DATA' });

// Important: Close the signer when done (required for Polkadot)
signer.close();

Ethereum - EIP-1559 Transaction

import { SignerFactory, Signers } from '@p2p-org/signer-sdk';

const config = {
  networkName: 'mainnet',
  ethereumPrivateKey: 'YOUR_PRIVATE_KEY',
};

const signer = SignerFactory.createSigner(Signers.Ethereum, config);

const unsignedTransaction = '0x02f86f0180808504a817c80082520894...';
const signedTx = await signer.sign({ unsignedTransaction });

console.log('Signed EIP-1559 transaction:', signedTx);

CLI Usage

The SDK includes a powerful CLI for signing transactions directly from the command line.

Basic CLI Commands

# Show help
p2p-signer --help

# Sign a Solana transaction
p2p-signer solana sign \
  --network-name="mainnet-beta" \
  --address="YOUR_ADDRESS" \
  --private-keys='["YOUR_PRIVATE_KEY"]' \
  --unsigned-transaction="BASE64_TX_DATA"

# Sign a Cosmos transaction with mnemonic
p2p-signer cosmos sign \
  --network-name="cosmoshub-4" \
  --node-rpc="https://cosmos-rpc.example.com" \
  --address="cosmos1..." \
  --mnemonic="your twelve word mnemonic phrase" \
  --unsigned-transaction='{"unsignedTransaction":"..."}'

# Sign a Bitcoin PSBT
p2p-signer btc sign \
  --network-name="mainnet" \
  --private-key="YOUR_PRIVATE_KEY" \
  --unsigned-transaction="PSBT_BASE64"

For detailed CLI documentation, see CLI README.

API Reference

SignerFactory

The main entry point for creating blockchain signers.

class SignerFactory {
  static createSigner<T extends Signers>(
    blockchain: T,
    config: SignerConfig<T>
  ): Signer;
}

Signer Interface

All blockchain signers implement this common interface:

interface Signer<UnsignedTx, SignedTx, Info> {
  sign(transaction: UnsignedTx): Promise<SignedTx>;
  info(): Promise<Info>;
  close(): Promise<void>;
}

Configuration Types

Each blockchain has specific configuration requirements:

// Example: Solana Configuration
interface SolanaConfig {
  networkName: string;
  solanaAddress: string;
  solanaPrivateKeys: string[];
}

// Example: Cosmos Configuration
interface CosmosConfig {
  networkName: string;
  cosmosNodeRpc: string;
  cosmosAddress: string;
  cosmosMnemonic: string;
}

Development

Prerequisites

  • Node.js >= 16
  • TypeScript >= 4.5

Setup

# Clone the repository
git clone https://github.com/p2p-org/signer-sdk.git
cd signer-sdk

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run linting
npm run lint

Adding a New Blockchain

  1. Create a new directory under src/ for your blockchain
  2. Implement the Signer interface
  3. Add configuration and transaction interfaces
  4. Register in SignerFactory and Signers enum
  5. Add CLI command (optional)
  6. Write tests and documentation

Example structure:

src/
└── mychain/
    ├── index.ts
    ├── mychain-signer.ts
    ├── constants/
    │   └── mychain-networks.ts
    └── interfaces/
        ├── mychain-config.ts
        └── mychain-transaction.ts

Security

Best Practices

  • Never share or commit private keys
  • Use environment variables for sensitive data
  • Run signing operations in secure environments
  • Validate all inputs before signing
  • Keep the SDK updated for security patches

Security Features

  • ✅ Input validation on all configurations
  • ✅ TypeScript type safety
  • ✅ No private key storage or transmission

Reporting Security Issues

Please report security vulnerabilities to [email protected]. Do not create public issues for security problems.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow TypeScript best practices
  • Use ESLint and Prettier configurations
  • Write comprehensive tests
  • Document new features

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ by P2P.org