Shopping mall based on hyperledger fabric

Shopping mall based on hyperledger fabric

Background of the project

Information leakage, order problems, and counterfeit products frequently occur on traditional online shopping platforms. The following are some examples of accidents:

Tmall and Taobao: On Tmall and Taobao there is often a problem of fakes and counterfeits. These fakes and knockoffs are often sold at low prices, but their quality and safety cannot be guaranteed. In addition, sellers may also use fake and counterfeit goods to deceive consumers and obtain undue benefits.

Uniqlo: In 2019, some user accounts of Uniqlo were hacked, resulting in the leakage of a large number of users’ personal information. This information includes the user's name, address, phone number, birthday, etc.

Impact:

  • The problem of counterfeit goods in shopping malls has a great impact on both consumers and merchants. For consumers, purchasing fake and counterfeit products can lead to quality and safety issues, resulting in economic losses and physical health risks. For merchants, the problem of counterfeit products can lead to loss of trust from consumers, affect brand reputation, and may even face legal action.

  • The information leakage problem of shopping malls will have a great impact on both consumers and merchants. For consumers, leaked personal information may be used for fraud, spam, identity theft and other illegal activities, resulting in financial and privacy losses. For merchants, information leakage may affect users' trust, resulting in commercial loss and reputation loss.

  • The systems and technologies of traditional online shopping malls may also fail, causing orders to not be processed normally and affecting consumers' shopping experience.

There are many security problems in traditional online shopping malls. Compared with shopping malls based on hyperledger fabric technology, traditional shopping malls have some disadvantages, mainly including security issues, opacity, cumbersome processes, and being restricted by merchants. Shopping malls based on Hyperledger Fabric have the advantages of higher security, decentralization, traceability and automation. These advantages can improve the efficiency and credibility of the mall, while protecting the privacy and security of users. , so it is necessary to improve the online shopping mall through the alliance chain hyperledger fabric.

Disadvantages of traditional online shopping malls

  • Low transaction transparency: Traditional shopping malls usually lack transaction transparency. It is difficult for consumers to understand the source of products, production environment, logistics and other information. The shopping platform based on Hyperledger Fabric can provide higher transaction transparency, and consumers can clearly understand the source and transportation process of goods.
  • Low security: In traditional shopping malls, consumers' personal information and payment information are vulnerable to attacks. The shopping platform based on Hyperledger Fabric can protect the privacy and security of consumers through measures such as encryption technology and authority control.

Advantages of shopping mall based on hyperledger fabric

  • High security: Hyperledger Fabric uses distributed ledger technology to ensure data security and immutability. Transactions and data in the mall are encrypted and verified to prevent data leakage and tampering.
  • Decentralization: Hyperledger Fabric's network is decentralized with no single point of control. Transactions in the mall do not need to go through an intermediary, and can be completed directly on the blockchain, reducing transaction costs and time.
  • Traceability: The Hyperledger Fabric network can trace the entire transaction process, thereby improving the transparency and trust of the mall. Every transaction in the mall is recorded on the blockchain and can be traced back to the origin of the transaction.
  • Automation: Transactions and data processing in the mall can be automated through smart contracts, improving the efficiency and accuracy of the mall.
  • Privacy protection: Hyperledger Fabric supports privacy protection technology. Sensitive information in the mall can be encrypted and only authorized users can access and process it.

Shopping mall design ideas and steps based on hyperledger fabric

