Anchoring¶
One of the main ideas behind private blockchain is that transactions are processed by a certain number of participants known in advance. In a private blockchain there is a threat of information spoofing, because the number of participants is quite small if we compare it to the public blockchain where there are no restrictions to join the network. When using PoS consensus algorithm, the threat of overwriting a blockchain becomes real.
To increase the confidence of the private blockchain participants in data placed there, the anchoring mechanism was developed. Anchoring allows checking the data for invariability. The guarantee of invariability is achieved by publishing data from a private blockchain to a larger network, where data spoofing is unlikely due to a larger number of participants and blocks. Published data represent a signature and a height of blocks in a private network. Mutual connectivity of two or more networks increases their resistance, because as a result of a long-range attack as forgery or alteration of data resulting from a long-range attack would require attacking all connected networks.
How does anchoring work in the Waves Enterprise blockchain¶
Anchoring process is shown below:
Anchoring configurations are set in the configuration file of the private blockchain node. You should use recommended values for the configurations to avoid anchoring malfunctioning.
Each
height-range
an anchoring transaction, that contains data of the block atcurrent-height - threshold
, is broadcasted to the Mainnet by the anchoring node. The Data Transaction with akey-value
list is used as an anchoring transaction. The node then requests height of the broadcasted transaction.The node then checks the Mainnet height each 30 seconds until its height reaches the height of the created transaction +
height-above
.When required height is reached and the presence of previously created data transaction is confirmed, another anchoring data transaction is created in the private blockchain.
Transaction structure for anchoring¶
Mainnet transaction consists of the following fields:
height
- the height of the chosen block from the private blockchain.signature
- the signature of the chosen block from the private blockchain.
The private blockchain transaction consists of the following fields:
height
- the height of the chosen block from the private blockchain.signature
- the signature of the chosen block from the private blockchain.mainnet-tx-id
- the Mainnet anchoring transaction ID.mainnet-tx-timestamp
- the timestamp of the Mainnet anchoring transaction.
Errors during the anchoring¶
Errors during the anchoring can occur at any step. In case of any error in the private blockchain the Data Transaction containing the error code and the description is always published. The error transaction includes the following data:
height
- the height of the chosen block from the private blockchain.signature
- the signature of the chosen block from the private blockchain.error-code
- the error code.error-message
- the error message.
Code |
Message |
Possible cause |
---|---|---|
0 |
|
An unknown error occurred during the send of the transaction to the Mainnet |
1 |
|
Creating of the transaction to be sent to the Mainnet failed |
2 |
|
The transaction publication to the Mainnet failed (it could be a JSON request error) |
3 |
|
The Mainnet has returned an HTTP code other than 200 after the transaction publication |
4 |
|
The Mainnet has returned an unknown JSON after the transaction publication |
5 |
|
The Mainnet has returned mismatched ID after the transaction publication |
6 |
|
The Mainnet has not responded to the request about the transaction info |
7 |
|
Failed to get current Mainnet height |
8 |
|
The anchoring transaction has disappeared from the Mainnet after its height evened |
9 |
|
Fail to public the anchoring transaction in the private blockchain |
10 |
|
Anchored transaction in sidechain was changed during mainnet height arise await, looks like a rollback has happened |