# Communication II: Building and Integrating Custom RPC Handlers

### Module Overview

Custom RPC handlers are the gateway to extending Rippled's capabilities: they allow developers to add new queries, operations, and integrations tailored to specific use cases.

In this module you apply everything learned in last course (handler architecture, request flow, authentication, error handling) to design, implement, and test your own RPC handlers. By the end you will have built a complete custom handler from scratch, including registration, validation, ledger access, and comprehensive testing.

***

### Explore the Topics

This deep dive is organized into focused topics, each exploring a critical aspect of RPC handler implementation. Click on any topic below to dive deeper into the concepts, codebase structure, and practical implementations.

***

### What You Will Learn

By completing this module, you will be able to:

* Implement custom RPC handlers following XRPL conventions with proper request parsing and response formatting
* Apply security patterns including role-based access control and resource management
* Build comprehensive error handling with proper HTTP status codes and JSON-RPC error responses
* Test your implementation with unit tests and integration tests
* Access ledger data, account information, and transaction history through context APIs
* Follow best practices and established patterns for maintainability and code quality

These skills are essential for extending Rippled functionality, building developer tools, and contributing to the XRPL ecosystem.

***

#### 🛠️ Implementing Custom Handlers

**Writing Complete Handler Functions**

Learn how to implement RPC handlers from scratch, including function signatures, input validation, ledger queries, result construction, and proper code organization.

**Key Topics**: Handler signatures, input validation, ledger access, result construction, code organization

**Codebase**: `src/xrpld/rpc/handlers/`

[Explore Implementing Custom Handlers →](/core-dev-bootcamp/module07/implementing-custom-handlers.md)

***

#### 🧪 Testing RPC Handlers

**Ensuring Correctness and Reliability**

Master the testing strategies for RPC handlers, including unit test structure, mock objects, fixtures, integration testing, and edge case coverage.

**Key Topics**: Unit tests, mock objects, fixtures, integration testing, edge cases

**Codebase**: `src/test/rpc/`

[Explore Testing RPC Handlers →](/core-dev-bootcamp/module07/testing-rpc-handlers.md)

***

#### ⚡ Advanced Features

**Beyond Basic Request-Response**

Discover advanced RPC capabilities including streaming responses, subscription mechanisms, batch request processing, and gRPC integration.

**Key Topics**: Streaming responses, subscriptions, batch processing, gRPC integration

**Codebase**: `src/xrpld/rpc/`

[Explore Advanced Features →](/core-dev-bootcamp/module07/advanced-features.md)

***

#### 📏 Best Practices and Patterns

**Writing Production-Quality Code**

Learn the established patterns and guidelines for writing maintainable, performant, and well-documented RPC handlers.

**Key Topics**: Code style, common pitfalls, performance considerations, documentation standards

**Codebase**: `src/xrpld/rpc/handlers/`

[Explore Best Practices and Patterns →](/core-dev-bootcamp/module07/best-practices-patterns.md)

***

### 📚 Appendices

[Explore Handler Examples →](/core-dev-bootcamp/module07/appendices/handler-examples.md)

[Explore Common Helper Functions →](/core-dev-bootcamp/module07/appendices/helper-functions.md)

[Explore Debugging RPC Issues →](/core-dev-bootcamp/module07/appendices/debugging-guide.md)

***

## Homework

Implement a complete custom RPC handler from scratch:

[Homework: Building a Custom RPC Handler →](/core-dev-bootcamp/module08/homeworks.md)

This hands-on exercise covers handler registration, request/response definitions, complete implementation, error handling, and unit tests.

***

## Questions

If you have any questions about the homework or would like us to review your work, feel free to contact us.

[Submit Feedback →](https://docs.google.com/forms/d/e/1FAIpQLSe7qIbqepUKGVJxmWFHv0rs1zsBAzk8G6y5-bfz0Yd5rqW_5A/viewform)

***

➡️ **Next Module**: Consensus I - [Consensus I: Node, Consensus, and Ledger Fundamentals →](https://github.com/XRPL-Commons/xrpl-trainings/blob/main/core-dev-bootcamp/module08/README.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xrpl-commons.org/core-dev-bootcamp/module07.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
