Stellar SEP 24 Protocol for Interactions Between Anchors and Wallets

Posted By : Harshit

May 27, 2020

Introduction

 

SEP 24 defines the protocol for anchor and wallet to interact. It improves the user experience by enabling clients to interact with an anchor directly through a wallet. It supports interactive flow. It defines protocols for features like deposit, withdrawal, transaction status, history, KYC, etc. The location of an anchor must be defined in the toml file and anchor, as well as the client must support SEP 10 authentication for withdraws, deposit, and transaction history. The client must submit the token in all API calls except /info endpoint and token must include in headers. CORS must be enabled on the server for the API calls.

 

Deposit

 

It is a process when a user wants to send assets to another user on the anchor. This endpoint allows the wallet to get information regarding the deposit from the anchor. If the given user account does not exist on the deposit side then the anchor has to use create_account to create the new account with the minimum XLMs. If the anchor doesn't have the endpoint create_account then it must return a bad request error with the reason for the failure of the transaction.

 

Withdraw

 

This is the operation to redeem an asset on the stellar network for the real asset by a stellar anchor. The endpoint allows the wallet to get withdrawl information from the anchor to initiate the withdrawal. There are many kinds of responses that depend on the need of user information by the anchor.

 

Following is the flow for deposit and withdraw transactions.

 

Info

 

 This endpoint enables the anchor to communicate for the basic information of a user. It contains 3 parameters, one is the deposit, one for withdrawl, and one flag for fee. Deposit includes the assets and its details like fee, fee per cent, min amount, max amount and a flag to check that particular operation is enabled or not. Another one is withdrawl, it also includes the details of assets and a flag to check that particular operation is enabled on it or not. The third is fee, if the asset details consist of fee_fixed and fee_percentage then fee can be calculated by (amount*fee_percent) + fee_fixed otherwise fee can be got by /fee endpoint.

 

Fee

 

This endpoint provides the fee which has to be applied on deposit and withdraw functionality. Fee can be calculated for particular assets but the fields like fee_fixed, fee_percent and fee_minimum which are present in the /info endpoint. The endpoint throws the error if the asset is not registered on the anchor like{"˜error':'This anchor does not support the given currency code: ETH'}.

 

Transaction history

 

This endpoint (/transactions) provides the history of past deposit or withdrawal transactions. It provides the history of transactions that are done from the same anchor. It requires valid JWT in request to get the history. It provides an array of transactions and each transaction includes the details like id, kind, status, amount_in, started_at, stellar_transaction_id etc. Some fields are differentiated like in deposit transaction response some fields are included like deposit_memo, deposit_memo_type, from, to, etc and in withdraw transaction, withdraw_anchor_account, withdraw_memo, to, from etc. fields are included.

 

Changes from SEP 6

 

  1. It requires authentication on all of the endpoints.
  2. Change of request type from GET to POST for withdrawl and deposit for security reasons.
  3. Now account details are pulled from JWT token
  4. Transaction properties are now optional.
  5. Removed unnecessary fields from /info endpoint.
  6. Removed the type parameter from the deposit and withdrawl endpoints.

 

Conclusion

 

In this blog, we learned about SEP 24 stellar protocol. It explains the flow of withdraw and deposit. It also explains the usage of fee and help ton understand the changes from SEP 6.

 

Reference

Official document - https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0024.md

 

Leave a

Comment

Name is required

Invalid Name

Comment is required

Recaptcha is required.

blog-detail

November 18, 2024 at 01:43 pm

Your comment is awaiting moderation.

By using this site, you allow our use of cookies. For more information on the cookies we use and how to delete or block them, please read our cookie notice.

Chat with Us
Telegram Button
Youtube Button

Contact Us

Oodles | Blockchain Development Company

Name is required

Please enter a valid Name

Please enter a valid Phone Number

Please remove URL from text