Security of a Digital File of an Artwork on the Blockchain.
Art and files in traditional databases:
Let's look at a digital file that contains the information of a work of art and is stored in a traditional database (DB):
This file exists on a central server (computer) and one or two other servers that are backed up. This condition makes the server very subject to hacks and security breaches that can alter the integrity of a file.
Art and files on the blockchain:
The blockchain is a non-traditional database, it functions as an ledger of transactions made between two or more people, each page of the ledger represents a block of the chain, containing at least the following information:
Page or block number.
Summarized content of the previous block in a mathematical hash function.
Date of execution of the block.
Hash function of each person-to-person transaction.
Hash function of the transaction summary.
Let us look at block 733,212 of the bitcoin network on April 23, 2022:
Represented by the hash function that encrypts the data contained in the block:
This block contains 1,929 transactions, of which we illustrate 4, note that each one is encrypted by a hash function:
The Bitcoin blockchain ledger is distributed among thousands of nodes, computers or replicas, in March 2021, there were more than 260,000 full nodes and more than 70,000 basic nodes, geographically located around the world. So, if a hacker attacks the integrity of this file:
You must change the information in this block 733,212.
As this block is interconnected with block 733,211, it is necessary to change it as well and in turn change all the blocks of that node or server.
It must also perform the changes on at least 51% of the nodes in the blockchain network (this is called a 51% attack), this attack is very difficult due to the resources that the hacker must use (time, energy, processability).
Smart Contract of a fungible token or ERC20:
This is a set of instructions deployed on the Ethereum blockchain, which has a preset data structure and enables a variety of functions, two of which are illustrated below:
The Builder: creates a total bid of 1,000 coins called TOUR, with two decimal places (the last two zeroes), in the contract owner's account balance.
Send: Send or transfer a certain amount of tokens to other accounts or addresses.
In practice, ERC20 contracts are more complex, including functions such as:
a) Burn or remove tokens.
b) Authorize or delegate the distribution of the tokens.
c) Issue events such as sending tokens to other accounts.
d) Change the ownership of the contract, etc.
Smart Contract of a non-fungible token (NFT) or ERC721:
It is a set of instructions deployed on the Ethereum blockchain, which in addition to data contains a variety of functions, some of the functions allow creating of unique and non-exchangeable (non-fungible) items.
Let us look at an example, the CryptoZombie_game: We illustrate a code segment of a function that creates a game element called zombie:
Line 21: The zombie has a name and its respective DNA that make it unique in the game.
Line 22: The zombie has an owner, identified by the address of the owner or creator of the contract.
Line 23: Each user can have more than 1 zombie or (NFT).
Line 24: A notification is issued that a new Zombie or NFT has been created.
Zombie DNA: The zombie's appearance will be based on its "Zombie DNA" which is a 16-digit integer:
Like real DNA, different parts of this number will be assigned to different traits. The first two digits are assigned to the zombie's head type, the second 2 digits to the zombie's eyes, etc.
Below are images of nine zombies with different names and DNA that give them unique characteristics and whose data on the Ethereum blockchain constitute 9 NFTs.
How to identify the owner of the NFT:
In the following code example in line 25, we have a function isOwner (), which verifies the identity of the person interacting with the contract.
When executed by the owner, returns True and will be able to view and interact with the contract.
If you are not the owner, it returns False, and you can only see the contract.
Finally, the contract that corresponds to a particular NFT will contain the functions that comply with the guidelines that its creators and developers deem appropriate.