Skip to content

stuckinaboot/net-public

Repository files navigation

Net Public SDK

Public TypeScript SDK packages for the Net Protocol. Provides React hooks and client classes for interacting with Net smart contracts and storage systems.

What is Net Protocol?

Net Protocol is a decentralized onchain messaging system that stores all data permanently on the blockchain. Think of it as a public bulletin board where:

  • Anyone can post (permissionless)
  • Posts are permanent (immutable blockchain storage)
  • Everything is transparent (publicly verifiable)
  • Works across multiple chains (same contract address everywhere)

Net uses sophisticated multi-dimensional indexing, allowing you to query messages by:

  • App: All messages from a specific application contract
  • User: Messages from a specific user address
  • Topic: Messages with a specific category/topic
  • Combinations: App + User + Topic for precise queries

This SDK provides TypeScript/React tools to interact with Net Protocol and build applications on top of it.

Documentation

For complete Net Protocol documentation, visit docs.netprotocol.app.

Package Status

Package Status Description
@net-protocol/core Alpha Usable but may have breaking changes over time
@net-protocol/storage Alpha Usable but may have breaking changes over time
@net-protocol/cli Alpha Usable but may have breaking changes over time
@net-protocol/netr Alpha Usable but may have breaking changes over time
@net-protocol/profiles Alpha Usable but may have breaking changes over time
@net-protocol/bazaar In Development Do not use yet. Will have breaking changes
@net-protocol/relay In Development Do not use yet. Will have breaking changes
@net-protocol/feeds In Development Do not use yet. Will have breaking changes
@net-protocol/score In Development Do not use yet. Will have breaking changes

Packages

Core messaging primitives - Read and write Net Protocol messages. This is the foundation for everything else.

What you can do:

  • Query messages by app, user, topic, or combinations
  • Get message counts
  • Send messages via app contracts
  • Build custom applications on Net Protocol

Onchain key-value storage - Store data permanently on the blockchain with complete version history.

What you can do:

  • Store small data (< 20KB) with Regular Storage
  • Store medium files (20KB-80KB) with Chunked Storage
  • Store large files (multi-MB) with XML Storage pattern
  • Access complete version history of all changes
  • Build applications that need permanent, verifiable data storage

Transaction relay service - Submit on-chain transactions without holding ETH by paying with USDC via x402.

What you can do:

  • Submit transactions via relay service (backend wallet pays gas)
  • Fund backend wallets via x402 payments (USDC)
  • Batch transactions automatically to respect API limits
  • Retry failed transactions with exponential backoff
  • Create session tokens for authenticated batch requests
  • Check backend wallet balance before submitting
  • Wait for transaction confirmations on-chain
  • Build applications that allow users to interact without ETH

On-chain user profiles - Read and write user profile data on Net Protocol.

What you can do:

  • Read profile data: profile picture, X username, bio, display name, token address, canvas
  • Write profile data with utilities to prepare Storage.put() transactions
  • Batch-read multiple profile fields efficiently
  • Build applications with decentralized user identity

Decentralized NFT marketplace - Buy, sell, and trade NFTs via Seaport on Net Protocol.

What you can do:

  • Create and manage NFT listings and collection offers
  • Buy listings and accept offers
  • Query NFT ownership on-chain
  • Build marketplace UIs with React hooks or the BazaarClient class

Topic-based message streams - Build social feeds, announcements, and community discussions.

What you can do:

  • Read posts from topic-based feeds
  • Post to feeds (social media style)
  • Build decentralized social applications
  • Create community discussion forums

On-chain scoring/upvoting - Upvote tokens, storage entries, and feed posts with strategy-based voting.

What you can do:

  • Read upvote counts for tokens, storage entries, and feed posts
  • Batch-read upvotes for multiple items in a single contract call
  • Query scores by strategy or app
  • Decode upvote messages and strategy metadata
  • Build applications with on-chain reputation and curation

Command-line interface - Interact with Net Protocol from the terminal.

What you can do:

  • Send and read messages on Net Protocol
  • Upload files to Net Storage (supports small and large files)
  • Read data from Net Storage
  • Deploy Netr tokens (memecoin-NFT pairs with automatic Uniswap pool, locked liquidity, and creator fee share)
  • Preview transactions before executing
  • Works with environment variables for secure key management

Quick examples:

# Install globally
npm install -g @net-protocol/cli

# Send a message
netp message send --text "Hello from CLI!" --private-key $PRIVATE_KEY --chain-id 8453

# Read recent messages from an app
netp message read --app 0x1234... --limit 10 --chain-id 8453

# Read messages by topic
netp message read --topic "announcements" --chain-id 8453

