Transaction
Last updated
Last updated
Each data record written to the blockchain (whether it is an asset creation, one of the spark operations, supply creation and update or any other transaction type) is a blockchain transaction. Writing data to the blockchain requires a valid signature to call functions of a smart contract. The data is entered into the blockchain in intervals known as blocks. Each block is time stamped and its order and transactions are verified.
It takes 5 steps to process each transaction in the TEOS Platform.
The transaction is created for every action which requires data writing to the blockchain. Mind the difference: for example, retrieving the asset and its details involves only reading data from the blockchain, but creating a new asset requires writing to the blockchain. So, the transaction will be created only in the second case. Transaction creation is triggered when TEOS Platform receives the corresponding request from frontend or mobile apps (WLA, WLM, WLP, NOTRZR APP/WEB), third-party APIs (NOTRZR API) or via directly TEOS API call. Either way, the transaction parameters are passed to the TEOS Platform. The parameters must include the signer address (public address of the wallet that is going to sign the transaction).
When TEOS API receives the request, it processes the request data and prepares the blockchain transaction which is ready for signing.
Parameters of the transaction including the TEOS Platform transaction id, which must be signed, are returned as the response of the corresponding TEOS API call.
Transaction parameters ready for signing can be retrieved later from the TEOS API or third party backend integrated with TEOS Platform (for example, Notardec API) using corresponding function by providing transaction id.
Or in case of direct integration with TxServer (TEOS Platform technical component responsible for the transactions processing) all transactions ready for singing can be retrieved from TxServer by authorized devices for signer address.
A device that holds the private key for the provided signer address receives the prepared transaction (by any mean described in the previous step). There can be many devices holding the same private key. The signature must be prepared using the private key.
Signing transaction is a process of creating signature using transaction data and private keys of the signing address. Signature can be prepared by any TEOS platform component with UI which has wallet and transaction management functionality (WLA, TX.Mobile), a tool for signing transactions automatically, a third party tool which has signing functionality (NOTRZR) and any TEOS API consumer which will introduce corresponding functionality. There are libraries and utilities which are available for widely used code languages, you can check the code of Autosigner, auto signing utility in C# provided by CoreLedger, as an example (ask your CoreLedger manager for the access if you don't have one).
Depending on the use case and the signing software, various security checks may be applied before signing in order to determine the authenticity of the transaction and device owner.
Transaction must be signed and submitted to the TEOS platform for further confirmation or rejecting. Transaction can be submitted to the TEOS API using corresponding endpoint, via third party API or directly to the TxServer in case of direct integration with the technical component responsible for the transactions processing.
The signed transaction is validated and sent to the blockchain by TEOS Platform technical component responsible for transaction processing.
The status of the transaction can be retrieved from TEOS Platform using corresponding functions of the TEOS API or third-party API and will change according to the status model described in Transaction states.
It is not necessary that the device which creates a transaction (1) and the device that signs a transaction (3) are one and the same device. They can be different devices authorized to use the specific wallet's private keys. Monitoring the transaction status after the submission (5) can be done by any TEOS Platform consumer authorized to retrieve tenant data.
Check the detailed flow of creating and submitting transactions with TEOS API in Transaction creation and submission
TypeId | Transaction type |
---|---|
1 | Activate asset |
2 | Create sparks |
3 | Destroy sparks |
4 | Transfer sparks |
10 | Execute warp |
38 | Add asset link |
39 | Delete asset link |
43 | Add asset links |
44 | Delete asset links |
State | Description |
---|---|
Received | Transaction is created with the state Received, at this moment it is not written to blockchain yet, it has only TxId provided by the TEOS Platform (by the technical component responsible for the transaction processing) |
Submitted | Transaction is Submitted when it was signed with the private key and submitted to the TEOS Platform via TEOS API or directly to the TxServer (the technical component responsible for the transaction processing) |
Revoked by user | Transaction can be rejected by its initiator instead of signing then transaction gets state Revoked by user |
Revoked by TxServer | Transaction can be rejected by the technical component responsible for the transaction processing when submitting or committing due to some reasons. For example, if some business checks failed (signing address doesn't have enough sparks to transfer) or signing address doesn't have enough ETH necessary for writing transaction to blockchain |
Committed | Transaction is Committed when it passed all checks performed by the technical component responsible for the transaction processing and was successfully written to blockchain according to the blockchain api response |
Revoked by Blockchain | Transaction can be rejected by blockchain when the technical component responsible for the transaction processing is trying to make a record in the blockchain |
Confirmed | Transaction is Confirmed when the technical component responsible for the transaction processing has successfully read the transaction from blockchain after some blocks have passed to make sure it was written |