Skip to content

RepublicAI/devtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Republic Protocol DevTools

End-to-end developer toolkit for submitting compute jobs to the Republic blockchain using JSON RPC.

Features

  • JSON RPC Client: No need to run republicd binary
  • Key Management: Create, import, export keys programmatically
  • Transaction Signing: Sign and broadcast transactions via RPC
  • Job Submission: Submit compute jobs to validators
  • Status Monitoring: Query and watch job status
  • CLI Tool: Complete command-line interface
  • LLM Inference Example: Ready-to-use GPT-2 inference container

Installation

cd republic-devtools
pip install -e .

This will install the republic-dev CLI tool and the Python client library.

Dependencies

  • Python >= 3.8
  • Docker (for building inference containers)
  • Running Republic blockchain node

Quick Start

1. Start the Blockchain

# From the repository root
bash local_node.sh

Wait for the chain to start (check with curl http://localhost:26657/status).

2. Run the Complete Example

cd republic-devtools/examples
python complete_example.py

This will:

  • Check prerequisites
  • Verify blockchain connectivity
  • Build the Docker container for LLM inference
  • Set up a test key
  • Show you how to submit jobs

3. Use the CLI Tool

Check Node Status

republic-dev node-status

Create a Key

republic-dev keys create my-key

List Keys

republic-dev keys list

Submit a Job

republic-dev submit \
  --from my-key \
  --validator republicvaloper1... \
  --image republic-llm-inference:latest

Check Job Status

republic-dev status <job-id>

# Or watch for changes
republic-dev status <job-id> --watch

Using the Python Client

from republic_devtools.client import RepublicClient

# Initialize client
client = RepublicClient(
    rpc_endpoint="http://localhost:26657",
    chain_id="9001"
)

# Create a key
address = client.create_key("my-key")
print(f"Address: {address}")

# Submit a job
resp = client.submit_job(
    from_key="my-key",
    target_validator="republicvaloper1...",
    execution_image="republic-llm-inference:latest",
    verification_image="example-verification:latest"
)

print(f"TX Hash: {resp['txhash']}")

# Wait for job ID
job_id = client.wait_for_job(resp['txhash'])
print(f"Job ID: {job_id}")

# Check status
status = client.get_job_status(job_id)
print(status)

CLI Reference

Global Options

  • --rpc: RPC endpoint (default: http://localhost:26657)
  • --chain-id: Chain ID (default: 9001)

Commands

keys create <name>

Create a new key

keys list

List all stored keys

keys show <name>

Show details for a specific key

keys import <name> <private-key-hex>

Import an existing private key

keys export <name>

Export private key (use with caution)

submit

Submit a compute job

  • --from: Key name to sign with (required)
  • --validator: Target validator address (required)
  • --image: Docker image for execution (required)
  • --verification: Docker image for verification
  • --upload-endpoint: Upload endpoint
  • --fetch-endpoint: Fetch endpoint
  • --fee: Job fee amount
  • --gas: Gas limit
  • --fees: Transaction fees
  • --wait/--no-wait: Wait for job ID

status <job-id>

Get job status

  • --watch, -w: Watch for status changes
  • --interval: Polling interval for watch mode

node-status

Check blockchain node status

submit-llm

Submit an LLM inference job (convenience command)

  • --key: Key name (required)
  • --validator: Validator address (required)
  • --model: Hugging Face model ID
  • --prompt: Input prompt
  • --image: Docker image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors