LangChain tools for RustChain blockchain integration.
pip install langchain-rustchainfrom langchain_rustchain import (
RustChainCheckBalance,
RustChainListBounties,
RustChainGetNodeHealth,
RustChainGetCurrentEpoch,
)
# Check RTC balance for a wallet
balance_tool = RustChainCheckBalance()
balance = balance_tool.run(wallet_id="my-wallet")
print(f"Balance: {balance} RTC")
# List available bounties
bounties_tool = RustChainListBounties()
bounties = bounties_tool.run(limit=10)
print(f"Available bounties: {bounties}")
# Check node health
health_tool = RustChainGetNodeHealth()
health = health_tool.run()
print(f"Node health: {health}")
# Get current epoch info
epoch_tool = RustChainGetCurrentEpoch()
epoch = epoch_tool.run()
print(f"Current epoch: {epoch}")from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_openai import ChatOpenAI
from langchain_rustchain import (
RustChainCheckBalance,
RustChainListBounties,
)
# Setup tools
tools = [
RustChainCheckBalance(),
RustChainListBounties(),
]
# Create agent
llm = ChatOpenAI(model="gpt-4")
agent = create_openai_tools_agent(llm, tools)
agent_executor = AgentExecutor(agent=agent, tools=tools)
# Run agent to find bounties
result = agent_executor.invoke({
"input": "Check my wallet balance 'test-wallet' and find bounties I can claim"
})
print(result)- check_balance(wallet_id): Check RTC token balance for any wallet
- list_bounties(limit): List available bounties on RustChain
- get_node_health(): Check RustChain node health status
- get_current_epoch(): Get current epoch information
- RustChain: https://rustchain.org
- RustChain MCP Server: https://github.com/Scottcjn/rustchain-mcp
- RustChain Bounties: https://github.com/Scottcjn/rustchain-bounties
This package was created for RustChain bounty #3074: Scottcjn/rustchain-bounties#3074
MIT License