# Deploy a Netr token
netp token deploy \
  --name "My Token" \
  --symbol "MTK" \
  --image "https://example.com/image.png" \
  --private-key $PRIVATE_KEY \
  --chain-id 8453

# Encode-only mode (outputs transaction JSON without executing)
netp message send --text "Hello!" --chain-id 8453 --encode-only
netp token deploy --name "My Token" --symbol "MTK" --image "https://example.com/image.png" --chain-id 8453 --encode-only

Netr token SDK - Deploy and interact with memecoin-NFT pairs on Net Protocol.

What you can do:

  • Deploy memecoins with automatic Uniswap V3 liquidity
  • Query token metadata, prices, and pool information
  • Build deployment transactions for external signing
  • Access locker data (LP locked for ~1000 years)

Quick examples:

import { NetrClient } from "@net-protocol/netr";

const client = new NetrClient({ chainId: 8453 });

// Get token info
const token = await client.getToken("0x...");
console.log(token?.name, token?.symbol);

// Get current price
const price = await client.getPrice("0x...");
console.log(`Price: ${price?.priceInEth} ETH`);

// Generate salt and build deploy transaction
const saltResult = await client.generateSalt({
  name: "My Token",
  symbol: "MTK",
  image: "https://example.com/image.png",
  deployer: "0x...",
});

const txConfig = client.buildDeployConfig(
  { name: "My Token", symbol: "MTK", image: "https://...", deployer: "0x..." },
  saltResult.salt
);

Quick Start

Installation

npm install @net-protocol/core @net-protocol/storage @net-protocol/relay @net-protocol/feeds wagmi viem react
# or
yarn add @net-protocol/core @net-protocol/storage @net-protocol/relay @net-protocol/feeds wagmi viem react

React Hooks Example

import { useNetMessages, NetProvider } from "@net-protocol/core";
import { useStorage } from "@net-protocol/storage";

function App() {
  return (
    <NetProvider>
      <MyComponent />
    </NetProvider>
  );
}

function MyComponent() {
  const { messages, isLoading } = useNetMessages({
    chainId: 8453,
    filter: { appAddress: "0x..." },
  });

  const { data, isLoading: storageLoading } = useStorage({
    chainId: 8453,
    key: "my-key",
    operatorAddress: "0x...",
  });

  return (
    <div>
      <div>Messages: {messages.length}</div>
      {data && (
        <div>
          Storage: {data.text} - {data.value}
        </div>
      )}
    </div>
  );
}

Non-React Client Example

import { NetClient } from "@net-protocol/core";
import { StorageClient } from "@net-protocol/storage";

// Create clients
const netClient = new NetClient({ chainId: 8453 });
const storageClient = new StorageClient({ chainId: 8453 });

// Get messages
const messages = await netClient.getMessages({
  filter: { appAddress: "0x..." },
});

// Get storage value
const storageData = await storageClient.get({
  key: "my-key",
  operator: "0x...",
});

Documentation

For detailed usage, API reference, and examples, see the individual package documentation:

Examples

Working examples demonstrating how to build with Net Protocol:

  • Basic App - A Next.js React application showing chat messaging and storage features with wallet integration

See the examples directory for more details and setup instructions.

Claude Code Plugin

This repository includes a Claude Code plugin that enables AI-assisted development with Net Protocol. The plugin provides skills and agents that understand Net Protocol's contracts, SDK patterns, and best practices.

Installation

The quickest way to get started:

npx skills install stuckinaboot/net-public

Alternatively, you can install via the plugin marketplace:

  1. Add the marketplace:

    /plugin marketplace add stuckinaboot/net-public
    
  2. Install the plugin:

    /plugin install net-protocol@net-protocol-marketplace
    

What's Included

  • Net Protocol skill - Contextual knowledge about Net contracts, SDK usage patterns, and best practices
  • Net Explorer agent - Specialized agent for exploring and building with Net Protocol

See the plugin README for more details.

Repository Structure

This is a monorepo managed with Yarn workspaces. Each package is independently versioned and can be used standalone.

  • packages/ - SDK packages
  • docs/ - Additional documentation
  • scripts/ - Build and utility scripts

Development

Prerequisites

  • Node.js 18+
  • Yarn 4.0+

Setup

# Install dependencies
yarn install

# Build all packages
yarn build

# Run tests
yarn test

# Type check
yarn typecheck

Packages are linked via Yarn workspaces for local development.

Contributing

  1. Make your changes
  2. Run tests: yarn test
  3. Type check: yarn typecheck
  4. Build: yarn build
  5. Submit a pull request

License

MIT

About

Publicly available code for Net Protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages