Example Python applications are available at the Blockstream Satellite examples directory as a reference regarding how to implement the interaction with the API. There is one application specifically for sending data to the API, called “API data sender”, and another application for reading the API data acquired by the Blockstream Satellite receiver, called “API data reader”. Additionally, there is one application that allows testing API data reception directly through the internet, without the actual satellite receiver hardware, called “demo receiver”. Refer to the documentation in the given link.
Each call to an API endpoint responds with a JSON object, whether the call is successful or results in an error.
The code samples below assume that you’ve set
SATELLITE_API in your shell to the public base URL of your server.
Place an order for a message transmission. The body of the POST must provide a
file containing the message and a
bid in millisatoshis. If the bid is below an allowed minimum millisatoshis per byte, an error is returned.
For example, to place an order to transmit the file
hello_world.png with an initial bid of 10,000 millisatoshi, issue an HTTP POST request like this:
curl -F "bid=10000" -F "file=@/path/to/upload/file/hello_world.png" $SATELLITE_API/order
If successful, the response includes the JSON Lightning invoice as returned by Lightning Charge’s POST /invoice and an authentication token that can be used to modify the order. Within the metadata of the Lightning invoice, metadata is included providing: the bid (in millisatoshis), the SHA256 digest of the uploaded message file, and a UUID for the order.