全文内容
COMP2034_CW1_SampleRpt(partial)write-up_Feb2025.pdf
COMP2034: Sample Report (partial) Write-up
Creating a Blockchain Application for Supply
Chain Management in the Wagyu Beef Industry
1 | P a g e
Sample Report (partial) write-up
Table of Contents
Design & Background Research on Real Life Supply Chain Management ............................................... 1
Case Scenario ....................................................................................................................................... 3
Aim of Blockchain ................................................................................................................................ 4
Smart contract (as agreed by every entity involved) ........................................................................... 4
Entity involved ..................................................................................................................................... 4
Supply Chain Flow In Wagyu Beef Industry ......................................................................................... 4
Design Structure of Blockchain & Block ............................................................................................... 6
Design Structure of Transaction ......................................................................................................... 7
Screenshot of output ............................................................................................................................... 8
User interface in main.cpp ................................................................................................................... 8
Print created blockchain ...................................................................................................................... 8
Search block by block ID in blockchain ................................................................................................ 9
Search transaction by ID in blockchain .............................................................................................. 10
Search transaction info by transaction ID and key in blockchain ...................................................... 10
Checking validity of input .................................................................................................................. 10
Feedback Questions ............................................................................................................................... 12
How was your overall experience regarding doing this coursework? ............................................... 12
Key things you’ve learned while doing this coursework?.................................................................. 12
Noteworthy difficulties you faced ..................................................................................................... 12
Reference list ........................................................................................................................................ 13
2 | P a g e
Sample Report (partial) write-up
Design & Background Research on Real Life Supply Chain
Management
Case Scenario
The designed blockchain is to track the shipment of exclusive Wagyu beef from Farm A to its
partnering restaurants.
In reality, customers at high-class restaurants are paying the luxury price for exclusive grade A
Wagyu Beef. Since customer is paying higher price, it is their right to ensure that the product
they receive is not ordinary beef.
As a guarantee that customers are getting what they’ve paid for, a Certificate of Authenticity is
presented along with the Wagyu Beef as a proof of its high quality to verify important details about
the specific raw material they have received/how product is made. Since the Wagyu Beef industry
prioritize on the information of origin of every meat that was sold, it is very compatible to use a
blockchain to store details on its supply chain so the end consumer (customer at restaurant) can
easily track back the origin of their meat.
To design information included in each transaction within out blockchain, I have extracted a few
important points from several Certificate of Authenticity for Wagyu Beef as presented online.
However, the grading system is not made clear, hence the data included is only an estimation.
3 | P a g e
Aim of Blockchain
To act as a ledger to record the production of Wagyu beef from a farm to field to customer’s plate
on restaurant and act as a proof quality control and confirmation on authenticity of Wagyu Beef
Smart contract (as agreed by every entity involved)
1. No modification upon submitting block into blockchain, all entities can only display data
in blockchain to uphold nature of immutable ledger.
2. For this demo, public key is not used due to complexity of using open library, which is differs
for operating system. For the sake of demo and running efficiency, this demo will use string
name to represent each entity
Entity involved
1. Cow Farmer: Provide whole cow as raw resource
2. Manufacturer: Responsible for pre-processing (separating cow into different cuts) and
grading system
3. (General) Logistic Team: Transport good within each entity throughout the supply chain flow
4. Distributor: Warehouse located in each is as gathering hub before packaging the goods into
each parcel according to order invoice
5. Restaurant: Receive goods from distributor before preparing the goods for customers
6. Customer at Restaurant: Act as end consumer. End consumer will not enter any info into the
blockchain, since their comments will be entered into the system by restaurant. End
consumer can access blockchain to check the origin/history of the cut they’ve paid for
Supply Chain Flow In Wagyu Beef Industry
Cow farmer Manufacturer Manufacturer’s Distributor Distributor Distributor Restaurant
breed & pre- Logistic Team receive package Logistic receive good
slaughter processing & deliver to goods goods Team and prepare for
cow grade beef distributor according deliver to customer (end
warehouse to order
invoice
individual
restaurant
consumer
Stage 1: Cow farmer extract natural resources)
In this stage, each block holds info of 1 transaction only, where each transaction represents 1
slaughtered cow.
After slaughter, pass to manufacturer for grading & packaging & distribution (Pre-process &
Manufacturing – Cleaning, Quality control, Quantity).
Stage 2: Manufacturer in charge of pre-processing
In this stage, each block can hold multiple transactions, where each transaction represents diff cuts
off the same cow (after the meat was separated to smaller packages)
4 | P a g e
After goods are manufactured & pre-processed, the goods will be stored in containers to be
shipped across state. The containers are passed to logistic team to deliver to distributor.
Stage 3: Manufacturer’s Logistic Team to deliver pre-processed goods to distributor
In this stage, each block holds 1 transaction which represents the truck of logistic team
which is assigned to deliver goods. 1 truck can only hold 1 container for transport.
When shipment arrives at distributor warehouse, the warehouse employee will sign the shipment.
Stage 4: Distributor to receive good from manufacturer at warehouse.
Then, the distributor will repackage the stock according to order invoice of each restaurant and
arrange shipment to individual restaurants.
Each transaction in block represents all items to be received by 1 restaurant; while the block
represents all repacked ready to be sent out on that day.
Stage 5: Distributor to repackage good as per order invoice of each restaurant
After that, the distributor will send out their logistic team to distribute the good to individual
restaurants.
Each logistic truck will collect item at the warehouse in the morning and drop by each restaurant
throughout the day. Each block represents all orders to be delivered on the day, and each
transaction represents an order of an restaurant.
Stage 6: Distributor’s Logistic Team to arrange shipment to individual restaurants
Stage 7: Restaurants pick up their order delivered by distributor’s logistic team
Stage 8: Restaurant preparing the dish and serving to the customers
5 | P a g e
Design Structure of Blockchain & Block
Blockchain as Vector data type (Dynamic Array)
Reason: Non-contiguous memory allocation -> No limit size of data structure; can
The blockchain represents the history of the how the goods received by consumer is extracted,
manufactured and transported from farm to plate.
Each block can have multiple transactions (items) which is handled through the same process at
each stage.
In each transaction, the information of the item is stored as a map with key-value pair .
Note: 1st block in blockchain is Genesis Block (Block #0), with hash value pointing to itself
6 | P a g e
Block#0 as Genesis block Block class
Block #0 Block#1 Block#2
Hash of current block
Hash of previous block
Transaction #1
Transaction ID
Creator ID
Timestamp
Details of Transaction
Transaction #2
Transaction #3
Detail of Transaction is stored as map
Reason: Key-Value Pair allow search by key
Design Structure of Transaction
The table below shows the different types of data included in transactions at each stage. These data
provide a description of how the goods is handled at every stage.
[Refer to Section: Supply Chain Flow In Wagyu Beef Industry]
Stage 2
- Grade
- Carcass ID
[Represents 1 cut portion]
- Marbling Score
[Represents ratio of fats
distribution of cut]
- Weight
- Container ID
[Represents container which
packaged beef is stored in for
sending]
Stage 5
- Batch ID [Repackage as a
parcel to for each
individual restaurant]
- Item ID
[All item included in
repackaged batch]
Stage 6
- Shipped by
- Destination
- E T A
- Batch ID
Stage 7
- Arrival time
- Received by
Stage 8
- Carcass ID
- Serving Time
- Customer’s
comment
Stage 1
- Breed
- Parent ID
- Cattle ID
- Origin
- S e x
- Date of Birth
- Harvest Date
Stage 3
- Truck License
Plate
- Date collected
- Container ID:
- Weight of
Container:
- Temperature
- Destination
- ETA
Stage 4
- Arrival time
- Received by
employee
7 | P a g e
Screenshot of output
User interface in main.cpp
Upon running main.cpp, the pre-defined blockchain will be created. The first block in the pre-defined
blockchain, Genesis Block #0 is created and added into blockchain.
Besides, a program menu will be displayed to inform user of what they can do. User will be
prompted to choose a program which they would like to do.
Print created blockchain
Running program 1 will print all the blocks the predefined blockchain and their respective details.
8 | P a g e
The display format is as below:
[Transaction#1
.
.
Transaction Message: Data#1: Value#1 || Data #2: Value #2....]
[Transaction#2]
Note:
1. ‘ ---------- ' marks the start and end of each block.
2. Each transaction is enclosed in ‘[‘ ‘]’symbol
3. Each data in the transaction description message is separated by ‘||‘symbol
Search block by block ID in blockchain
Running program 2 will allow user to search a block in the blockchain by the Block ID. If
found, the details of the block will be printed, and user will be informed of the block’s
position index in the blockchain.
9 | P a g e
Search transaction by ID in blockchain
Running program 3 will allow user to search a transaction in the blockchain by the Transaction ID.
If found, the information of the transaction will be printed.
Search transaction info by transaction ID and key in blockchain
Running program 4 will allow user to search a description in a particular transaction (which is
inside among the blockchain) by the Transaction ID and the key of the transaction description. If
found, the information of the transaction will be printed, and user will be informed to the value to
the search key they entered.
Checking validity of input
When user’s input is of invalid type or outside of valid range, a warning message will displayed
to alert user to re-enter their choice.
10 | P a g e
11 | P a g e
Feedback Questions
How was your overall experience regarding doing this coursework?
It was quite fun. I got to learn a lot about blockchain. Initially the concept seems very intimidating
since it’s a fancy word used all around the internet, but after looking into it, it’s really just a very
simple yet smart idea. I am now more interested in the field of blockchain and hoping to work on it
in the future as well.
However, the process of finding a real life blockchain sample which is used in the supply chain is
extremely difficult, since it is considered confidential info to companies. Hence, there is heavy
reliance on assumption and imagination on making design decisions. The uncertainty was
inducing quite a lot of panic and worries.
The initial dateline given was extremely rushed, and I am glad a reasonable extension was givem, or
else I would not be able to understand the concept of blockchain and supply chain management in-
depth. I am more satisfied at the product of my coursework, since I am given enough time to absorb
the knowledge and apply the idea through detailed coding.
Key things you’ve learned while doing this coursework?
1. The idea of blockchain is just a distributed ledger which is made transparent to all
entities involved. Cryptocurrency is a case scenario where the concept of blockchain can
be applied to, but there is other cases where the concept of blockchain can be applied as
well. The design of blockchain differs according to its functionality & the type of data it is
meant to store.
2. The Wagyu Beef industry which requires proper documentation for guaranteeing the
authenticity of their product is very much suited for using blockchain to store the record.
3. How to use a debugger in IDE efficiently to view values of variable instead of
printing everything
Noteworthy difficulties you faced
1. Difficulty on understand & using pointers – but I find myself more familiar with this concept
now, esp. with using the debugger along with it
2. Difficulty on designing blockchain due to lack of info – no sample on how real life blockchain
is designed for supply chain management, heavily based in assumption
3. Issue with hash – rand() returns the same value when using seed time(0); have to
find another hashing method to deal with this issue
4. Requesting license for SHA256 hashing file -- Initially, I found a few source codes
without license; finally found one but realised the license has expired. Resorted to
contacting the author to request for a proper license, resulting in late delivery
12 | P a g e
Reference list
Gaur, V. and Gaiha, A. (2020). Building a Transparent Supply Chain. [online] Harvard
Business Review. Available at: https://hbr.org/2020/05/building-a-transparent-supply-chain
[Accessed 27 Feb. 2024].
Lawton, G. (2019). How Bumble Bee is using SAP blockchain for food traceability.
[online] SearchSAP. Available at: https://www.techtarget.com/searchsap/feature/How-
Bumble-Bee-is-using-SAP-blockchain-for-food-traceability [Accessed 27 Feb. 2024].
Litke, A., Anagnostopoulos, D. and Varvarigou, T. (2019). Blockchains for Supply Chain
Management: Architectural Elements and Challenges Towards a Global Scale Deployment.
Logistics, [online] 3(1), p.5. Available at: https://mdpi-
res.com/d_attachment/logistics/logistics-03-00005/article_deploy/logistics-03-00005.pdf
[Accessed 27 Feb. 2024].
Rosencrance, L. (2020). 7 real-life blockchain in the supply chain use cases and examples.
[online] SearchERP. Available at: https://www.techtarget.com/searcherp/feature/4-key-
blockchain-in-supply-chain-use-cases-and-examples [Accessed 27 Feb. 2024].
13 | P a g e