NFT linkage between token and digital product - blockchain

I understand what NFT is – it is an entry in the Blockchain, I understand what a digital product is - for example, it is a physical file with an image.
I want to create an NFT for this image. This is what I don't understand so far - where will the information between the NFT and the image be stored to prove that this particular NFT is made specifically for that particular image?

As per the ERC721 and ERC1155 standards, there is just a one-way link from the token to the image. Which theoretically allows multiple NFTs representing the same image.
Each collection contract implements a function to retrieve a metadata JSON file. In case of ERC721 that's tokenURI(uint256 tokenId), and in case of ERC1155 that's uri(uint256 tokenId), both returning a string with the metadata file location. This file can be stored on a private server, a decentralized storage (e.g. IPFS), an FTP, ... simply behind any valid URI.
And according to both standards, the metadata file should contain a JSON field named image containing URI of the actual image file.
TLDR: A one-way link from the NFT to the image is in the metadata file of each NFT. There is no standardized way to link from the image back to the NFT.

Related

Want to know the reason how Rarible and Opensea sync the items using the same wallet address?

I'm working on an NFT project, Once I created an item on Rarible, and after that login on to Opensea with the same wallet address. Then the item I was created on Rarible is automatically synced to Opensea including title, history, etc.
So, As a programmer. I want to know the reason behind this process and how they are getting this data from one to another using the same wallet.
When any contract writes an ERC721 compliant transaction to Ethereum, marketplaces like OpenSea and Rarible are able to monitor new blocks (e.g. via event streaming) for new token creation. Since this information is public, information such as the issuing contract id, owner address and token id are immediately available and can be retrieved. Additional information about the contract can also be obtained from the contract constructor.
Additionally, one of the methods on an ERC721 contract is tokenURI. By navigating to this URI (often stored on immutable storage like IPFS), anyone observing the blockchain can retrieve additional metadata information about the token. This metadata usually includes an image, description and other custom attributes which describe the NFT. This allows marketplaces to render the NFT on their exchanges.

How to fetch raw data from Binance Smart Chain (txs for specific address)

I am not sure what I don't know and if this is possible. I think this would be a similar issue for Ethereum, so that is the reason why I marked Ethereum on tags.
I am going to describe on example what I want to achieve:
There is a token called "Elonomics".
https://bscscan.com/address/0xd3ecc6a4ce1a9faec1aa5e30b55f8a1a4b84f938
there is owner with address "0x3a78ea5c462f0afa76fa091a70a7bcd020b274d6"
there are all txs from owner address: https://bscscan.com/txs?a=0x3a78ea5c462f0afa76fa091a70a7bcd020b274d6
when I take one of the transaction from the owner e.g. 0x6f81f2dbd285d772c6b34151b676f6749ef75ac9a6c76b5e4dfa844a0c6932d2"
I can read the logs from this transaction in:
https://bscscan.com/tx/0x6f81f2dbd285d772c6b34151b676f6749ef75ac9a6c76b5e4dfa844a0c6932d2#eventlog
so I can read that somebody set "totalSupply :1500000800000"
and now are my questions:
Is it possible to fetch all txs related to this specific owner address with these logs in json data (or any other data that can be updated dynamically on dAPPs)?
Are data from txs logs are encrypted? (if yes what is the format of this and how to decrypt this how bscscan do)
Is it possible to fetch these data directly from blockchain instead of using 3rd part application like bscscan?
Is it possible to fetch all txs related to this specific owner address with these logs in json data (or any other data that can be updated dynamically on dAPPs)?
Yes, because all this data is stored on a blockchain.
Are data from txs logs are encrypted? (if yes what is the format of this and how to decrypt this how bscscan do)
All data on a public blockchain is public.
Is it possible to fetch these data directly from blockchain instead of using 3rd part application like bscscan?
Run your own BSC node. Please see web3.py library how to interact with an Ethereum based blockchain, like one that is BSC node.

How to upload file to IPFS by keeping same CID

