/api/transactions/locker/peek

GET

Checks the contents of a RAIDA locker without downloading the coins. Useful for verifying what's stored in a locker before retrieving it.

Endpoint: http://localhost:8080/api/transactions/locker/peek

Parameters

Name Type Required Description
locker_key string Yes The 32-character hexadecimal locker key

Responses

Success Response (200)

Returns information about the coins stored in the locker.

{
    "success": true,
    "message": "Locker contents retrieved",
    "coins": {
        "total_value": 1337,
        "coin_count": 5,
        "denominations": {
            "1000": 1,
            "100": 3,
            "10": 0,
            "1": 37
        }
    },
    "locker_key": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"
}

Error Responses

400 Bad Request

Invalid or missing locker key

{
    "error": true,
    "message": "Invalid locker key format. Must be 32 hex characters",
    "code": 400
}

404 Not Found

Locker is empty or doesn't exist

{
    "error": true,
    "message": "Locker is empty or does not exist",
    "code": 404
}

500 Internal Server Error

Server error or RAIDA network issue

{
    "error": true,
    "message": "Failed to peek locker: RAIDA network error",
    "code": 500
}

Examples

cURL Example

curl -X GET "http://localhost:8080/api/transactions/locker/peek?locker_key=a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"

JavaScript Example

const lockerKey = 'a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456';

fetch(`http://localhost:8080/api/transactions/locker/peek?locker_key=${lockerKey}`)
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            console.log(`Locker contains ${data.coins.coin_count} coins worth ${data.coins.total_value} units`);
            console.log('Denominations:', data.coins.denominations);
        } else {
            console.error('Error:', data.message);
        }
    })
    .catch(error => console.error('Network error:', error));

Python Example

import requests

locker_key = 'a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456'
url = f'http://localhost:8080/api/transactions/locker/peek'
params = {'locker_key': locker_key}

try:
    response = requests.get(url, params=params)
    data = response.json()

    if data.get('success'):
        coins = data.get('coins', {})
        print(f"Locker contains {coins.get('coin_count')} coins")
        print(f"Total value: {coins.get('total_value')} units")
        print(f"Denominations: {coins.get('denominations')}")
    else:
        print(f"Error: {data.get('message')}")
except requests.RequestException as e:
    print(f"Request failed: {e}")

Notes

  • This operation does not download or remove coins from the locker
  • The locker key must be exactly 32 hexadecimal characters
  • Use this endpoint to verify locker contents before downloading
  • The response shows the total value and breakdown by denomination
  • This is a read-only operation that requires minimal RAIDA communication