# sui_getCheckpoints{deprecated} - Sui

> Example code for the sui_getCheckpoints JSON-RPC method. Complete guide on how to use sui_getCheckpoints JSON-RPC in GetBlock Web3 documentation.

This method returns a paginated list of checkpoints on the SUI network. Checkpoints are certified snapshots of blockchain state and are fundamental to SUI's consensus mechanism. This method allows efficient traversal of checkpoint history.

> **Warning:** This method is deprecated

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| cursor | BigInt_for_uint64 | No | Paging cursor (sequence number) |
| limit | uint | No | Maximum items per page |
| descending_order | boolean | Yes | Sort order (true for newest first) |

> **Info:** The `descending_order` parameter is required and controls whether results are returned with newest checkpoints first (`true`) or oldest first (`false`).

## Returns

| Field | Type | Description |
| --- | --- | --- |
| data | array | Array of checkpoint objects |
| nextCursor | string | Cursor for next page |
| hasNextPage | boolean | Whether more results exist |

## Request Example

#### cURL

#### cURL

```bash
curl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "sui_getCheckpoints",
  "params": ["1004", 4, false]
}'
```

#### JavaScript (Axios)

#### request.js

```javascript
const axios = require('axios');

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'sui_getCheckpoints',
  params: ['1004', 4, false]
};

axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', payload)
.then(response => console.log(response.data));
```

#### Python

#### request.py

```python
import requests

payload = {
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "sui_getCheckpoints",
    "params": ["1004", 4, False]
}

response = requests.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/", json=payload)
print(response.json())
```

#### Rust

#### request.rs

```rust
use reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let payload = json!({
        "jsonrpc": "2.0",
        "id": "getblock.io",
        "method": "sui_getCheckpoints",
        "params": ["1004", 4, false]
    });
    let response = client.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .json(&payload).send().await?;
    println!("{}", response.text().await?);
    Ok(())
}
```

## Response Example

#### response.json

```json
{
  "jsonrpc": "2.0",
  "result": {
    "data": [
      {
        "epoch": "5000",
        "sequenceNumber": "1005",
        "digest": "9zA7Q9Ka1ykvYjSQGhQCdCf32FZkcWNWx7L22JczXGsk",
        "networkTotalTransactions": "792385",
        "timestampMs": "1676911928",
        "transactions": ["7RudGLkQDBNJyqrptkrNU66Zd3pvq8MHVAHYz9WpBm59"]
      }
    ],
    "nextCursor": "1008",
    "hasNextPage": true
  },
  "id": "getblock.io"
}
```

## Response Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| data | array | Array of checkpoint summary objects |
| nextCursor | string | Cursor for next page |
| hasNextPage | boolean | More checkpoints available |

## Use Cases

* Build block explorers with checkpoint navigation
* Sync historical blockchain data
* Monitor checkpoint production rate
* Audit checkpoint sequence integrity

## Error Handling

| Error Code | Description |
| --- | --- |
| -32602 | Invalid params - malformed cursor |
| -32603 | Internal error - node issues |

## SDK Integration

#### Sui TypeScript SDK

#### sui-typescript.ts

```typescript
import { SuiClient } from '@mysten/sui/client';

const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const checkpoints = await client.getCheckpoints({ cursor: '1004', limit: 4 });
console.log(checkpoints);
```

#### Sui Rust SDK

#### sui-rust.rs

```rust
use sui_sdk::SuiClientBuilder;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let sui = SuiClientBuilder::default().build("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/").await?;
    let checkpoints = sui.read_api().get_checkpoints(Some("1004".into()), Some(4), false).await?;
    println!("{:?}", checkpoints);
    Ok(())
}
```
