<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Onchainbunnies on Medium]]></title>
        <description><![CDATA[Stories by Onchainbunnies on Medium]]></description>
        <link>https://medium.com/@onchainbunnies?source=rss-97bfeb8e73a7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QuhriXmNZcnens9O.jpg</url>
            <title>Stories by Onchainbunnies on Medium</title>
            <link>https://medium.com/@onchainbunnies?source=rss-97bfeb8e73a7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:45:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@onchainbunnies/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[On-chain randomness for NFT collections]]></title>
            <link>https://medium.com/@onchainbunnies/on-chain-randomness-for-nft-collections-4ae3504a6e11?source=rss-97bfeb8e73a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae3504a6e11</guid>
            <dc:creator><![CDATA[Onchainbunnies]]></dc:creator>
            <pubDate>Thu, 25 May 2023 19:29:00 GMT</pubDate>
            <atom:updated>2023-05-25T19:29:00.680Z</atom:updated>
            <content:encoded><![CDATA[<p>NFT collections in which the images consist of a composition of traits are often assembled in a random manner. The distribution of traits that results from this random process implies that some NFTs are more valuable than others because of their rarity. One or more random numbers may be used to generate all of the NFTs. Yet it’s not as simple as it seems to generate this random number on the blockchain.</p><h3>The problem of generating random numbers on the blockchain</h3><p>The Ethereum blockchain’s deterministic nature makes it difficult to generate random numbers. Every node must reach the same consensus as a result of this determinism. A random number, however, cannot be predicted, hence the node cannot know in advance what should happen when a random number is generated. This leads to a pardox. Therefore, there is a lack of probability in smart contracts.</p><p>For many blockchain applications, such as NFT collections, this probability is necessary. Frequently, when purchasing an NFT collection, it is unknown in advance which exact NFT will be acquired. In this scenario, the NFT launch occurs in stages. Each customer first purchases one or more NFTs from the collection during the minting phase. Each NFT is still the same at this stage of the process. Only later in the process comes the reveal phase. Here the image and traits are revealed. For this reveal phase, a random number is necessary.</p><p>The fact that the random number is unpredictable is important. Otherwise, insider knowledge would be available, and some NFTs with the associated rare ids would be exchanged for a very low price during the pre-reveal. According to statistical analysis, this has been the case for numerous NFT projects, even blue-chip collections. So, it’s crucial to come up with a clever and unpredictable solution to this issue.</p><h3>Random seed generation with block information</h3><p>Using the data from blocks is a first approach to on-chain random number generation. This block’s information is subject to frequent, unpredictable adjustments. The random number is then generated using the block information as a seed. Block variables can be viewed as the first category of block data. The timestamp, address of the miner, gas limit of a block are a few examples of block variables. Nonetheless, it is clear how a miner may alter this data. For example, a miner can wait a few seconds to validate the block, causing the timestamp to turn into a favorable seed for him.</p><p>Block information is handled more securely when block hashes rather than block variables are used. This is due to the miner’s inability to modify the hash. Yet, there are still some issues and insecurities with this approach. Three different forms of block hashes are conceivable: the hash of the previous block, the current block, and the future block.</p><p>The hash of the previous block can be retrieved in Solidity with the following code: hash(block.number -1). The use of this approach has two drawbacks. On the one hand, the blockhash is predictable during the brief interval between the validation of the previous and current blocks. It is impossible to rule out an attack during this time. This approach also results in the miner incentive problem.</p><h3>Miner incentive problem</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xX2CTVX5YNum9g30f0wjCw.jpeg" /></figure><p>To illustrate the miner incentive problem, we propose a scenario where a lottery is organized and a miner participates in this lottery as a participant. The player, who in this instance also operates as the miner, first places a bet with the house. After the house receives the bet, it asks the hash of the previous block in order to determine the winner. The miner notices that the requested hash will yield a negative result, implying that he will not earn the prize. As a result, the miner cancels the transaction and pays a penalty. However, the miner has provided an additional possibility of winning the lottery by forcing the house to complete another transaction in order to acquire the hash.</p><h3>Future blockhash</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-SU4G-OsnI0DP9wxP4QGQ.jpeg" /></figure><p>To address the miner incentive problem, the future blockhash principle can be used. First, the player will send a transaction to the house containing a particular bet. The house will then store the block number of the player’s transaction on the blockchain. The player asks the house to reveal the winner during the second stage of this process. The home will retrieve the appropriate block number from the blockchain in order to respond to this query. The winner of the lottery is determined by the hash of this block number. The miner can no longer affect the request because it depends on the player’s transaction, which was committed in the past. This method resolves the miner incentive problem, nevertheless it raises a new security concern. The Ethereum network only stores hashes of the most recent 256 blocks due to scalability reasons. So, if a player waits until more than 256 blocks have been confirmed after his bet, the block number’s hash will equal zero. The winning number may then be deduced from this. This hack took place in the SmartBillions lottery and resulted in a loss of 400 ETH.</p><h3>Oracles</h3><p>Using an oracle is a second kind of approach for creating random numbers on the blockchain. An oracle is a mechanism for bringing off-chain data, such as a random integer, onto the blockchain. The most famous oracle for Ethereum is Chainlink. Chainlink has introduced a Verifiable random function, or VRF, to undermine trust in the external data supplier. Smart contracts can then ask the oracle nodes for random numbers using the VRF principle. Every node is in the possession of a private and public key. An unpredictable seed is sent to the nodes whenever a smart contract requests a random number. This seed can be the block hash or the block that contains the requestRandomness call and other specific parameters. The node will then produce a random number using the provided seed and its private key. By comparing the hash with the public key and a the seed, a proof of correctness can then be produced.</p><p>Based on security, choosing an oracle is not always the best option. In fact, oracles are particularly prone to front running attacks.</p><h3>Commit-reveal</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_K4BTaf0HGC0_xA7rwiFyA.jpeg" /></figure><p>A third type of random number generation consists of the commit-reveal principle. There are two distinct steps to this approach. As illustrated in the above figure, phase one is represented in red, and phase two in blue. Initially, a number of voluntarily participating individuals independently choose an random number outside of the blockchain. After that, they individually submit this random number’s hash to the house. Phase two begins once all hashes have been delivered to the house. In this phase, each player sends their previously chosen random number to the house. The house verifies from the hashes that these numbers correspond to their initial choice of number. Finally, if this is the case, the house will add up the numbers and use this sum as the random number.</p><p>This technique also possesses some drawbacks. First, the player incentive problem has replaced the miner incentive problem. The voluntary participant in this scenario is also a lottery player. The final participant in stage two has the ability to see the information that the individuals before them have sent. As a result, the player will cancel the transaction. A second drawback is the interaction required to implement this system. Finding the necessary volunteer participants each time a random number is required might be challenging in some cases. Using RANDAO and Quanta might be a solution to this. This library uses the commit-reveal concept, with volunteers receiving a reward each time they pass a random number. Nevertheless, doing so necessitates putting confidence in the RANDAO and Quanta developers. A final drawback is that the volunteer is not rewarded by forwarding an effective random number. Hence, a volunteer can always forward zero without any consequences. However, it suffices that one of the participants sends a random number. The outcome in this scenario will always be random.</p><h3>Randomness in existing smart contracts</h3><h3>OnChainMonkey</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-89ymsxCl8zfhvfH_oUsg.jpeg" /></figure><p>The OnChainMonkeys are the most well-known on-chain NFT collection. Nevertheless, there is no on-chain randomization method present in this collection. In fact, it is feasible to determine in advance which ids correspond to particular traits. The code listed above shows the technique used to translate a tokenId into several traitIds. First, a private string and the tokenId are concatenated. On the blockchain, this secret string is visible and the tokenId is also well-known. The hash is then extracted from this text and transformed into an uint256. The appropriate traitId is derived by taking the modulo. Hence, unlike other off-chain collections, this collection lacks a pre-reveal phase and is fairly predictable</p><h3>OnChainBirds</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2g36V78mq5XFZS-8pFpWlw.jpeg" /></figure><p>The OnChainBirds were launched in September of 2022. This collection did manage to randomly generate the traitIds on the blockchain. For every tokenId, a random number is produced. All of the traitIds are then calculated from this random number. The tokenID, block difficulty, block timestamp, and msg.sender are the parameters used to produce the random number. This final field specifies the address of the transaction’s performer, in this instance the buyer. Both the tokenId and the buyer’s address are visible for the buyer. However, In light of the first two variables, it may be concluded that the customer is unsure of the NFT they will purchase.</p><p>A crucial detail is that the first mint transaction occurred on September 16, 2022, one day after the Etherreum merge. The block difficulty did not instantly yield a value of zero at this point. It was decided to switch the underlying opcode to the prevrandao new PoS field. This field refers to the RANDAO number of the prior block. This RANDAO number is used to determine the block validators.</p><h3>OnChainDonalds</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXTqZdM8Rlb2ls0NUTbBkg.jpeg" /></figure><p>The randomization of attributes was handled even differently by the OnChainDonalds. They opted for the reveal phase option rather than a reveal at mint. This allowed them to randomize all the traits with one particular random seed at the same time. With this approach, the developer determines the random seed off-chain before passing it online to the smart contract. The benefit of using this technique is that the seed may be checked first off-chain to ensure that duplicates are not introduced. However, this technique again introduces trust in the developer. After all, the developer is not allowed to share the seed with other people beforehand.</p><h3>Conclusion</h3><p>It can be concluded that despite the deterministic nature of the blockchain, there are still options to generate random numbers on-chain. First of all, choosing an oracle is a safe option. However, choosing a reveal at mint will be too costly. In this case, a random number is required for each NFT. Finally, it should be mentioned that block information should not be used because it can be easily manipulated. Finally, using a commit-reveal solution for an NFT collection is too cost-prohibitive and requires too much interaction for an NFT collection. It is therefore better to choose a commit-reveal library like RANDAO.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae3504a6e11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why are on-chain NFTs so important?]]></title>
            <link>https://medium.com/@onchainbunnies/why-are-on-chain-nfts-so-important-d5592301fb43?source=rss-97bfeb8e73a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5592301fb43</guid>
            <category><![CDATA[on-chain-data]]></category>
            <category><![CDATA[nft-collectibles]]></category>
            <category><![CDATA[on-chain-art]]></category>
            <category><![CDATA[nft]]></category>
            <dc:creator><![CDATA[Onchainbunnies]]></dc:creator>
            <pubDate>Tue, 07 Mar 2023 20:04:45 GMT</pubDate>
            <atom:updated>2023-03-07T20:04:45.200Z</atom:updated>
            <content:encoded><![CDATA[<p>On-chain collections in the NFT world are gaining popularity. What’s behind this hype and why is investing in these projects interesting? This article will try to give you the answers in a technical way.</p><h4>Raccoons collection</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPaPWjUIKS-kM9aAJ6AEcg.png" /></figure><p>Even though the blockchain is touted as a trusted environment that excludes trusted third parties, this is not the case with most NFTs. A lot of trust in the developers is required. In August 2021, the NFT project Raccoons Secret Society launched a collection of 10 000 raccoons. The NFT collection attracted attention and achieved a trading volume of 191 ETH. A month after the launch, the developers of the collection announced that they would convert all the images of the raccoons into the image of a pile of bones. They would change not only the image, but also all metadata and rarity properties. The goal of the developers of the Raccoons collection was to address the vulnerability of smart contracts.</p><h4>FTX</h4><p>Not only with the Raccoons collection did problems occur. After FTX announced their bankruptcy, FTX’s domain was also unavailable. This caused all the NFTs hosted on the FTX platform to be broken. For example, the image’s link led to a page that gave more info about the bankruptcy. Both the image and metadata were no longer available.</p><h4>How is this possible?</h4><p>Most NFT smart contracts only store the metadata on the blockchain. This metadata contains a link that can point to a server that stores the image or it can point to an external distributed file system like IPFS that hosts the image. In every case the link is stored in the “tokenURI” variable in the smart contract. Simply keeping the link on the blockchain has significant security implications. In fact, using the setTokenUri() method of the ERC721 standard, the link can be modified by the developers at a low cost. Currently, there are a large number of NFT collections using this technique, even the ‘blue-chip’ NFT collections such as the Bored Ape Yacht Club. This leads to the customer having to trust the developer when buying an NFT, which undermines the whole concept of blockchain. Namely, this reintroduces trust in a third party.</p><p>Storing the link on-chain instead of the full image not only allows the developer to change the link but also has other major drawbacks. For example, suppose the developer decides to store the data on a server of a distributed cloud storage provider like Amazon’s AWS. In this way, the NFTs are again completely centralized by entities like Amazon. This again makes the NFTs vulnerable to an attack of failure. Furthermore, once the developer no longer pays to maintain this server the image is lost. This is what we saw with FTX-hosted NFTs.</p><h4>Distributed file systems as a solution</h4><p>Instead of using a centralized server to store the data of the assets of the NFT, there can be opted to use a distributed file system like IPFS. When uploading a file to IPFS, the file will be split into chunks of 256 kB and a hash digest will be created for every chunk. Ultimately, one more separate file is created that contains the collection of the hashes of the different chunks. The hash digest of the latter file will be stored in the smart contract. Because IPFS makes use of this content-based addressing there can be assured that the data is not manipulated. Modifying the data content in fact results in a different hash.</p><p>When the hash containing the link to the file is called via the smart contract, content discovery will take place using distributed hash tables (DHTs). These tables contain the link to the peers who host the chunks of data. The content linking of the different chunks is done using a Merkle DAG. Both the content discovery and linking take time, which make it a slower option than on-chain storage. To solve the latency of the content discovery, Pinata can be used to pin the files. However, this is an expensive and sometimes complex solution.</p><p>Another drawback of IPFS is the fact that it is possible to keep the file distribution centralized and only the DHTs are distributed. This is achieved by storing the data on one single node. When this node goes offline both the hash in the DHTs and the hash in the smart contract will remain the same. Again, all the vulnerabilities of a centralized system occur. For instance, it is almost impossible to verify the integrity of the data because there is no indication from the hash that the nodes are effectively online.</p><p>For more information on how to check the integrity of the data: <a href="https://www.coindesk.com/layer2/2022/01/20/ipfs-filecoin-and-the-long-term-risks-of-storing-nfts/">https://www.coindesk.com/layer2/2022/01/20/ipfs-filecoin-and-the-long-term-risks-of-storing-nfts/</a></p><p>Then there is a final problem with using a distributed file system. IPFS was originally built as a community product and so there is a lack of strong economic incentives present. This requires nodes to host data of their own free will. Once they decide to stop hosting, the data will be lost. Filecoin offers a solution to this problem by attaching a financial reward. Filecoin can be seen as a blockchain where people are rewarded with FIL tokens for hosting data. However, this still does not guarantee that the data will be kept forever. Blockchains have gone down before in the past.</p><h4>Why do not all projects change to on-chain?</h4><p>The reason that only the link is kept on the blockchain is economic in nature. After all, the price of keeping data on a blockchain can be high. This is because each node is going to have to keep a copy of this data.</p><h4>How to keep things cheap?</h4><p>To get more info in the technical details to store NFTs as cheaply as possible on-chain follow this account. In collaboration with two professors and a Phd student from the KULeuven, I will be searching for the cheapest possible way to accomplish this.</p><p>This article was written under the guidance of the KULeuven.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5592301fb43" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>