This repository contains the Software Development Kit for the pod Network. It provides a simplified interface for interacting with the pod network.
- Simple connection to pod nodes using WebSocket or HTTP
- Transaction creation and submission
- Receipt verification
- Event subscription and verification
- Light client support for verifying transactions and events
- rust-sdk/: Custom alloy provider to support pod-specific features.
- types/: Common types.
The SDK provides several key types:
PodProvider: The main entry point for interacting with the pod networkPodProviderBuilder: A builder pattern for creating configured providersHash: A cryptographic hash representing transaction IDs or other hashed dataReceipt: A proof of transaction inclusion in the blockchainCommittee: The current set of validators for the networkVerifiableLog: A log entry that can be cryptographically verified
use pod_sdk::{PodProvider,PodProviderBuilder};use alloy::signers::local::PrivateKeySigner;use alloy_network::EthereumWallet;use alloy::consensus::TxLegacy;#[tokio::main]asyncfnmain() -> Result<()>{let wallet = EthereumWallet::new(PrivateKeySigner::random());let ws_url = "ws://127.0.0.1:8546".parse()?;// Connect to a pod nodelet provider = PodProviderBuilder::new().wallet(wallet).on_ws(ws_url).await?;// Create and send a transactionlet tx = TxLegacy{// transaction details};let tx_hash = provider.send_transaction(tx).await?;println!("Transaction sent with hash: {tx_hash}");// Verify receipts with the current committeelet committee = provider.get_committee().await?;let receipts = provider.get_confirmed_receipts(start_time,None).await?;for receipt in receipts.items{if receipt.verify(&committee).unwrap(){println!("Receipt verified: {:?}", receipt);}}// Subscribe to logs and verify themlet filter = Filter::new().address(contract_address).event_signature(event_signature);let sub = provider.subscribe_verifiable_logs(&filter).await?;letmut stream = sub.into_stream();whileletSome(log) = stream.next().await{if log.verify(&committee).unwrap(){println!("Verified event: {:?}", log);println!("Proof: {:?}", log.generate_multi_proof());}}Ok(())}Add the following to your Cargo.toml:
[dependencies]
pod-sdk = "0.1.0"This is a pre-release version under active development. APIs are subject to change without notice and may contain bugs. Not recommended for production use.