Store 2 image in IPFS and pin it.
The IPFS URI should be like
ipfs://ipfs.io/hashCID/O.png
ipfs://ipfs.io/hashCID/1.png
Here hashCID should be same.
Just change the next token id and you should be able to retrieve the image.
From the docs:
CIDs are based on the content’s cryptographic hash. That means:
Any difference in the content will produce a different CID and
The same content added to two different IPFS nodes using the same settings will produce the same CID.
So you'll get the same hashCID only if both 0.png and 1.png have the same content and are added (to the IPFS) with the same settings.

About IPFS client add() function

I am digging into ipfs field in order to start a NFT project so that I am working with frontend with ipfs-http-client npm package (npm i ipfs-http-client).
My simple test code is like below:
const { create } = require('ipfs-http-client')
const ipfsClient = create("https://ipfs.infura.io:5001/api/v0")
const cid = await ipfsClient.add(urlSource("https://camo.githubusercontent.com/e92540c54c9b47f684b0e4dd5442ebe20ddbbe2e9699c29ce8400c055fa46e6a/68747470733a2f2f697066732e696f2f697066732f516d65364b4a644b637038355459624c78754c56376f517a4d694c72656d4437484d6f584c5a456d676f36526e682f6a732d697066732d737469636b65722e706e67"))
//https://ipfs.io/ipfs/QmUQeyhy7yY9yZUXKbKLCnPAoGKCeuhH3XxzprcJfYiz1h
So far so good without any problem and the data is accesable on ipfs network. The question of mine is very conceptual and fundamental I believe.
Apparently, the image uploaded to ipfs is stored in the ipfs nodes. And the image will be accessible as long as there is at least one node holding the image data. or we will need to pin it. Otherwise, the data will be no longer seen.
And I found the article from the following link saying that the add() execution with default pin with infura API. I am not sure if it is correct because I event does not provide any infura API secret key for this operation. Or is it a free service?
How to pin a hash for IPFS through Infura's gateway using ipfs-http-client API

How to control access to personnal information stored on blockchain (with an educational use case)

The following use case would it be possible ?
At a nation level, the government wants its regional educational direction to build a system to certify diplomas. Those diplomas should be stored on a blockchain in such a way that no region could, alone, temper them after they were issued.
The students should be able to give access temporally to his or her diplomas, to anyone (eg. employer wanting to recruit).
Please correct me:
I think this should be possible if the data stored on the blockchain was encrypted and if the DAPP was able to generate temporary key to decrypt that data.
Obviously any employer gaining access to the record could make a copy of it, but the point here is that after the expiration of the key's validity, no employer should be able to prove that he owned the real record.
Does that sound like a valid use case for dapps in general. Does it sound even feasible to you ?
The following scenario can be suggested as the simplest option:
We create a smart contract with 3 methods:
RegistryRequest(bytes32 info_id, bytes32 user_id, string memory public_cert) payeble
SendInfo(bytes32 info_id, bytes32 user_id, string file_addr)
GetInfo(bytes32 info_id, bytes32 user_id) view return(string memory retVal)
The consumer calls the method RegistryRequest transfers:
info_id - the identifier of the required data
user_id - his unique identifier (e-mail, mobile phone, and so on) ()
public_cert- his public key OpenSSL
and attaches a certain amount in Eth to the transaction as payment for the service.
Having received the details and payment from the consumer, you:
create a file with the data he needs
encrypt this file with the consumer's public key OpenSSL,
upload it to some web resource or transfer it via IPFS or Ethereum Swarm (or in any other way)
using the method SendInfo lay out the "address" of the data file (file_addr) in relation to the data and consumer identifiers (info_id, user_id).
To pay for the transaction, you use a portion of the amount received from the consumer along with the RegistryRequest.
The consumer through the method GetInfo using the data identifier (info_id) and his personal identifier (user_id) receives the "address" of the data file, extracts and decrypts it
If the data changes, then their changed state is laid out similarly to point 3
After the expiration of the data provision period, you stop releasing their update
More complex solutions can, for example, be discussed with experts for free and simulated on a kekker.com