AnteHash2

Ante
4 min readSep 18, 2023

--

AnteHash is a tool that was developed to allow anybody to easily hash a message via SHA-256 hashing. AnteHash2’s relayer allows a user to place a message onchain via a signature and at no gas cost to the user! Combined, this creates AnteHash2, allowing hashed messages or secrets to be stored onchain, being able now to take advantage of the permanent nature of the blockchain.

Hashing in AnteHash

Let’s briefly cover hashing first, the fundamental function of AnteHash. Hashing is a technique in where an input is taken and transformed to an output that is unique and unable to be reverted back to it’s original input. Using SHA-256, this output is always 256 bits long, no matter what length the original input was. This allows a separate user or application to verify an in input without needing to know the input itself. Which is great when we don’t want to have that input revealed as it’s a secret!

However, as nothing in this world is perfect, hashing does rely on a few assumptions:

  1. The hashing function is irreversible or one-way. This means that we can’t reverse the function and go from the output hash back to the original input. This defeats the purpose of having the output being able to completely obscure the original input as to not reveal it.
  2. Two different inputs don’t produce the same hashed output. Hashing relies on the fact that all outputs are unique, so to always have a 1:1 relation between outputs and inputs. And since our interactions assume that if you have the correct hashed output, you know the correct input. If a different input creates the same hashed output, than we would assume you know the “correct” input. If 2 inputs were proven to have the same output, than it would defeat the purpose of having a unique output for each unique input.
  3. In line of the previous point, there’s still a limited number of possible outputs in SHA-256 (2²⁵⁶ or ~1.15x10⁷⁷), it’s reasonable to use brute force and attempt every different hash to find the correct output. Hashing algorithms like SHA-256 is considered secure because the amount of time needed using all the computing power currently available in the world is too long to be reasonable to crack the hash. However, this can change with increases in computing power where that reduces the time and cost of such an attack to move into a reasonable range.

AnteHash2 Relayer

Now that hashing is complete, we can explore the relayer of AnteHash2. The AnteHash2 relayer takes a message and automatically “places” it onchain via a Merkle Patricia trie (MPT). It doesn’t actually place it completely onchain, but rather it takes the root hash of the MPT to put it onchain. How that works is that every X amount of time, the relayer takes all commitments and creates it’s MPT, once created, it generates the root hash of the MPT and compares that to the root has that’s been stored onchain. If the hashes are the same, than there has been no changes in the commitments. If the hashes are different, than the relayer places the new root hash of the MPT onchain.

Placing a new element to the chain produces a different root hash.

With these features, AnteHash2 is able to place any message onchain at no cost of gas to the user. It is able to compactly condense the messages to a MPT and just use the root hash to check to see if there’s any differences or new messages. This allows the relayer to take a past message and generate a proof that proves if the message was placed on the chain.

Potential future applications

Our previous Ante webapp relies on a user or protocol writing a smart contract to place a commitment onchain. The new functionality of the relayer allows for a broader array of Antes that aren’t just smart contracts to be placed onchain!

These completed commitments can then also be placed and proved in the future. It allows for a record of evidence that’s forever able to be referenced onchain and interacted with, not subject to a centralized source’s manipulation.

Using the fact that we can prove these past commitments existed onchain, than there’s a world of possibilities that can open up and be built upon. AnteUP is a small demonstration of what can be done using these kinds of proofs!

Conclusion

The launch and work on AnteHash2 really shows an expansion in the work around commitments and placing traceable commitments onchain. We can’t wait to see what this builds into and what gets built on top of this functionality. The possibilities here are vast!

Follow Ante on Twitter and come visit our Discord to discuss these ideas with us!

--

--

Ante
Ante

Written by Ante

Building a Smart Tests Community for @AnteFinance

No responses yet