⚠️ Note: This function is not yet implemented.

The withdrawTokens function allows you to move your tokens from Spark back to Bitcoin L1. This is useful for users who want to exit the Layer 2 network or need to interact with other Bitcoin L1 services.

Example

await withdrawTokens(
  "03e9cd9c3077c97457d44b1eb8f88bb95186c855bfffa247a5404b5bd8cd46229a", // receiverL1PublicKey
  1000000n // amount
);

Returns

Promise<string>; // L1 Transaction ID

Important Considerations

  • Always verify the Bitcoin L1 address is correct
  • Withdrawal to L1 requires a pre-funded L1 wallet
  • Withdrawal requires posting of a bond which can be reclaimed after a locking period.
  • Transfers to L1 require confirmation time (typically 1-2 Bitcoin blocks)
  • Keep track of your transfer IDs for status monitoring
  • Make sure you have enough Bitcoin to cover L1 transaction fees

Implementation Status

This function is currently not available in the SDK. It will be coming soon.

Conclusion

Congratulations! You’ve completed the Quick Start guide for token issuance on Spark. For more information, check out the API Reference or FAQ.