Please enable JavaScript.
Coggle requires JavaScript to display documents.
stellar concepts - Transactions [事务] (attributes [属性] (Memo [备忘录] (MEMO…
stellar concepts - Transactions [事务]
attributes [属性]
Source account [源账户]
This is the account that originates the transaction.
Fee [费用]
Each transaction sets a fee that is paid by the source account.
Sequence number [序列号]
Transactions follow a strict ordering rule when it comes to processing of transactions per account.
List of operations [操作列表]
Transactions contain an arbitrary list of operations inside them.
List of signatures [签名列表]
Up to 20 signatures can be attached to a transaction.
Memo [备忘录]
MEMO_TEXT: A string encoded using either ASCII or UTF-8, up to 28-bytes long.
MEMO_ID: A 64 bit unsigned integer.
MEMO_HASH: A 32 byte hash.
MEMO_RETURN: A 32 byte hash intended to be interpreted as the hash of the transaction the sender is refunding.
Time bounds [时间范围]
optional
. The UNIX timestamp (in seconds), determined by ledger time, of a lower and upper bound of when this transaction will be valid.
Transaction sets [属性集]
When it is time to close the next ledger, the nodes collect these transactions into a transaction set.
Life cycle [生命周期]
1. Creation [创建]
The user creates a transaction, fills out all the fields, gives it the correct sequence number, adds whatever operations it wants, etc.
Try it with js-stellar-sdk.
2. Signing [签名]
Once the transaction is filled out, all the needed signatures must be collected and added to the transaction envelope.
Commonly it’s just the signature of the account doing the transaction, but more complicated setups can require collecting signatures from multiple parties.
3. Submitting [提交]
After signing, the transaction should be valid and can now be submitted to the Stellar network.
Transactions are typically submitted using horizon, but you can also submit the transaction directly to an instance of stellar-core.
4. Propagating [传播]
Once stellar-core receives a transaction, either given to it by a user or another stellar-core, it does preliminary checks to see if the transaction is valid.
Among other checks, it makes sure that the transaction is correctly formed and the source account has enough to cover the transaction fee.
Stellar-core doesn’t check things that require inspecting the state of the ledger beyond looking up the source account—e.g., that the destination account to which the transaction is trying to send exists, that the account has enough of this asset to sell, that it’s a valid path.
If the preliminary checks pass, then stellar-core propagates the transaction to all the other servers to which it’s connected. In this way, a valid transaction is flooded to the whole Stellar network.
5. Including in a transaction set [包含于TxSet中]
When it’s time to close the ledger, stellar-core takes all the transactions it has heard about since last ledger close and collects them into a transaction set.
If it hears about any incoming transactions now, it puts them aside for next ledger close. Stellar-core nominates the transaction set it has collected.
SCP resolves the differences between the various transaction sets proposed and decides on the one transaction set that the network will apply.
6. Application [应用]
Once SCP agrees on a particular transaction set, that set is applied to the ledger. At this point, a fee is taken from the source account for every transaction in that set.
Operations are attempted in the order they occur in the transaction.
If any operation fails, the whole transaction fails, and the effects of previous operations in that transaction are rolled back.
After all the transactions in the set are applied, a new ledger is created and the process starts over.
Possible Errors [可能的错误]
FAILED
Ledger closeTime
TOO_EARLY
TOO_LATE
MISSING_OPERATION
BAD_SEQ
Fee
INSUFFICIENT_BALANCE
INSUFFICIENT_FEE
signatures
BAD_AUTH
BAD_AUTH_EXTRA
INTERNAL_ERROR
:pen:
Among other things, Transactions are used to send payments, enter orders into the distributed exchange, change settings on accounts, and authorize another account to hold your currency.
Transactions are commands that modify the ledger state.
If you think of the ledger as a database, then transactions are SQL commands.