GithubHelp home page GithubHelp logo

iyreality / contract-supplychain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyperchaincn/contract-supplychain

0.0 1.0 0.0 2 KB

基于Solidity语言的,适用于供应链金融场景的智能合约示例

contract-supplychain's Introduction

Contract-SupplyChain

基于Solidity语言的,适用于供应链溯源场景的智能合约示例

场景描述

供应链溯源合约有以下几类参与方:

  • 商品厂商:保存于mapping(address => User) producerMap
  • 各级经销商:保存于mapping(address => User) retailerMap
  • 消费者:保存于mapping(address => User) customerMap

各类参与方均通过newUser方法进行上链登记。通过传递不同的Actor值来指定不同参与方。

厂商首先通过newProduct方法将出厂商品登记到区块链,随后商品分销到下一级经销商,接下来的环节,每一次商品的分销均在接收商品的经销商处调用retailerInnerTransfer方法将商品进行上链登记,最终商品在零售商处由消费者购买,调用fromRetailerToCustomer方法进行最终登记,完成整个出厂-多级分销-零售的流程。商品一旦由厂商登记上链,便可通过getCommodity查询到商品当前的分销信息,只有处于该分销路径上的参与方才允许查询。此外,通过addWhiteList可以为指定参与方添加顶级查询权限,被添加到WhiteList的参与方,即使不参与到某商品的分销路径中,也可查询到该商品的分销信息。

contract-supplychain's People

Contributors

cspilgrimzww avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.