Session Interface
Session Interface allows you to manipulate and manage Cradle Session. This document describes some of the notable components of the Session Interface, how to use them, and the functions of each component.
Session RPC Endpoint
You can use Cradle through the endpoint displayed at the top of the page.
This endpoint handles all session functions and RPCs through a single address -- REST
, RPC
, gRPC
can all be accessed via one address.
All endpoints are wide open and do not require any authentication.
Endpoint Type | Description | Original Port | Serving Port | URL |
---|---|---|---|---|
Session Control | Session Control Plane | 3030 | 443 | <endpoint> |
rpc | CometBFT RPC | 26657 | 443 | <endpoint> |
rest | CosmosSDK API | 1317 | 443 | <endpoint> |
gRPC | CosmosSDK gRPC | 9090 | 80 | {session_id}.cradle-grpc.ec1-prod.newmetric.xyz:80 |
Some methods like WebSocket are not yet available. They will be added in the future.
The easiest way to test the Endpoint is to check the most recent block. You can do this using the following command.
# Assumes cradle endpoint of https://cradle-manager.ec1-prod.newmetric.xyz/proxy/f3d5b2ef-c699-4996-8954-61a8e25c3640.
# Replace accordingly with your own session Endpoint.
$ curl https://cradle-manager.ec1-prod.newmetric.xyz/proxy/f3d5b2ef-c699-4996-8954-61a8e25c3640/block
Cradle implements all methods that the base chain implements. This means a cradle session will be compatible with any client that understands the API out of the box (it will even work with Wallets).
Session Monitor
You can use the Session Monitor to observe session activities. It provides a built-in mini explorer that allows you to monitor logs in real-time, similar to what you would see in a typical blockchain node. This includes the ability to track blocks and transactions proposed in the Cradle session.
- Log: Displays the informational and debug logs of the Cradle session.
- Blocks: Displays the blocks of the Cradle session, displayed in real-time.
- Transactions: Displays the transactions of the Cradle session.
- Mempool: Displays the transactions sent to the session but not yet included in a block.
Network Information
This section located in the top right displays the current status of the Cradle session. The session status includes the following information.
- Chain ID: Chain ID of the session (identical to the chain ID of the base chain)
- Current Height: Current height of the session. This height is separate from the base chain's height as the session is a fork. Everytime you propose a block, the session height will increase by 1.
- Current Timestamp: Current timestamp of the session.
Propose Block
This section provides control over proposing blocks.
The following optional parameters are available:
- Block Interval: This parameter determines the time between proposing blocks. The default value is 5000 milliseconds (5 seconds), but you can modify it to create blocks at different intervals for testing time-dependent code.
- Proposer: This parameter specifies the validator who will propose the block. The default value is "Automatic," which follows the natural proposer selection algorithm from CometBFT. You can modify this value to test your application with different proposers.
By default, Cradle is a stopped chain, meaning it does not automatically propose blocks like conventional networks. This design allows you to have precise control over when blocks are proposed, making it easier to test your application in a controlled environment.
Additionally, this approach allows for fast block skipping, as it does not wait for the consensus round to finish before skipping blocks.
Session Settings
Several settings are available for the session:
- Automatic Block Flush: When enabled, the session automatically proposes blocks upon receiving transactions. Each resulting block contains exactly one transaction. This feature is useful when you want to simplify your testing lifecycle and avoid manually proposing blocks.
- Default Block Interval: This setting determines the default block interval when the automatic block flush is enabled.
You can terminate the session by clicking the "Destroy Session" button, which will permanently delete the session and all associated data.
Destroyed sessions cannot be recovered.