0

Ripple allows to chain transactions of the same account via the AccountTxnId flag. (see https://developers.ripple.com/transaction-common-fields.html#accounttxnid) Is this also possible with Stellar?

3

Stellar implementation of the operations sequences is simpler and much more robust. The transaction itself is more like a container which can hold up to 100 operations (payment, manageOffer, change settings etc). Therefore you can, for example, create a new account, set its options, create a trustline, and send some tokens in a single atomic transaction. Operations are executed strictly in order. It works the same way as a transaction in a database, either all operations are applied or all of them fail.

The strict transactions execution order is also enforced by Sequence number.

Each transaction has a sequence number. Transactions follow a strict ordering rule when it comes to processing of transactions per account. For the transaction to be valid, the sequence number must be 1 greater than the sequence number stored in the source account entry when the transaction is applied. As the transaction is applied, the source account’s stored sequence number is incremented by 1 before applying operations.

So you just cannot submit transactions in the wrong order, or accidentally submit the same transaction twice. Such behavior also effectively prevents replay attacks.

  • I know this. Still I have a use case, where a check on the order of transactions would be desired. Suppose I want someone to sign a transaction for me offline (i.e. without querying the ledger), and proof for validity of the to-be-signed transaction lies in the previous transaction of this account, which I give to the signer. Then if the last transaction appears to be valid for the signer, it could add its hash to the new tx and it would only be accepted into the ledger, if the previous transaction actually made it to the ledger. – lorrrris Jan 22 at 10:16
  • Well, Stellar doesn't have the concept of the "previous tx" reference, and I doubt that it would be implemented in the nearest future. The sequence number is not a full analogy, but you still can use it for your case. You just check current sequence of the source account, and you can tell if the previous transaction has made it to the ledger. The second tx will be rejected if the first tx failed, as the second tx sequence will be considered invalid (tx 1 failed and source account sequence hasn't been changed). – Orbit Lens Jan 22 at 10:38
  • This wouldn't work, because by sequence number, just any transaction could have been previously sent to the ledger. The signer wants to be secure (without connecting to the blockchain), that the transaction he signs is only valid if exactly the transaction he references was sent to the ledger previously. I do understand, that this is a very special use case though. – lorrrris Jan 22 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.