Cryptosat
WebsiteBlogSatellite Tracking
  • Cryptosat
    • 🛰️Satellite tracking
    • 📄SpaceTEE paper
    • Contribution to the Ethereum KZG Ceremony
      • Cryptosat KZG Operation Tracker
      • Crypto2 contribution output
      • Contribution verification
  • Cryptosim
    • Cryptosim
    • Asynchronous API
    • Use-case examples
    • Open-source contribution
  • 🗳️Private Voting
    • Private Voting on Snapshot X
    • Private Voting Contract
    • Browser Side Encryption
  • 🎲random-beacon
    • Verifiable Random Beacon
    • Using the random beacon on-chain
  • API documentation
    • Message Signing
    • Authentication
    • Randomness API
      • Tutorial
      • API reference
    • Queue API
      • API reference
        • Queue
          • Request
          • Requests
    • Public randomness SAPI
      • About
      • API reference
        • Public randomness
          • Result
    • FROST API
      • About
      • API reference
        • Frost
          • Partial sign
          • Private key
      • Specification
    • Satellite Public Keys
  • ⏳Time-based Primitives
    • ⌚Time-based primitives and delay-encryption
    • ⚛️Using Delay Encryption for Atomic Swaps
  • Flastsat Environment
    • Overview
    • Access and Control
    • Crypto Engine Specs
    • Power API
Powered by GitBook
On this page
  • Tutorial
  • Authentication
  • Get public randomness
  1. API documentation
  2. Public randomness SAPI

About

Provides documentation of API endpoint for getting randomness.

PreviousPublic randomness SAPINextAPI reference

Last updated 2 years ago

Tutorial

The following is an example of how to get a public random hex value.

Authentication

Make sure you provide an.

Get public randomness

Send the following request:

GET {{api-url}}/public/randomness/results

You should get the following similar response:

{
    "statusCode": 200,
    "body": {
        "request": {
            "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
            "request_name": "pub_rand",
            "request_verb": "GET",
            "request_status": {
                "status_code": 0,
                "request_status": "PENDING"
            },
            "response_eta": "2022-12-30 14:21:14",
            "created_at": "2022-12-30 10:21:14",
            "satellite_id": "crypto1"
        }
    }
}

You can check the status by using the request_uuid obtained from the store command to check if it has been sent off:

GET {{api-url}}/queue/request?=request_id=c6f9c441-446d-4d07-bc11-1b5d868bb942

You should get the following response:

{
    "request": {
        "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
        "request_name": "pub_rand",
        "request_verb": "GET",
        "request_status": {
            "request_status": "PENDING",
            "status_code": "0"
        },
        "created_at": "2022-12-30 10:21:14",
        "response_eta": "2022-12-30 14:21:14",
        "satellite_id": "crypto1"
    },
    "response_payload": {}
}

When the request status has changed to SENT, it can no longer be deleted. Once it is READY, the response_payload will be populated and the command can be archived.

You should get the following response or similar once when the request status is READY:

{
    "request": {
        "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
        "request_name": "private_key",
        "request_verb": "POST",
        "request_status": {
            "request_status": "PENDING",
            "status_code": "2"
        },
        "created_at": "2022-12-30 10:21:14",
        "response_eta": "",
        "satellite_id": "crypto1"
    },
    "response_payload": {
        "payload_size": 33,
        "received_at": "2022-12-30 10:21:14",
        "payload": {
              "randomness": "7c6929685dbd9eb6ae505074e80f9b91eb2a32f15fad935c148f84f679de1822"
        },
        "signature": "3045022100a180999e556d151b5ca978977ca42b1f2aa0f47d38af208887444f971b4a79170220663b3ba622454ed06fb233daf1586ff3de4b1429932a5993d18ac5d11a28219f",
        "is_verified": true
    }
}

Note that the status_name is . This is because the command has not yet been sent to the satellite and is queued for the next visibility window indicated by response_eta.

API in the header
PENDING