Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,66 @@ sudo systemctl daemon-reload
sudo systemctl enable --now yellowstone-jet
```

## HTTP Transaction API

Jet exposes a lightweight HTTP endpoint for transaction submission alongside the JSON-RPC interface:

```
POST /api/v1/transactions
```

### Query parameters

| Parameter | Values | Default | Description |
|-----------|--------|---------|-------------|
| `encoding` | `base58`, `base64` | `base58` | Encoding of the text body (ignored for raw bytes) |
| `max_retries` | integer | unset | Maximum retry attempts |
| `response` | `signature`, `none` | `none` | What to return on success |

### Optional headers

These headers provide per-request overrides for retry and policy behavior.

| Header | Values | Description |
|--------|--------|-------------|
| `solana-forwardingpolicies` | comma-separated pubkeys | Restrict forwarding to leaders allowed by these policies |

### Content types

| Content-Type | Body format | Description |
|---|---|---|
| `application/octet-stream` | Raw wire bytes | Fastest path — zero encode/decode overhead |
| `text/plain` (or absent) | Encoded text | base58 or base64 encoded transaction string |

### Examples

```bash
# Raw bytes — fastest, no encoding overhead
curl -X POST /api/v1/transactions \
-H 'Content-Type: application/octet-stream' \
--data-binary @transaction.bin

# Raw bytes with retry in query and policy override in header, return signature
curl -X POST '/api/v1/transactions?response=signature&max_retries=3' \
-H 'Content-Type: application/octet-stream' \
-H 'solana-forwardingpolicies: 11111111111111111111111111111111' \
--data-binary @transaction.bin

# Base58 (default encoding), return signature
curl -X POST '/api/v1/transactions?response=signature' \
-d '<base58-encoded-tx>'

# Base64 with signature
curl -X POST '/api/v1/transactions?encoding=base64&response=signature' \
-d '<base64-encoded-tx>'
```

### Response

- **Success**: `200 OK` — empty body by default, or transaction signature if `?response=signature`
- **Error**: `400 Bad Request` — plain text error message
- **Wrong method**: `405 Method Not Allowed`

## Attribution

Created by the greybeards at [Triton One](https://triton.one)
Expand Down
2 changes: 1 addition & 1 deletion apps/jet/src/bin/jet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ async fn run_jet(
};

let shared_tpu_activity_tracker = Arc::new(TpuActivityTracker::default());
metrics::register_tpu_activity_tracker(Arc::clone(&shared_tpu_activity_tracker));
let jet_callback = JetTpuCallback {
tpu_activity_tracker: Arc::clone(&shared_tpu_activity_tracker),
other: maybe_callback_sink,
Expand Down Expand Up @@ -495,6 +494,7 @@ async fn run_jet(
tpu_identity_updater.clone(),
config.identity.expected,
Arc::new(cluster_tpu_info),
shared_tpu_activity_tracker,
)
.await;

Expand Down
123 changes: 0 additions & 123 deletions apps/jet/src/forwarding_metrics.rs

This file was deleted.

1 change: 0 additions & 1 deletion apps/jet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub mod blockhash_queue;
pub mod cluster_tpu_info;
pub mod config;
pub mod crypto_provider;
mod forwarding_metrics;
pub mod grpc_geyser;
pub mod grpc_lewis;
pub mod http_tx_handler;
Expand Down
24 changes: 14 additions & 10 deletions apps/jet/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ pub mod jet {
HistogramOpts::new("http_tx_request_duration_seconds", "HTTP transaction endpoint request duration in seconds")
.buckets(vec![0.0005, 0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0])
).unwrap();

static ref STALLED_TPU_ACTIVITY: IntGauge = IntGauge::new(
"jet_tpu_forwarding_stalled", "Whether TPU forwarding meets the stall condition in the trailing 30-second activity window (1 stalled, 0 otherwise)"
).unwrap();

}

pub fn init() {
Expand Down Expand Up @@ -275,12 +280,21 @@ pub mod jet {
register!(VERSIONED_TXN_HANDLE_ERROR);
register!(HTTP_TX_REQUESTS);
register!(HTTP_TX_REQUEST_DURATION);
register!(STALLED_TPU_ACTIVITY);

yellowstone_jet_tpu_client::prom::register_metrics(&REGISTRY);
grpc_lewis::prom::register_metrics(&REGISTRY);
});
}

pub fn set_stalled_tpu_activity(stalled: bool) {
if stalled {
STALLED_TPU_ACTIVITY.set(1);
} else {
STALLED_TPU_ACTIVITY.set(0);
}
}

pub fn incr_versioned_txn_handler_error(error_type: &str) {
VERSIONED_TXN_HANDLE_ERROR
.with_label_values(&[error_type])
Expand All @@ -293,16 +307,6 @@ pub mod jet {
.inc();
}

pub fn register_tpu_activity_tracker(
tracker: std::sync::Arc<crate::rpc::admin::TpuActivityTracker>,
) {
REGISTRY
.register(Box::new(crate::forwarding_metrics::ForwardingMetrics::new(
tracker,
)))
.expect("forwarding metric is registered once");
}

pub fn increment_send_transaction_error() {
SEND_TRANSACTION_ERROR.inc();
}
Expand Down
Loading