6.1 Using REST API

Spicenet provides a comprehensive REST API for interacting with your node. Here are some key endpoints and their usage:

  1. Get events for a specific slot:

GET http://localhost:12346/ledger/events/{slot_number}

Example: http://localhost:12346/ledger/events/17

  1. Get events for a specific transaction:

GET http://localhost:12346/ledger/txs/{tx_id}/events/{event_index}

Example: http://localhost:12346/ledger/txs/50/events/0

  1. Get events with a specific key:

GET http://localhost:12346/ledger/batches/{batch_id}/txs/{tx_index}/events/{event_index}

Example: http://localhost:12346/ledger/batches/10/txs/2/events/0

To use these endpoints, you can use curl in your terminal or any HTTP client. For example:

curl -s http://localhost:12346/ledger/events/17 | jq

This will retrieve all events for slot 17 and format the JSON output for readability.

Last updated