The shopping mall architecture adopts the micro-service architecture and the separation of the front and back ends. Using the micro-service architecture can bring benefits such as elastic scaling, independent deployment, better organizational structure, better scalability and better flexibility, and can improve the reliability of the mall. performance, maintainability, and flexibility to better meet business needs. And in the application scenario of the spike-killing concurrency scenario, it can realize high-concurrency applications and low decoupling. The separation of front-end and back-end decouples front-end and back-end logic, which helps to improve code quality and maintainability, and facilitates the expansion and optimization of front-end pages without affecting back-end services. The go language is used in project development. The concurrency model of the Go language is simple and easy to use, which helps to improve the execution efficiency of the program. The Go language has a built-in garbage collection function, which can automatically recycle memory resources that are no longer used. This allows developers to focus more on writing business logic without having to pay attention to memory management. When building the hyperledger fabric network, a four-organization structure is adopted. Except for the sorting organization, the other three organizations have corresponding users. The supplier is the supplier organization, where the supplier uploads product information, and the admin organization is the platform provided by the mall manager. , the administrator is responsible for order management, user feedback management and product feedback management. shopping mall is a shopping mall organization that mainly provides product-related and user-related operations. The entire application is deployed to the container orchestration tool kuberneters, and kubernetes can automatically expand or reduce the number of containers according to the load and performance requirements of the application. This helps cope with changing workloads and optimize resource usage. Using the DevOps development model and methodology, DevOps emphasizes automation and continuous integration, continuous delivery, continuous deployment and other processes. Through automated testing, automated deployment, and automated monitoring, the goals of rapid iteration, rapid response, and rapid delivery are achieved, thereby improving software. quality and reliability. Use jenkins as an automatic integration and automatic deployment tool, use github as a code warehouse, dockerhub as a mirror warehouse, and use Prometheus, alertmanager, and Grafana to monitor and alarm applications, networks, and clusters.

Design ideas:

  • System Architecture Design: Divide the entire shopping mall system into multiple independent microservices, such as product management, order management, payment management, logistics management, user management, etc. Each microservice is responsible for the corresponding function and communicates with the frontend through API. The separation of front-end and back-end enables front-end development to be carried out independently of back-end, improving development efficiency.
  • Hyperledger Fabric network design: According to the business requirements of the shopping mall, design the corresponding organizational nodes and channels.
  • Microservice development: For each microservice, develop a corresponding smart contract (chaincode) to process business logic. For example, commodity management microservices need to write smart contracts for functions such as adding, modifying, deleting, and querying. At the same time, an API interface is provided for each microservice to communicate with the front end.
  • Front-end development: According to the designed pages and functional requirements, carry out front-end page development, including product list, product details, shopping cart, order, payment and other modules. The front-end application interacts with the blockchain network by calling the API interface provided by the microservice.
  • Data storage and encryption: In shopping malls, sensitive data may be involved, such as user privacy information, payment information, etc. You can use the private data set function provided by Fabric to encrypt and store sensitive data in the corresponding channel to ensure data security.

Design steps:

  • Requirements analysis and outline design: clarify the business requirements of the shopping mall, design the system architecture, divide micro-service modules, and design pages and functional modules.
  • Environment construction: build a Hyperledger Fabric blockchain network, configure organization nodes, channels, etc.
  • Microservice development: For each microservice, develop corresponding smart contracts and provide API interfaces.
  • Front-end development: develop front-end pages according to the designed pages and functional requirements.
  • Integration testing: testing the entire system.

Building a Hyperledger Fabric blockchain network

A brief introduction to the network

The hyperledger fabric network has four organizations. The orderer is a sorting organization. This organization contains four orderer nodes and adopts the kafaka mode. This organization also includes a CA that issues certificates for the orderer nodes of the organization. This organization is responsible for consensus and dissemination of transactions in the network . The supplier organization is a supplier organization, and users are generally manufacturers, responsible for the uplink of goods, so that consumers can clearly understand the source and transportation process of goods. This organization includes three peer nodes, and the anchor node is mainly responsible for To realize service discovery and communication between different organizations, there is also a CA responsible for issuing certificates to the organization's peer organization and registering users within the organization. The admin organization is an administrator organization, and users are generally administrators of the mall, who are responsible for product listing, removal, order management, user management, and user feedback, etc., and are responsible for the operation and maintenance of the entire mall. This organization includes three peer nodes , the anchor node is mainly responsible for service discovery and communication between different organizations on the same channel, and a CA is responsible for issuing certificates to the organization's peer organization and registering users within the organization. The shopping mall organization is a mall organization, and users are users, providing a platform for users to purchase goods. This organization includes three peer nodes. The anchor node is mainly responsible for service discovery and communication between different organizations on the same channel. There is also a ca Responsible for issuing certificates to the organization's peer organization and registering users within the organization. This organization has two channels, soa and osa, and soa is connected to four organizations. This channel is responsible for putting on and off shelves, and all orders are related to this channel. The osa does not include the supplier, and the channel mainly contains user information. The chaincode in this channel uses a private data set, and only the administrator organization can see the user information, which prevents the leakage of user information and improves security.

The following is the network structure diagram:

Please add a picture description

Guess you like

Origin blog.csdn.net/qq_64421968/article/details/131191713