Skip to content

Shred API

The Shred API is RISE Chain's revolutionary approach to blockchain transaction processing, enabling real-time confirmations and state updates while maintaining full EVM compatibility.

Overview

The Shred API extends the standard Ethereum JSON-RPC API with real-time capabilities:

  • Instant transaction confirmations in 3-5 milliseconds
  • Real-time state updates through lightweight shreds
  • Full EVM compatibility with existing tools and libraries
  • WebSocket subscriptions for streaming updates

Quick Example

import { sendTransactionSync } from 'shreds/viem'
import { createWalletClient, http, parseEther } from 'viem'
import { riseTestnet } from 'viem/chains'
 
const client = createWalletClient({
  chain: riseTestnet,
  transport: http()
})
 
// Send transaction with instant confirmation
const hash = await sendTransactionSync(client, {
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f6E98d',
  value: parseEther('0.1')
})
 
console.log('Transaction confirmed in milliseconds!', hash)

Getting Started

Learn the Concepts

Understand What are Shreds? and how they power real-time blockchain applications.

Install Dependencies

Follow our Installation guide to set up your development environment.

Try the Quickstart

Jump into our Quickstart tutorial for a hands-on example.

Key Features

Synchronous Transactions

Traditional blockchain transactions are asynchronous - you submit and wait. With RISE Chain's sendTransactionSync, transactions confirm instantly:

// Traditional (async)
const hash = await client.sendTransaction(tx)
// Wait for confirmation...
 
// RISE Chain (sync) 
const hash = await sendTransactionSync(client, tx)
// Already confirmed!

Real-Time State Reading

All state reading methods automatically use the latest shred state:

// This includes pending shred updates
const balance = await client.getBalance({ address })
const nonce = await client.getTransactionCount({ address })
const storage = await client.getStorageAt({ address, slot })

WebSocket Subscriptions

Subscribe to real-time updates:

import { watchShreds } from 'shreds/viem'
 
// Watch for new shreds
watchShreds(wsClient, {
  onShred: (shred) => {
    console.log('New shred:', shred.hash)
  }
})
 
// Watch contract events
wsClient.watchContractEvent({
  address: contractAddress,
  abi: contractAbi,
  onLogs: (logs) => {
    // Process events instantly
  }
})

Architecture

The Shred API consists of three main components:

1. Enhanced JSON-RPC Methods

  • eth_sendRawTransactionSync - Submit with instant confirmation
  • Standard methods enhanced with shred state

2. WebSocket Subscriptions

  • shreds - Stream new shreds
  • logs - Real-time event logs
  • newHeads - Block headers

3. NPM Module

The shreds npm package provides:

  • TypeScript-first API
  • viem integration
  • Convenience methods
  • Type safety

Use Cases

Gaming

Build fully on-chain games with instant state updates and responsive gameplay.

DeFi

Enable high-frequency trading and instant settlement for financial applications.

Payments

Process payments instantly without pending transaction uncertainty.

Real-Time Apps

Create any application requiring immediate blockchain feedback.

Resources

Community