IPFS system development | mining machine exchange model construction

IPFS distributed storage mode
1. IPFS is a decentralized, distributed storage system!
2. What is the final application scenario of
IPFS ? IPFS is a distributed storage network, and its most important application is storage. It is not enough to save a certain file permanently, and to be able to find the content again when needed. The combination of storage and retrieval constitutes the final scene of IPFS applications.
3. The goal of IPFS: The goal of the
Interplanetary File System (IPFS) is to create a distributed Web. The point-to-point hypermedia protocol makes the web faster, safer, and more open.
4. How does IPFS store data?
IPFS is different from traditional storage in the past. IPFS is a decentralized, distributed storage system! In IPFS, files are stored in IPFS objects, and each object can store 256kb of data. The object can also contain a link to another IPFS object, which makes it possible to store data larger than 256kb.
For example, if you only uploaded a small text file, then a 256kb object should be enough to handle your small amount of text.
5. What changes does IPFS bring?
First, IPFS has changed the way files are stored. The original storage method is to store the entire file at a central point, but IPFS breaks up a large file into many small files and stores them in other places throughout the network.
Second, the way data is transmitted on the Internet has also changed. The HTTP protocol is to query data at a central point, and IPFS is a point-to-point communication method for querying data. One thing needs to be added, IPFS is based on content addressing.
Third, bandwidth resources have been optimized. The previous centralized mode requires a lot of bandwidth. IPFS can access data from multiple nodes, and you can choose to query data from the nearest node, which can save a lot of bandwidth resources.
Fourth, IPFS is a modular protocol, which is a combination of DHT—distributed hash table, BitTorrent—BT protocol technology, Git—blocking technology, and SFS—self-certified naming technology. Communication protocol method.
6. The role of
IPFS IPFS has fundamentally changed the way users search. Through IPFS, users can directly search for the content they want.
In the past, users searched for files through HTTP browsers first to find the location (IP address) of the server, and then used the path name to find the file on the server. In this way, only the file owner can determine whether this is the file the user is looking for, and must ensure that the custodian will not remove the file or shut down the server to make any changes to the file.
When the file is added to the IPFS node, a new name will be generated. This name is actually a cryptographic hash calculated based on the content of the file. Encryption can ensure that the hash always only represents the content of this file, even if only one bit of data is modified in the file, the hash will be completely different.
When asking IPFS for a hash, IPFS uses a distributed hash table to quickly (only 20 hops in a network with 10,000,000 nodes) find the node with the data for retrieval, and use the hash to verify whether it is Is the correct data.

  function usersX3Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, bool) {
    return (users[userAddress].x3Matrix[level].currentReferrer,
            users[userAddress].x3Matrix[level].referrals,
            users[userAddress].x3Matrix[level].blocked);
}

function usersX6Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, address[] memory, bool, address) {
    return (users[userAddress].x6Matrix[level].currentReferrer,
            users[userAddress].x6Matrix[level].firstLevelReferrals,
            users[userAddress].x6Matrix[level].secondLevelReferrals,
            users[userAddress].x6Matrix[level].blocked,
            users[userAddress].x6Matrix[level].closedPart);
}

function isUserExists(address user) public view returns (bool) {
    return (users[user].id != 0);
}

function findEthReceiver(address userAddress, address _from, uint8 matrix, uint8 level) private returns(address, bool) {
    address receiver = userAddress;
    bool isExtraDividends;
    if (matrix == 1) {
        while (true) {
            if (users[receiver].x3Matrix[level].blocked) {
                emit MissedEthReceive(receiver, _from, 1, level);
                isExtraDividends = true;
                receiver = users[receiver].x3Matrix[level].currentReferrer;
            } else {
                return (receiver, isExtraDividends);
            }
        }
    } else {
        while (true) {
            if (users[receiver].x6Matrix[level].blocked) {
                emit MissedEthReceive(receiver, _from, 2, level);
                isExtraDividends = true;
                receiver = users[receiver].x6Matrix[level].currentReferrer;
            } else {
                return (receiver, isExtraDividends);
            }
        }

Guess you like

Origin blog.csdn.net/T13242772558/article/details/109294445