Using Figment's Babylon APIs: Key Highlights
When interacting with Figment's Babylon APIs, keep these key points in mind as you review the API specifications:
- Creating a Stake
- Generate an Unsigned PSBT:
- Use POST /babylon/stakes to create an unsigned PSBT for staking BTC.
- Sign and broadcast the PSBT using any preferred provider.
- Upon successful request, you'll receive a stake_id (UUID) for use in future requests.
- Notify Figment of the Staking Transaction:
- Use PUT /babylon/stakes to provide Figment with the tx_id of the staking transaction.
- The tx_id is essential for Figment to link the Babylon stake broadcasted in the previous step.
- Unbonding (Optional for Early Withdrawal)
- Request an Unsigned PSBT:
- Use POST /babylon/unbond to get an unsigned PSBT for unbonding staked BTC.
- Only sign this PSBT; Figment will handle broadcasting it once Babylon's covenant verifies the inputs.
- Submit the Signed PSBT:
- Use PUT /babylon/unbond to send the signed PSBT to Figment.
- Figment will broadcast the transaction and return the resulting tx_id.
- Withdraw
- Generate a Withdrawal PSBT:
- Use POST /babylon/withdraw to create an unsigned PSBT for withdrawal.
- Sign and broadcast this PSBT using any provider of your choice.
- Optional: Inform Figment of the Withdrawal Transaction:
- Use PUT /babylon/withdraw to provide the tx_id of the withdrawal transaction.
- This step is optional but ensures Figment syncs the stake's state with Babylon.