Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Stacks RPC Client #314

Open
CyrusVorwald opened this issue Jul 28, 2024 · 0 comments · May be fixed by #417
Open

Implement Stacks RPC Client #314

CyrusVorwald opened this issue Jul 28, 2024 · 0 comments · May be fixed by #417
Assignees

Comments

@CyrusVorwald
Copy link

The Stacks RPC client is an abstraction layer that provides a Go-specific interface to interact with the Stacks API. It enables us to check account balances, send transactions, and listen for events on the Stacks blockchain.

Core client functionality
Create an IClient interface that defines all relevant methods for interacting with the Stacks blockchain.
Create a Client struct that implements the IClient interface.

The core functionalities are:

  • Checking account status (balance/nonce)
  • Sending and verifying transactions
  • Retrieving block information
  • Interacting with smart contracts
  • Monitoring network status
  • Listening for relevant events

API Endpoints to Cover

The following are the main Stacks API endpoints we need to interact with:

Accounts

  • GET /v2/accounts/{principal}: Check account balances and retrieve nonces for transaction creation

Transactions

  • POST /v2/transactions: Broadcast a transaction
  • GET /v2/transactions/{tx_id}: Get transaction details

Blocks

  • GET /v2/blocks/{height}: Get block by height

Contracts

  • POST /v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}: Call read-only function
  • GET /v2/contracts/interface/{contract_address}/{contract_name}: Get contract interface

Network info

  • GET /v2/info: Get Stacks node info
  • GET /v2/fees/transfer: Get estimated fee

Events

  • GET /v2/events: Get recent events

Acceptance Criteria

  • All Stacks blockchain interactions required for the relay system are implemented
  • The client works with mainnet, testnet, and devnet
  • Unit tests cover all methods with >80% code coverage
  • Integration tests confirm functionality against Stacks devnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant