In blockchain based applications.
Some activities needs to be authorized by one or more participant that are unknown when the first transaction
is submitted to blockchain.
Sometimes the authority who can authorize a given activity is unknown when the corresponding smart contract
is deployed or the corresponding transaction is submitted to the blockchain.
Blockchain uses digital signature for authentication and transaction authorization.
Blockchain does not support dynamic binding with an address of a participant which is not defined in
the respective transaction or smart contract.
All accounts that can authorize a second transaction have to be defined in the first transaction before
that transaction is added to the blockchain off chain.
Secret enabled Dynamic Patron provides the solution for the same by using a hash created off chain to
dynamically bind authority for a transaction.
There are few forces which led to the creation of off chain secret enabled dynamic patron.
The first one is dynamism, dynamic, binding, one or more unknown authorities with a second transaction
representing an activity after the first transaction submitted to the blockchain was not possible.
Thus off chain secret enabled dynamic patron provides the solution for the same.
The second driving force is the predefined authorities using only on chain mechanism.
All the possible authorities are required to be defined beforehand.
That's why off chain secret enabled dynamic patron came into effect where we can define dynamic authorities.
The solution provided by the off chain secret can be used to enable a dynamic authorization when the
participant authorizing a transaction is unknown beforehand in the context of payment.
For example, a smart contract can be used as an escrow when the sender deposits the money to an escrow
smart contract, a hash of a secret is submitted with the money as well.
Whoever receives the secret off chain can claim the money from the escrow smart contract by revealing
the secret.
With this solution, the receiver of the money does not need to be defined beforehand in the escrow
contract.
This can be generalized to any transaction that needs authorization from a dynamically bounded participant.
The only catch with this solution is that once the secret is revealed, it cannot be reused.
There is one more variant for off chain secret enabled dynamic patron where we lock multiple transactions
with the same secret.
So by unlocking one, we can unlock all the different transactions.
The benefits of such a design pattern is that it provides dynamism.
This pattern enables dynamic binding of unknown authorities after the transaction is added into the
blockchain.
Another benefit provided by this pattern is that it enables lost key tolerance because we don't have
to specify a private key to authorize transaction.
These can be declared dynamically.
Another benefit which we can get with this design pattern is about stability.
This pattern has the useful property that once the secret is revealed, any other transaction secured
using the same secret can also be opened.
This makes it possible to create multiple transactions that are all logged by the same secret.
This property is used by micropayment channels to enable multi-hop transactions where the money hosted
by every hop and secured by a same secret can be released after the end.
Receiver claims the money with the secret.
The secret can be exchanged through a secure off channel.
Another benefit provided by such a pattern is for interoperability.
There is no need for a special protocol to exchange the secret.
The secret can be exchanged in any ways off chain.
It provides a mechanism for other systems to trigger events on blockchain.
There are also drawbacks related to this pattern.
One of the major drawback related to off chain secret enabled dynamic pattern is about one off secret.
The secret used in this pattern is just a one off secret.
Verification of the secret is on chain.
Thus, once a secret is embedded in a transaction submitted to the blockchain, the secret is revealed
for everyone.
Another drawback is related to combination of signature and secret.
Because this pattern has the property that once the secret is revealed, any other transactions secured
using the same secret can also be opened.
Sometimes the transaction protected by the secret should also be associated with the public key so that
both a correct secret and a appropriate signature with the respective private key are required to authorize
the transaction.
This is applicable to the situation where a large set of authorities are known beforehand, but not
all of them are allowed to authorize a certain activity or a transaction.
Thus, a hash secret is used to dynamically bind one or multiple authorities from the larger predefined
set of authorities.
One more drawback related to this design pattern is about lost secret.
The sender of a transaction takes the risk of losing the off chain secret.
If the secret is lost, the transaction cannot be authorized and being proceeded anymore.
In the case of money transfer, the money associated with the transaction would be logged forever if
the transaction cannot be authorized properly.
Some of the known implementations for this pattern is with Raiden Network.
Raiden Network is a network of chain payment channels on top of Ethereum Blockchain Network, which
enables secure value transfer.
The Multi-hop transfer mechanism in Raiden Network uses hash log transactions to securely route payment
through a middleman in the Bitcoin ecosystem.
We also have one more known implementation known as Atomic Cross-chain Trading, which allows one cryptocurrency
to be traded for another cryptocurrency.
For example, tokens on a Bitcoin to a tokens on some kind of sidechain over Bitcoin network.
In this image, you can see the option secret enabled dynamic pattern in action.
On the left hand side, we have on chain activities, which is the blockchain itself.
And on the right hand side we have off chain activities.
In off chain you can see that we have different participants.
The top participant here is locking the transaction and putting it on the blockchain.
This lock is provided through a secret key which is kept with the participant.
Now the other participants who receives the secret key from the topmost participant can open the transaction
and see the different data or information shared to them.
The opening of the transaction by other users is done by using the shared key, which is given by the
topmost user, and this is also submitted as a transaction over the blockchain.
So once they open any transaction given to them through a shared key, then that shared key or the secret
key is now available over the blockchain.
The next pattern under security is X confirmation pattern.
Now let's go and see the details about X confirmation pattern.