Public blockchains

An assertion of ownership of the code can be a transaction, which is secured as follows:

Multiple transactions are grouped in a block.
Cryptographic hash functions are used for creating the hash of one block. The next block stores this hash value along with its’ transactions. This pattern continues as new data is added.
Even a minor change to the data in any one block will produce a completely different hash.
If someone tries to change a block, he or she will need to change all subsequent blocks. This is impractical since it requires a very high amount of computing power.
Public blockchains are transparent. Anyone trying to modify so many existing blocks will also attract the attention of other nodes on the network that will then resist this change.
The consensus algorithm comes into the picture when creating a new block. Users need to perform computing power-intensive operations to solve complex mathematical puzzles.
This is in a competitive ecosystem. Hackers need to manipulate the majority of the participants to compromise the network. That’s quite impractical. Read more about it in “Proof of work vs proof of stake comparison”.
These blockchain security measures protect the transaction against tampering.