Understanding Stellar Operations by Users in a Stellar Blockchain

Understanding Stellar Operations by Users in a Stellar Blockchain

Posted By : Harshit Sharma | 28-Jul-2020

Introduction
Every transaction in the stellar network is the combination of operations that are initiated by the user. Each operation works as a single command which modifies the ledger. Some operations are creating accounts, payment, allow trust, etc. Every operation has its own threshold which is categorized into 3 categories: low, medium, and high. Allow trust and BumpSequence fall under the low threshold and AccountMerge and setOptions fall under the high threshold, the rest of the operations fall under the medium threshold.


Validity of operation
 

When a transaction is submitted to the network by performing some operations, the node checks the validity of the transaction to which it gets submitted for every operation before including the transaction into the transaction set. The following are the conditions to check the validity of the operation.

 

  1. Signature on the transaction which includes signature must be signed by a valid source account of operation and combine weight or signature meet the threshold for the operation.
  2. The parameter for the operation must be valid. Like the amount must not be negative.
  3. The operation must be valid for the current protocol version of the network.

 

Operations

 

  1. Create an account

    The operation createAccount creates a new account of the user and provides the specific starting balance. The operation is of medium threshold

    Parameters

     

Destination

The address of the account that is created and funded

Starting Balance

The initial amount for the account

 

There are some cases of possible errors like CREATE_ACCOUNT_MALFORMED and it occurs when the destination is invalid and the other one is CREATE_ACCOUNT_LOW_RESERVE this occurs when source account has low XLMs.


 

  1. Payment

    This operation is used to send an amount to a specific destination of a specific asset. This operation is of the medium threshold.

    Parameters


     

Destination

Account address of the receiver

Asset

Name of asset that has to send to the destination

Amount

Amount of asset to send


Some cases of possible errors are like PAYMENT_MALFORMED which occurs when the amount is invalid, PAYMENT_SRC_NO_TRUST  occurs when the source account does not have trust line the issuer, PAYMENT_NO_ISSUER occurs when the issuer of the asset does not exist. 


 

  1. Change trust

    This operation is to create, update, and delete trusting for the issuer of the asset. This operation is of the medium threshold. The way to delete an existing trust line is to set the limit =0.

    Parameters


     

Line

The asset of the trust line. Ex USD:anchor

Limit

The limit of the trustline


Some cases of possible error are like CHANGE_TRUST_MALFORMED which occurs when an input of any parameter is invalid. CHANGE_TRUST_LOW_RESERVE occurs when the source account is low on XLMs. CHANGE_TRUST_NO_ISSUER occurs when the issuer of the asset cannot be found. 

 

Result

Each of the operations has its own result type. In success result allows the user to gather the information about the effect of the operation

 

  1. Exchange without third party

    A user wants to exchange some XLM for BTC. the flow of the operation will be as follows.


    Operation 1 requires the signature from the user’s account to meet the threshold for operation of payment and operation 2 requires the signature for the bridge account. Both user and bridge accounts have to validate the transaction.


     
  2. Workers

    The anchor will divide the processing of the base account among several machines. Each machine has its own key pair values.


    Operation 1 requires the signature from the base account and machine 2 signs the transaction to meet the threshold.

     
  3. Long-lived transaction

 It requires multiple parties to sign the transaction between users and the bridge.



Operation 1 requires the signature from the user’s account and operation 2 requires the signature from the bridge account to meet the threshold for the operation of payment. The additional benefit of the sequence number for the user’s temp account allows the user to continue to perform operations.

 

Conclusion

 

In this blog, we learned about the operations that can be performed by the user on the anchor. The flow of every operation and the architecture of the operations and the type of transactions as well.

 

Reference

 

For official document - https://www.stellar.org/developers/guides/concepts/operations.html

 

About Author

loading
Harshit Sharma

He is a MEAN Stack Developer with problem solving attitude. He is efficient in API Development and always ready to learn new technologies in Web Development.

Leave a Comment

Name is required

Comment is required

Recaptcha is required.

No Comments Yet.

    Request For Proposal

    Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.

    We would love to hear from you!

    Oodles | Blockchain Development Company

    Please enter a valid Phone Number

    Please remove URL from text

    Recaptcha is required.