Comprehensive documentation for D_D Cloud's multi-chain RPC service
This repository contains the source code for the D_D Cloud RPC documentation, built with mdBook.
-
Clone the repository
git clone https://github.com/jamiebones/rpc-doc-sample cd rpc-doc-sample
-
Install mdBook
cargo install mdbook
-
Install mdBook plugins (optional but recommended)
cargo install mdbook-linkcheck cargo install mdbook-toc
-
Serve the book locally
mdbook serve
-
Open in browser
- Navigate to
http://localhost:3000
- The book will auto-reload when you make changes
- Navigate to
-
Build static files
mdbook build
- Output will be in the
book/
directory
- Output will be in the
rpc-docs/
βββ book.toml # mdBook configuration
βββ src/ # Documentation source files
β βββ SUMMARY.md # Table of contents
β βββ introduction.md # Introduction page
β βββ getting-started/ # Getting started guides
β βββ api-reference/ # API documentation
β βββ methods/ # RPC method documentation
β β βββ evm/ # Ethereum-compatible chains
β β βββ solana/ # Solana methods
β β βββ cosmos/ # Cosmos ecosystem
β β βββ near/ # NEAR Protocol
β β βββ sui/ # Sui Network
β β βββ tron/ # TRON Network
β βββ networks/ # Supported networks
β βββ examples/ # Code examples
β β βββ javascript/ # JavaScript/Node.js
β β βββ python/ # Python examples
β β βββ go/ # Go examples
β β βββ rust/ # Rust examples
β β βββ curl/ # cURL examples
β βββ websockets/ # WebSocket documentation
β βββ advanced/ # Advanced topics
β βββ troubleshooting/ # Common issues and solutions
β βββ resources/ # Additional resources
βββ theme/ # Custom styling
β βββ custom.css # Custom CSS styles
β βββ custom.js # Custom JavaScript
βββ book/ # Generated output (auto-created)
- Create new markdown files in the appropriate
src/
subdirectory - Update
src/SUMMARY.md
to include your new pages in the navigation - Follow the existing structure and formatting conventions
- Find the relevant
.md
file in thesrc/
directory - Make your changes using standard Markdown syntax
- Test locally with
mdbook serve
-
Use clear, descriptive headings
-
Include code examples with proper syntax highlighting
-
Add links to related sections
-
Use callout boxes for important information:
> **Note:** This is an important note > **Warning:** This is a warning
When adding code examples, use appropriate language tags:
```javascript
// JavaScript example
const provider = new ethers.JsonRpcProvider("https://rpc.ddcloud.io/eth");
```
```python
# Python example
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://rpc.ddcloud.io/eth'))
```
```bash
# cURL example
curl -X POST https://rpc.ddcloud.io/eth \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```
The documentation uses a custom theme with both light and dark modes:
- Default: Light theme
- Dark mode: Available via theme toggle
- Custom styles: Located in
theme/custom.css
- Custom scripts: Located in
theme/custom.js
To modify the appearance:
- Edit
theme/custom.css
for styling changes - Modify CSS variables for color scheme adjustments
- Test changes with
mdbook serve
The main configuration is in book.toml
:
[book]
title = "D_D Cloud RPC Documentation"
authors = ["D_D Cloud Team"]
description = "Comprehensive documentation for D_D Cloud's multi-chain RPC service"
[output.html]
additional-css = ["theme/custom.css"]
additional-js = ["theme/custom.js"]
default-theme = "navy"
- Search: Full-text search functionality
- Code playground: Interactive code examples
- Folding: Collapsible sections
- Git integration: Edit links and repository info
- Push changes to the main branch
- GitHub Actions will automatically build and deploy
- Site available at your GitHub Pages URL
-
Build the book
mdbook build
-
Deploy the
book/
directory to your web server
FROM nginx:alpine
COPY book/ /usr/share/nginx/html/
EXPOSE 80
Command | Description |
---|---|
mdbook serve |
Start development server |
mdbook build |
Build static files |
mdbook test |
Test code examples |
mdbook clean |
Clean build artifacts |
mdbook watch |
Watch for changes |
- Start with overview - Brief introduction to the topic
- Provide examples - Show practical usage
- Include parameters - Document all parameters and responses
- Add troubleshooting - Common issues and solutions
## method_name
Brief description of what this method does.
### Parameters
| Parameter | Type | Required | Description |
| --------- | -------- | -------- | ------------------------ |
| `param1` | `string` | Yes | Description of parameter |
| `param2` | `number` | No | Optional parameter |
### Example Request
\```javascript
// Example code here
\```
### Example Response
\```json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x..."
}
\```
### Error Codes
| Code | Message | Description |
| ------ | --------------- | ------------------------------------------- |
| -32600 | Invalid Request | The JSON sent is not a valid Request object |
mdBook not found
cargo install mdbook
Port already in use
mdbook serve --port 3001
Build fails
- Check
book.toml
syntax - Verify all links in
SUMMARY.md
point to existing files - Run
mdbook test
to check code examples
- Documentation: mdBook Guide
- Issues: Create an issue in this repository
- Community: Join our Discord/Telegram for support
This documentation is licensed under MIT License.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
- Discord: Join our community
Happy documenting! πβ¨