The Reveal — a technical perspective
Hey Everyone,
We are happy to see the Original Block Collection live on the market. Everything seems to be going smoothly, opensea displays all the pieces correctly, people start to correctly identify their art and some transactions on the open market are beginning to take place. All very encouraging.
We took half a day off to recharge after yesterday’s launch and now we are back with a couple of updates. The first one is a technical one from our devs.
TL;DR: on a technical level, the reveal went smoothly and you always had your art from the first second. There were never — and there will never — be any changes to that. Read on to learn more.
A bit more about that. We have seen some confusion in the community caused by the frontend bug described in the previous article, which caused people to see different artworks in their My Collection section on the website (where, for a brief moment after launch, they saw incorrect pieces) and opensea (where they saw the correct pieces all along). The confusion is understandable, especially from the non-technical people, so we thought it would be a good idea to take a step by step journey to explain the process and why your artwork has always been yours.
What exactly happened during reveal process
We started a day before with minting all of the unsold tokens, which took some time (and tons of ETH), since we could mint only 50 pieces in a block in order to meet gas limits. A little bit of math:
- 8,893 total pieces — 3,201 sold = 5,692 to mint
- 5,692 pieces / 50 per block = 114 transactions
- Approx. 120,000 gas required to mint one token
- 50 pieces * 120,000 gas = 6,000,000 gas per transaction (block)
- Average gas price ~180
- Total cost = 114 transactions * (6,000,000 gas * 0.00000018 price) = 123.12 ETH
Minting started at that block:
https://etherscan.io/tx/0xa9a0e33a2298cc03027d57b4820c6d9bc8e41f56635c3b2d6bdce0da38cf0ff1
Moving forward — we had to do this in order to set shuffle indexes in smart contract, since the last piece purchased before the reveal was the one to set startingIndexBlock. You can easily look up this value going to etherscan.
https://etherscan.io/address/0x336dcf0f4c0d6465f0cf6445f89da6007ccd186d#readContract
We then bought the last piece for 9.99 ETH a few hours before the reveal.
https://etherscan.io/tx/0x4361ad60f1d38c32314a4831c97e64629b221300e823e6512e1d1ce29ca51439
This has set the startingIndexBlock to value 12146404
Next step was to hit finalizeStartingIndex function in order to set the startingIndex. We hit that here:
https://etherscan.io/tx/0xd7781b1abf7cdbc69c0d1cb1cc82aad79ae3547f3872424de7cf9bcdb014a0ae
And this resulted in setting startingIndex to value 737
The shuffling logic is represented by following equation:
(tokenID + startingIndex) % BAI_SUPPLY
Where BAI_SUPPLY is constant, equals to 8893, tokenID is a variable and startingIndex is a constant set by calling finalizeStartingIndex function and it is set to 737.
For example, if your tokenID is 467, then after reveal your artwork is (467 + 737) % 8893 = 1204
We have visualised the tokenID shift on our website under provenance section, which you can find here:
https://www.bai.art/provenance
After we set the startingIndex, we generated a new metadata set and updated baseURL calling the function of smart contract here:
https://etherscan.io/tx/0x2bedee05ceeb7e7a0701ab24b066e9df3349f7f62efbd0c465e865d1ea17bb7a
Last step was to update the domain setup in order to present reveal artworks under artworks.bai.art instead of placeholders. Since OpenSea uses some caching mechanisms and other optimisations, it took some time to refresh all the artworks there.
Why are my tokens shuffled?
Because the idea behind the reveal is to make it random. Same thing as Hashmasks and many others did. There are two randomising processes — naming of the artworks and then shifting the index. It is done to make sure we did not assigned any particular artwork to tokenID, just a random process based on indexes on smart contracts and our internal randomisation — naming of artworks.
Why I saw different artwork on the website than on opensea
Yes, sorry about that — a little bug. So on the website we are using the equation described above in order to present you the corresponding artwork to your tokenID — it is calculated on client side (frontend). We have a function which reads from smart contract how many tokens you address have (using web3), then we fetch tokenIDs and then generate artwork URL based on tokenID and the equation. So the problem was that tokenID from smart contract is a string, and javascript just moved forward with calculations using string instead of integer. For example (“467” + 737) % 8893 is equal to 5301 instead of 1204 and that is why results were odd. Again, excuse us technical difficulties, we were confused too.
So, that is what the process looked like from the technical perspective. Next updates — expected
We will have a follow-up dev Q&A session in our chat at approximately 4PM GMT today.
Thank you for reading!