The Elephant CLI now supports submitting data through a centralized API as an alternative to direct blockchain submission. This mode is useful when you want to delegate transaction signing to a centralized service.
In API submission mode, the CLI:
- Generates unsigned transactions locally
- Submits them to the centralized API
- Waits for the API to sign and broadcast the transactions
- Monitors transaction confirmation on the blockchain
- Reports the final status
To use API submission mode, provide these three parameters together:
elephant-cli submit-to-contract <csv-file> \
--domain oracles.staircaseapi.com \
--api-key YOUR_API_KEY \
--oracle-key-id YOUR_ORACLE_KEY_ID \
--from-address 0xYOUR_ADDRESS--domain: The API domain (e.g.,oracles.staircaseapi.com)--api-key: Your API authentication key--oracle-key-id: Your oracle key identifier
--from-address: The address to use as the transaction sender (defaults to zero address if not provided)--gas-price: Gas price in Gwei or 'auto' (default: 30)--dry-run: Test mode without actually submitting transactions--transaction-ids-csv: Output CSV file for transaction IDs (default: transaction-ids-{timestamp}.csv)
- No Private Key: When using API mode, you must NOT provide a private key. The API handles transaction signing.
- All Three Required: You must provide all three API parameters (
--domain,--api-key,--oracle-key-id) together. - HTTPS Only: The domain is automatically upgraded to HTTPS for security.
# Submit data via API
elephant-cli submit-to-contract ./results.csv \
--domain oracles.staircaseapi.com \
--api-key abc123def456 \
--oracle-key-id 550e8400-e29b-41d4-a716-446655440000 \
--from-address 0x1234567890123456789012345678901234567890 \
--gas-price auto
# Dry run to test without submitting
elephant-cli submit-to-contract ./results.csv \
--domain oracles.staircaseapi.com \
--api-key abc123def456 \
--oracle-key-id 550e8400-e29b-41d4-a716-446655440000 \
--dry-runThe command generates two CSV files:
Contains detailed status information:
- Batch index
- Transaction hash
- Status (pending/success/failed)
- Block number
- Gas used
- Item count
- Error message (if any)
- Timestamp
Contains simplified transaction tracking:
- Transaction hash
- Batch index
- Item count
- Timestamp
- Status
Default filename: transaction-ids-{timestamp}.csv (or specify with --transaction-ids-csv)
When submitting less than 5 transactions, the transaction IDs are also displayed in the console for quick reference.
The CLI sends POST requests to:
https://{domain}/oracles/submit-data
With headers:
x-api-key: YOUR_API_KEYContent-Type: application/json
Request body:
{
"oracle_key_id": "YOUR_ORACLE_KEY_ID",
"unsigned_transaction": [
{
"from": "0x...",
"to": "0x...",
"gas": "0x...",
"value": "0x0",
"data": "0x...",
"nonce": "0x...",
"type": "0x2",
"maxFeePerGas": "0x...",
"maxPriorityFeePerGas": "0x..."
}
]
}Response:
{
"transaction_hash": "0x..."
}- Network errors are retried up to 3 times with exponential backoff
- API errors (4xx, 5xx) are not retried and fail immediately
- Transaction confirmation timeout is 5 minutes by default
- All errors are logged to the transaction status CSV
- API Key Protection: Never commit your API key to version control
- HTTPS Enforcement: All API calls use HTTPS
- No Private Keys: Private keys are never sent to the API
- Input Validation: All parameters are validated before use