Elastos Mainchain Docking
Setup Tools
- Elastos Node - Install the node
- Configuration File - Place in the directory of ELA node and change the file name to config.json
- Transaction utility - Create and sign transactions
- RPC Interface- Get blocks and transactions and send raw transactions
- ELA-CLI - Command-line tool used for testing
Data synchronization and storage
Use the node’s RPC interface to synchronize blocks and transactions, then save all the received information. This process requires dealing with temporary fork blocks - if the blocks acquired by the height can't be connected with the local stored best chain, the highest local block should be regained until they're connected. The original block with the same height will be discarded.
Recharge
To prevent the issue of temporary forking, it's recommended that more than 16 confirmations be considered as available transactions. Coin Withdraw. The exchange maintains the UTXO set of every address to generate the currency transaction. The withdrawal transaction can be generated by the transaction utility.
ELA Locking Transaction Recognition
UTXO Lock
The UTXO lock is similar to CLTV of Bitcoin (Check Lock Time Verify), which is a more flexible timing lock that locks one or more outputs during a transaction. The UTXO Lock adds a field to the output structure of the transaction. The OutputLock and LockTime are used in combination to only lock UTXO but not the transaction itself.
After the sender creates a transaction, UTXO will be locked by setting OutputLock to a certain height in the future - this means that UTXO can be spent only after the height of the block reaches the OutputLock limit.
When the recipient creates a transaction that costs UTXO (which includes OutputLock) the LockTime will need to be set to a higher value than OutputLock to spend the UTXO. This forces the recipient to create a transaction with a transaction lock in order to spend the UTXO locked by the UTXO lock, which limits the time spending the UTXO.
Verification of the UTXO Lock
To determine whether all inputs referred to UTXO, which includes the UTXO LOCK, (OutputLock>0). If there are no references, return true;
Judge whether the sequence that referred to the UTXO Lock's input is equal to 0xfffffffe; if it's not equal, return to false;
Determine whether the TimeLock of the transaction is greater than the value of all UTXO OutputLock; if it's not greater, return false;
Return true after passing validation.