This document describes the REST API endpoints provided by PiDualTx backend services:
- AI Service: Price prediction using LSTM model.
- Rate Service: Internal and external Pi price data.
- Smartcontract Service: Blockchain transaction operations.
Predict the future Pi price based on historical data.
- Content-Type:
application/json - Body:
{ "historical_prices": [0.80, 0.81, 0.82, 0.83, 0.84], "sequence_length": 5 }
- Status:
200 OK - Body:
{ "predicted_price": 0.8423, "confidence": 0.95 }
400 Bad Request: Input validation failure.500 Internal Server Error: Prediction failed.
Retrieve current Pi price rates.
- Status:
200 OK - Body:
{ "internalRate": "314159", "externalRate": "0.8152", "timestamp": 1680000000 }
Execute a transaction via the PiDualTx smart contract.
- Content-Type:
application/json - Body:
{ "user": "User Address...", // User address starting with 'G' "merchant": "MerchantAddress...", // Merchant address starting with 'G' "amount": "1000000000000000000", // Amount in wei "paymentType": "internal", // or "external" "autoConvert": true }
- Status:
200 OK - Body:
{ "transactionHash": "0xabc123...", "status": true }
400 Bad Request: Invalid input.500 Internal Server Error: Transaction failed.
Retrieve transaction history for a specified user address.
- Status:
200 OK - Body:
[ { "user": "User Address...", // User address starting with 'G' "merchant": "MerchantAddress...", // Merchant address starting with 'G' "amount": 1000000000000000000, "paymentType": "internal", "autoConvert": true, "timestamp": 1680000123 }, { "user": "User Address...", // User address starting with 'G' "merchant": "AnotherMerchant...", // Merchant address starting with 'G' "amount": 500000000000000000, "paymentType": "external", "autoConvert": false, "timestamp": 1680000456 } ]
- All timestamps are Unix epoch seconds (UTC).
- Amounts are in wei (1 pi = 10^18 wei).
- Payment type is either
"internal"or"external". - Make sure to connect to the services via the API gateway or use their Kubernetes cluster IPs as configured.
This document is subject to update as the PiDualTx platform evolves.