Login Register

Access the GIFSQ Portal

Select your user type to log in or register a new account.

Student Portal

Access your food safety courses and exams.

Instructor Portal

Manage courses, view student submissions, and grade quizzes.

Company Portal

Manage corporate setup, view employee logs, and access QA services.

GIFSQ ID: FTN-0094

← All subjects

Blockchain for Food Traceability

Unit 1: What Blockchain Is, in Plain Words

Note

Unit 1: What Blockchain Is, in Plain Words

A question to start with

A shopper picks up a bag of coffee beans. The label says the beans were grown on a small farm, dried in the sun, roasted in small batches, and shipped without long storage. The shopper likes the story, but a quiet question follows: how does anyone know the story is true? The farmer knows the harvest. The roaster knows the roast. The shop knows the delivery. Each of them holds one piece of the story, and each piece lives in a different notebook, a different computer, or a different memory. If one piece goes missing, or if two pieces disagree, the story falls apart.

Now picture a different arrangement. Every time the coffee changes hands, or changes form, a short record is written down. That record is copied to every business in the chain, so no single business holds the only copy. Once a record is written, it cannot be quietly rubbed out and rewritten. Anyone with permission can read the records in order and see the whole journey, from the farm to the shelf. That shared, ordered, hard-to-change record is the plain idea behind a blockchain. This unit explains that idea in ordinary words, without assuming any earlier knowledge of computers, money, or cryptography.

A blockchain is a way of keeping records together. The name gives the shape away: records are grouped into blocks, and the blocks are linked into a chain. Each block holds a set of records, a note of the time, and a link to the block before it. Because every block points back to the one before, the chain has an order, and changing an old record means changing every block after it, which is easy to spot. The chain is kept by many computers at once, not by one owner, so the record does not depend on one office, one hard drive, or one person remembering to keep a backup.

Questions to think about

  • If a food label tells a story about where a food came from, what evidence would make you trust that story?
  • Why might a farmer, a transporter, a processor, and a shop each keep different records about the same food?
  • What would change if all of them shared one record that none of them could quietly rewrite?
Think about the coffee question before you read on

You would trust the story more if the same facts appeared in records kept by different people, if those records agreed with each other, and if nobody could change an old record without leaving a trace. A single claim on a label is a promise. A set of matching records, kept by separate hands and fixed in order, is evidence for that promise. That is the gap blockchain tries to close: it turns a promise into a record that many parties can check.

Records, trust, and why food needs both

Food moves through many hands. A tomato is grown, picked, packed, cooled, trucked, ripened, graded, packed again, shipped, received, stored, and sold. At each step someone writes something down: the date of picking, the temperature of the truck, the batch number, the weight, the price. Those notes matter for three plain reasons.

First, they let a business run. A packer needs to know which crates came from which field. A shop needs to know which delivery arrived on which day. Without records, work stops and mistakes multiply.

Second, they let a business prove what it did. If a buyer asks whether the tomatoes were kept cool, the transporter shows the temperature log. If a shopper asks whether the flour is whole grain, the miller shows the milling record. Records are the proof behind claims.

Third, they let a business find a problem and fix it. If a batch of cheese tastes wrong, the maker traces it back to the milk, the starter culture, and the day of production. Without a trail, the maker can only guess, and guessing is slow and wasteful.

The trouble is that records are usually kept apart. Each business keeps its own system, in its own format, under its own control. One uses paper forms. One uses a spreadsheet. One uses a large database. When a question crosses from one business to the next, someone has to phone, email, or search through files to join the pieces together. That takes time, and time matters when food is perishable or when people may be at risk.

Trust is the other half of the problem. A record kept by one business can be changed by that business. A paper form can be rewritten. A spreadsheet cell can be edited. A database entry can be updated and the old value lost. Most businesses are honest, but a buyer cannot always tell an honest record from a edited one by looking at it. So buyers often rely on reputation, on inspection visits, on certificates, and on long relationships. Those tools work, but they are slow and they cost money, and they still leave gaps when a chain is long or when a new supplier joins.

A blockchain addresses this pair of problems, records kept apart and records that can be quietly changed, by changing how records are stored and shared. It does not remove the need for honest people, good farming, or careful testing. It changes the record keeping so that honest work is easier to show and dishonest work is harder to hide.

Quick self-check

Question: Why is a food record kept by one business alone weaker evidence than the same record held by several businesses?

Because one holder can change it without anyone noticing. When several independent holders keep the same record, a change in one copy stands out against the others. Agreement across copies is stronger evidence than a single copy.

Question: A tomato passes through six businesses. Each keeps good records. Why can tracing it still be slow?

Because the records live in six separate systems, in different formats, under different control. Joining them means asking each business in turn, waiting for replies, and matching batch numbers by hand. Good records in separate places are still separate.

A shared notebook that nobody owns alone

The simplest picture of a blockchain is a shared notebook. Imagine a notebook that sits on the tables of every business in a food chain at the same time. When the farmer records a harvest, the entry appears in every copy of the notebook. When the transporter records a delivery, that entry appears in every copy too. Nobody owns the only copy, and nobody can tear out a page from every copy at once.

This picture needs three careful additions before it is accurate.

First, the notebook is digital, not paper. The copies live on computers, and the computers talk to each other over a network. When a new entry is made, the computers check it against agreed rules and then add it to their copies. This checking step matters: it stops entries that break the rules, such as an entry with a missing batch number, or an entry that claims a delivery happened before the harvest.

Second, the entries are grouped and sealed. Instead of adding one line at a time to an open page, the system collects entries into a block, seals that block, and then starts the next block. Sealing means the contents are locked in a way that makes later changes visible. The seal is made with a mathematical method called hashing, which is explained in plain terms in Unit 2. For now, think of a seal as a wax seal on a letter: breaking it leaves a mark.

Third, the notebook has rules about who can write and who can read. Some blockchains are open, so anyone can read and anyone can add entries under the rules. Some are closed to a group, so only invited businesses can write, while others can only read. Food chains usually use the closed form, called a permissioned blockchain, because businesses want to share records with their partners without publishing prices and supplier names to the whole world. The choice of who can read and who can write is a design decision, and it shapes how useful the chain is, as Unit 5 and Unit 6 explain.

It helps to separate three ideas that are often mixed together. A blockchain is a way of storing records. A network is the group of computers and businesses that keep those records. An application is the program people use to add a record or look one up, such as a phone app that scans a code on a pack. When someone says "we use blockchain", they usually mean all three together: a shared record, a network of keepers, and a program that makes it usable. The record is the heart of it, and the rest exists to serve the record.

The shared notebook, in four steps

1. Something happens: a harvest, a delivery, a test result
↓
2. A record is written and checked against the agreed rules
↓
3. The record is copied to every computer in the network
↓
4. The record is sealed into a block, and the block joins the chain

The diagram shows the four steps from an event to a sealed record. The steps point to the diagram: nothing is sealed until it has been checked, and nothing is trusted because one person said so, but because the network checked it and kept a copy.

Quick self-check

Question: In the shared notebook picture, what does "nobody owns the notebook alone" change in practice?

It removes a single point of failure and a single point of control. If one computer fails, the other copies survive. If one business wants to rewrite history, the other copies disagree and the change is visible.

Question: Why does a food chain usually prefer a permissioned blockchain over a fully open one?

Because businesses need to share traceability facts with partners while keeping prices, volumes, and supplier lists private. A permissioned chain sets who can write and who can read, so sharing is controlled rather than public.

What a blockchain is not

A blockchain is often described as if it could do everything. Clear thinking starts with what it is not.

It is not a test. A blockchain cannot taste a tomato, measure the protein in flour, or detect bacteria in milk. Those jobs belong to laboratories, sensors, and trained people. A blockchain stores the results of tests; it does not run them. If a wrong test result is entered, the chain will preserve a wrong result faithfully. The saying in computing is that bad input gives bad output, and it applies here in full.

It is not a guarantee of truth about the physical world. A record can say that a crate of apples came from a certain orchard, but the chain cannot stand in the orchard and watch the picking. It can only show that a named party recorded that claim at a named time, and that the claim has not been changed since. Checking that the claim matches the physical food still needs inspection, sampling, and testing. The chain makes the claim checkable; it does not make the claim true by itself.

It is not the same as a database, though it shares some features. A normal database is usually kept by one owner, who can edit, delete, and correct entries. That is useful: mistakes can be fixed quietly. A blockchain trades that easy editing for a different strength: once a record is sealed, it stays, and any correction must be added as a new record that points to the old one. The history stays visible, including the mistake and the correction. For food traceability, that visible history is often the point.

It is not a single product. Many different blockchain systems exist, built by different groups, with different rules, different speeds, and different costs. Saying "blockchain" is like saying "refrigeration": it names a general approach, not one machine. A food business choosing a system must ask which one fits its chain, its partners, and its budget, and whether its partners will use the same system. A chain that only one business uses is a notebook with one reader.

It is not free, and it is not instant. Running the computers, writing the programs, training staff, and keeping the system going all cost time and money. Adding a record takes a checking step, and that step takes time, even if the time is short. Unit 6 works through these costs in detail, because a business that ignores them will be disappointed.

Finally, it is not new magic. The pieces are old: record keeping, copying, checking, and sealing. What is new is putting them together so that many parties who do not fully trust each other can still share one record they all accept. That is a social achievement as much as a technical one. The technology helps strangers cooperate; it does not replace the need for cooperation.

Quick self-check

Question: A farmer enters a wrong harvest date by mistake. Does the blockchain fix the mistake by itself?

No. The chain preserves the wrong date as it was entered. The fix is a new record that corrects the old one, so both the mistake and the correction stay visible in the history.

Question: Why is "blockchain proves the food is good" a misleading sentence?

Because the chain proves that a record was made and has not been changed, not that the food itself is good. Goodness is proved by farming, handling, testing, and inspection. The chain only carries the proof.

The words you will meet

A new subject brings new words. Most of them are plain once they are unpacked. A block is a group of records sealed together. A chain is the ordered list of blocks, each linked to the one before. A ledger is the whole record, the full chain from the first block to the latest. A node is one computer that keeps a copy of the ledger and helps check new records. A transaction, in food use, is one record added to the chain, such as a harvest note, a delivery note, or a test result; it does not have to involve money. A hash is the short code that seals a block and shows whether its contents have changed. Consensus is the agreed method by which the nodes decide that a new block is valid and should be added. A smart contract, covered fully in Unit 5, is a small program stored on the chain that runs automatically when agreed conditions are met.

Two more words deserve care. Immutable means hard to change without detection, not impossible to change in every sense. A blockchain is designed so that changing an old block is very hard and very visible, not so that change is forbidden by nature. If most of the network agreed to rewrite history, history could be rewritten, but doing so would be costly and obvious, and the other copies would show the difference. In practice, food chains treat sealed records as fixed, and they add corrections as new records.

Transparent means visible to those allowed to see. It does not mean visible to everyone on earth. A permissioned food chain is transparent to its members and to an auditor with permission, and closed to outsiders. That distinction matters when a business promises shoppers "full transparency": ask who can see what, and through which tool. A shopper who scans a code on a pack usually sees a summary prepared for shoppers, not the full ledger. That summary can still be useful, but it is not the same as reading the ledger itself.

Quick self-check

Question: What is the difference between a block and a ledger?

A block is one sealed group of records. The ledger is the whole chain of blocks from the first to the latest. Reading a block tells you about one set of events; reading the ledger tells you the whole history.

Question: What does immutable mean in practice for a food record?

It means the record is hard to change without detection. A sealed record stays as it was, and any correction appears as a new record, so the history shows both the original and the correction.

How a food chain would use it, at a glance

Consider a simple chain: a wheat farmer, a miller, a baker, and a shop. In the old arrangement, the farmer writes the harvest date in a notebook, the miller writes the milling date in a spreadsheet, the baker writes the baking date on a production sheet, and the shop writes the delivery date in its stock system. A shopper who asks "when was this wheat harvested" sets off a chain of phone calls.

In a blockchain arrangement, each of those four writes the same kind of record into the shared ledger, using the same batch number for the wheat. The farmer records the field, the variety, and the harvest date. The miller records the delivery, the milling date, and the flour batch. The baker records the flour batch used, the baking date, and the loaf batch. The shop records the delivery and the sale. Each record is checked, copied to all four, and sealed into a block. The loaf on the shelf carries a code that points to its batch, and scanning that code pulls up the four records in order.

Notice what has changed and what has not. The farmer still farms. The miller still mills. The baker still bakes. The work of growing and making food is untouched. What has changed is the record keeping: one shared, ordered, sealed history replaces four separate histories that had to be joined by hand. The shopper gains a readable story. The businesses gain a faster way to answer questions and to find a problem when one appears.

That glance also shows the condition for success. The chain works only if all four take part, use the same batch numbers, and enter records promptly and accurately. If the miller does not enter a record, the story has a gap. If the baker uses a different batch number, the story breaks. The technology can carry the records, but it cannot force people to write them. Unit 7 builds a full worked example of such a chain, step by step, so the conditions for success become concrete.

One loaf, four records, one story

Farmer: field, variety, harvest date, wheat batch number
↓
Miller: delivery received, milling date, flour batch number
↓
Baker: flour batch used, baking date, loaf batch number
↓
Shop: delivery received, shelf date, code on the pack

The diagram shows the four records for one loaf. The steps point to the diagram: the batch numbers link the records, and the shared ledger holds them in order, so the story can be read from the top down without phoning four businesses.

Quick self-check

Question: In the wheat example, what links the farmer record to the baker record?

The batch numbers. The wheat batch becomes the flour batch, and the flour batch is named in the baking record. Without matching batch numbers, the records are four separate notes about four separate lots.

Question: What happens to the loaf story if the miller never enters a record?

The story has a gap between the farm and the bakery. The chain cannot invent the missing milling record, and the shopper sees a journey with a step missing.

Common misunderstandings to set aside

Several misunderstandings appear whenever blockchain is discussed. Setting them aside now will make the later units easier.

The first is that blockchain replaces testing, inspection, or good practice. It does not. It records the results of those activities. A chain full of untested claims is still untested.

The second is that blockchain means no trust is needed at all. Some trust is still needed: trust that the person entering a record measured correctly, trust that a sensor was calibrated, trust that a sample was truly taken from the lot it names. The chain reduces trust in record keeping, because copies agree and changes are visible. It does not remove trust in the physical work that produces the records.

The third is that blockchain is the same as putting a code on a pack. A code on a pack, such as a bar code or a square matrix code, is only a pointer. It points to a record somewhere. That record may live in one company's database, in a shared ledger, or nowhere at all. The code is the key; the blockchain is one kind of room the key can open. A code that points to a single database is not a blockchain, even if the code looks modern.

The fourth is that blockchain works by itself once it is bought. It works only when people use it: entering records on time, using the same batch numbers, checking sensor data, and reading the ledger when a question arises. A system nobody uses is a notebook nobody writes in.

The fifth is that more data is always better. A chain that records everything, including facts nobody will ever ask about, becomes large, slow, and costly. Good design records the facts that answer real questions: where a food came from, when it moved, how it was kept, what tests it passed, and who handled it. The rest can stay in the business systems where it already lives. Unit 6 returns to this point, because deciding what to record is one of the most useful skills in this subject.

Quick self-check

Question: A pack carries a square code that opens a web page with the farm name. Does that prove the product uses a blockchain?

No. The code is only a pointer. The page could come from one company's database. Blockchain is about how the record behind the page is stored and shared, not about the code printed on the pack.

Question: Why is "record everything" a poor design rule for a food blockchain?

Because every record costs time, storage, and checking. Recording facts nobody will ask about makes the chain large and slow without adding answers. Good design records the facts that answer real questions about origin, movement, keeping conditions, tests, and handling.

Try it yourself

Pick one food in your kitchen that has a label story: a jar of honey, a bag of rice, a pack of tea, or a bottle of oil. Read the label and write down every claim it makes about origin, method, or quality. Then list the records that would be needed to support each claim, and name who would have made each record: the grower, the processor, the packer, the tester, the transporter. For each record, ask two questions: who holds the only copy today, and what would happen if that copy were changed? Finally, sketch the shared notebook for that food: which businesses would need to join, and what would each one record? Bring your sketch to your next session and compare it with a classmate: where do your notebooks agree, and where do they differ?

Key ideas to carry forward

  • A blockchain is a shared, ordered, hard-to-change record, kept as blocks linked into a chain and copied across many computers.
  • Food chains need records for running the work, proving claims, and finding problems, but records kept apart are slow to join and easy to change quietly.
  • The shared notebook picture captures the idea: one record, checked against agreed rules, copied to every member, sealed into a block.
  • A blockchain does not test food, does not guarantee that a claim about the physical world is true, and does not replace honest work.
  • Food chains usually use permissioned blockchains, where who can write and who can read is set by design.
  • Immutable means hard to change without detection, and transparent means visible to those allowed to see, not visible to everyone.
  • The chain works only when every party takes part, uses the same batch numbers, and enters records promptly and accurately.
  • A code on a pack is only a pointer to a record; the blockchain is one way of storing the record it points to.

Glossary

Batch

A quantity of food produced, processed, or packed under the same conditions, given one batch number so it can be traced as a group. Food tech example: all loaves baked from one flour delivery on one morning form one batch.

Block

A group of records sealed together as one unit in a blockchain. Food tech example: one block holds the harvest, delivery, and milling records for a wheat lot.

Blockchain

A shared record made of blocks linked in order, copied across many computers, so that sealed records are hard to change without detection. Food tech example: a blockchain holds the journey of a coffee lot from farm to shop in ordered blocks.

Chain

The ordered list of blocks, each linked to the block before it, forming the full history. Food tech example: the chain for a tomato lot runs from picking through packing, transport, and sale.

Consensus

The agreed method by which the computers in a network decide that a new block is valid and should be added. Food tech example: the network agrees a delivery record is valid only when its batch number matches the harvest record.

Distributed network

A group of computers, each keeping a copy of the ledger, that compare copies and agree on the correct record. Food tech example: the farmer, miller, baker, and shop each run a computer holding the same ledger.

Hash

A short code made from a longer piece of data, which changes completely if even one letter of the data changes, used to seal a block. Food tech example: the hash of a milling record changes if the milling date in that record is edited.

Immutable

Hard to change without detection, because sealed records are copied widely and linked in order. Food tech example: a sealed harvest record is immutable in practice, so a correction must be added as a new record.

Ledger

The whole record held in a blockchain, the full chain from the first block to the latest. Food tech example: the ledger for a dairy holds every milk collection, test, and delivery record in order.

Node

One computer in a blockchain network that keeps a copy of the ledger and helps check new records. Food tech example: the packing house computer is a node holding the tomato ledger.

Permissioned blockchain

A blockchain in which only invited members can write records, and reading is set by permission, rather than open to everyone. Food tech example: a permissioned chain lets a miller and a baker share records while keeping prices private.

Record

One written fact about a food or an event, such as a harvest date, a temperature, or a test result. Food tech example: a temperature reading from a milk tanker is one record.

Smart contract

A small program stored on a blockchain that runs automatically when agreed conditions are met. Food tech example: a smart contract releases payment when a delivery record and a temperature record both arrive within the agreed limits.

Traceability

The ability to follow a food forward to its buyers and back to its origin through linked records. Food tech example: a batch number lets a shop trace a loaf back to the wheat field it came from.

Transaction

In blockchain use, one record added to the chain, such as a harvest note or a delivery note; it does not have to involve money. Food tech example: recording a milk collection is one transaction on a dairy chain.

Transparent

Visible to those allowed to see, so that members and permitted auditors can read the shared record. Food tech example: a chain is transparent to its member businesses and to an auditor with permission, and closed to outsiders.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.
  • Nielsen, S. S., Introduction to the Chemical Analysis of Foods, 1997.

Unit 2: How a Block and a Chain Work

Note

Unit 2: How a Block and a Chain Work

A question to start with

A dairy collects milk from ten farms every morning. Each tanker load is tested, cooled, and delivered to a processing plant. One morning, a test shows a problem in one tanker. The plant manager asks a simple question: which farms supplied that tanker, and which other products used milk from the same farms that day? If the records are kept in separate notebooks and spreadsheets, the answer takes hours of phone calls. If the records are kept in a blockchain, the answer is a walk along a chain: each record points to the one before it, and each block is sealed, so the history can be read in order without wondering whether a page was rewritten overnight.

This unit opens the box. It explains what sits inside a block, how a hash seals it, how blocks link together, and how a network of computers agrees on the next block. The explanations use ordinary pictures: envelopes, fingerprints, and wax seals. No mathematics beyond simple arithmetic is needed, and no earlier computing knowledge is assumed.

Questions to think about

  • If you seal a letter in an envelope, how would you know later whether someone opened it?
  • A record says milk was collected at 6 in the morning. What would prove that the time was written at 6, and not added later?
  • Why would ten computers holding the same record be harder to fool than one computer holding it alone?
Think about the sealed letter before you read on

A wax seal tells you the envelope was opened if the seal is broken, because the seal cannot be remade exactly as it was. A hash works the same way for digital data: it is a short code made from the contents, and any change to the contents makes a different code. If the code on file no longer matches the contents, someone changed the contents after the seal was made.

What sits inside a block

A block is a container. Like a folder in a filing cabinet, it holds a set of papers together and carries a label on the outside. The papers inside are the records, called transactions in blockchain language. In food use, a transaction is one fact: a harvest note, a delivery note, a temperature reading, a test result, a handover signature. A block holds many such facts, grouped because they arrived close together in time or because they belong to the same step in the chain.

A block also carries three pieces of information that are not food facts but bookkeeping. The first is a timestamp, the date and time the block was made. The second is the hash of the previous block, the seal of the block before it, which is copied into this block as its link backwards. The third is the hash of this block itself, its own seal, made from everything inside it, including the previous block hash. These three pieces turn a pile of records into an ordered, sealed unit.

Think of a block as an envelope with a list of contents written on it. The envelope holds the records. The timestamp is the postmark. The previous block hash is the address of the sender, showing where this envelope came from in the sequence. The block hash is the wax seal across the flap. If anyone opens the envelope and changes a record inside, the seal no longer matches, and the tampering is visible to anyone who checks.

The size of a block, meaning how many records it holds, is set by the design of the system. Some systems seal a block every few seconds, holding only a few records. Others wait longer and hold many more. For food chains, the choice matters: sealing often gives a finer history, with each small step in its own block, while sealing rarely gives larger blocks that are simpler to store but coarser in time. There is no single right answer. The right answer depends on how often records arrive and how fine the history needs to be when a problem must be traced.

Quick self-check

Question: Name the three bookkeeping pieces a block carries besides its records.

A timestamp, the hash of the previous block, and the hash of the block itself. The timestamp fixes the time, the previous hash links backwards, and the own hash seals the contents.

Question: Why group records into blocks instead of sealing each record on its own?

Grouping is more efficient: one seal and one agreement step covers many records at once. Sealing each record alone would mean repeating the sealing and checking work for every single fact.

Hashing: a fingerprint for data

A hash is the heart of the sealing idea, so it deserves a careful, plain explanation. A hash function is a method that takes any amount of data, a word, a page, a whole record, and turns it into a short code of fixed length. The same data always gives the same code. Different data gives a different code, and even a tiny change, one letter, one digit, one extra space, gives a completely different code. The code is called the hash, or the digest, of the data.

Three features of a hash make it useful for sealing. First, it is one way: given the code, you cannot work backwards to rebuild the original data. The code is a fingerprint, not a copy. Second, it is sensitive: the smallest change in the data changes the code, so the code acts as a tripwire. Third, it is fixed in length: whether the data is one word or one thousand pages, the code is the same length, so it is easy to store and compare.

A homely comparison helps. A fingerprint identifies a person without being the person. Two people have different fingerprints, and a cut on a finger changes the print. A hash identifies a piece of data in the same way: it is a short mark that belongs to that data and to no other data, as far as anyone can practically tell. If the data changes, its fingerprint changes, and the old fingerprint no longer matches.

In a block, hashing is used twice. Each record can be hashed, so its fingerprint is known. Then all the record fingerprints, together with the timestamp and the previous block hash, are hashed again to make the block hash. That block hash is the seal on the envelope. Anyone can recompute it: take the contents as they now stand, run the same hash method, and compare the result with the seal on file. If the two match, the contents are as they were when sealed. If they differ, something changed after sealing.

A common question is whether two different sets of data could give the same hash by accident. In theory, yes, because there are more possible sets of data than possible codes. In practice, with the hash methods used in blockchains, finding two different inputs with the same code is so hard that it is treated as impossible for ordinary purposes. The codes are long enough, and the methods are designed well enough, that a matching pair cannot be found by searching in any realistic time. Food technologists do not need to test this claim; they need to know that the seal is trusted because the mathematics behind it has been tested by many specialists over many years.

How a hash seals a record

The record: milk collected, farm 4, 6 in the morning, 800 litres, temperature 4 C
↓
The hash method turns the record into a short fixed code
↓
The code is stored as the seal: same record, same code, every time
↓
Change one digit, and the code changes completely: the seal is broken

The diagram shows hashing as a fingerprint. The steps point to the diagram: the code depends on every letter and digit, so checking the code checks the whole record at once.

Quick self-check

Question: A temperature record says 4 C. Someone edits it to 14 C after sealing. How does the hash reveal the edit?

The edited record gives a different hash from the seal stored with the block. Recomputing the hash from the edited record and comparing it with the stored seal shows a mismatch, which proves the contents changed after sealing.

Question: Why is a hash called one way?

Because the code cannot be turned back into the original data. Knowing the fingerprint does not tell you the contents of the record; it only lets you check whether a given record matches that fingerprint.

Linking blocks into a chain

A single sealed block is useful, but the power of a blockchain comes from linking blocks together. The link is simple: each block carries the hash of the block before it. That means the seal of the earlier block is written inside the later block, and the seal of the later block is made from its own contents plus that copied seal. The blocks form a sequence in which each step depends on the one before it.

The first block in a chain is special. It has no block before it, so its previous-hash field is empty or set to a fixed starting value. It is called the genesis block, meaning the beginning block. Every block after it points back, directly or through the blocks between, to the genesis block. Reading the chain backwards from the latest block walks through every earlier block in reverse order, and reading forwards from the genesis block walks through the history in the order it happened.

This linking is what makes quiet editing so hard. Suppose someone changes a record in an old block. The hash of that block changes, because the contents changed. But the next block still carries the old hash as its link. The link no longer matches, so the mismatch is visible. To hide the change, the person would have to update the next block to carry the new hash, but updating the next block changes its hash too, so the block after that would mismatch, and so on, all the way to the latest block. Changing one old record means resealing every block after it, and doing so on every copy held by every computer in the network. That is the work that makes tampering impractical, not a lock that cannot be picked in principle.

It is worth pausing on the word impractical. In a small network where one party controls most of the computers, rewriting history is easier than in a large network where many independent parties hold copies. Food chains are usually small networks, with a handful to a few dozen members. Their security rests partly on the linking and partly on the members watching each other: if one member reseals a long stretch of blocks, the others will see the change and ask questions. The mathematics makes tampering hard; the members make it visible.

Quick self-check

Question: Why does changing one old block force changes in every later block?

Because each later block carries the hash of the block before it, and its own hash is made from its contents plus that carried hash. Change the old block, and its hash changes; the next block link mismatches, and fixing that link changes the next block hash, and the effect runs forward to the latest block.

Question: What is the genesis block?

The first block in a chain. It has no previous block, so its previous-hash field is empty or a fixed starting value. Every later block links back to it through the blocks between.

The network: many copies, one agreed history

A chain stored on one computer is only a sealed list. A blockchain stores the chain on many computers at once, and those computers work together to agree on what the chain contains. Each computer that keeps a copy is a node. When a new block is ready, the nodes check it and agree whether to add it. The method they use to agree is called consensus.

Consensus exists because computers can disagree. One node may receive a new block a moment before another. Two nodes may receive two different blocks at the same time. A node may go offline and miss several blocks. Without an agreed method for settling these differences, the copies would drift apart and there would be no single history to trust. Consensus is the set of rules that keeps the copies in step.

Food blockchains usually use consensus methods suited to a closed group of known members. In such methods, the members take turns proposing blocks, or a chosen set of members votes on each block, and a block is added only when enough members agree it follows the rules. The rules include simple checks: the records must be well formed, the batch numbers must be present, the previous hash must match the latest block, the timestamp must be sensible, and the proposer must be allowed to propose. A block that fails any check is refused, and the proposer can try again with a corrected block.

This is different from the consensus used in large open networks for digital money, where anyone may join and the method must guard against strangers. Those methods often ask computers to solve hard puzzles, which uses a great deal of energy. A closed food network does not need that: its members are known, invited, and bound by contracts, so agreement can be reached by voting or by turn taking, using far less energy. When a vendor describes a food system, ask which consensus method it uses and why. A method built for open money networks is a poor fit for a closed food chain, and its energy cost is a needless burden.

Once consensus is reached, every node adds the new block to its copy. If a node was offline, it catches up by copying the missing blocks from other nodes and checking each seal and link as it goes. A node that returns with a different history, because it was given false blocks while it was away, will find its seals and links do not match the majority, and it will replace its copy with the agreed one. In this way, the network heals itself after faults, as long as most nodes are honest and in step.

How a new block joins the chain

1. Records arrive: deliveries, tests, handovers
↓
2. A member gathers the records into a proposed block
↓
3. The nodes check the block: format, batch numbers, links, time
↓
4. Enough nodes agree: consensus is reached
↓
5. Every node adds the block to its copy of the chain

The diagram shows the five steps from arriving records to a shared block. The steps point to the diagram: no block joins the chain until it has been checked and agreed, so a single faulty node cannot rewrite the history alone.

Quick self-check

Question: What does consensus decide?

Whether a proposed block is valid and should be added to every copy of the chain. It settles disagreements between nodes so that all copies hold the same history.

Question: Why does a closed food network not need the energy-heavy consensus used for open digital money?

Because its members are known and invited, and bound by contracts. Agreement can be reached by voting or turn taking among known members, without asking computers to solve hard puzzles.

Reading the chain: tracing forward and back

Once a chain exists, reading it is a matter of following links. Each record carries a batch number, a date, and the names of the parties involved. To trace a food backwards, start with the batch number on the finished pack, find the record that used that batch, follow its link to the batch it came from, and repeat until the farm is reached. To trace forwards, start with a farm batch and follow the records that used it, through processing and packing, to every finished pack that contains it. This two-way walk is the core skill of traceability, and the chain makes it fast because the links are already in place.

A worked miniature shows the walk. A loaf carries batch L-88. The baking record for L-88 names flour batch F-41. The milling record for F-41 names wheat batch W-12. The harvest record for W-12 names a field and a date. Four steps back, and the loaf is tied to its field. Forward, the wheat batch W-12 also appears in the milling record for flour batch F-42, which appears in a second baking record, so the same wheat reaches two different loaf batches. A recall of wheat batch W-12 would list both loaf batches, and no others, because the links show exactly where that wheat went.

In a paper system, the same walk means searching four filing cabinets and matching numbers by hand. In a blockchain, the walk is a search through ordered, linked records, and a computer can do it in moments. The speed matters most when the question is urgent, as Unit 4 explains for recalls. Speed also matters for ordinary questions: a buyer who asks about a delivery does not want to wait a week for an answer assembled from phone calls.

Reading the chain also means checking it. An auditor who wants to verify a chain starts at the latest block and recomputes hashes backwards, checking that each block hash matches its contents and that each link matches the block before it. A single mismatch points to the block where the history was disturbed. The auditor also checks that the copies held by different nodes agree. If they do, and the seals check out, the history is intact as far as the chain can show. The auditor still needs to check the physical world, by visiting farms and testing samples, but the chain check is a fast first step that shows whether the records themselves are sound.

Quick self-check

Question: Trace a loaf with batch L-88 back to its wheat. What do you follow?

The batch numbers. The baking record for L-88 names a flour batch, the milling record for that flour names a wheat batch, and the harvest record for that wheat names the field and date.

Question: Why is forward tracing as useful as backward tracing?

Because a problem found at the start, such as a faulty wheat batch, must be followed forward to every finished product that contains it. Backward tracing finds the cause; forward tracing finds everything affected.

Keys, signatures, and proving who wrote a record

A shared notebook is only useful if each entry can be tied to its writer. Otherwise anyone could write a harvest record in the farmer name. Blockchains tie entries to writers with digital signatures, which are built from a pair of keys: a private key that only the writer holds, and a public key that everyone can know. The writer uses the private key to sign a record, and anyone can use the public key to check that the signature belongs to that writer and that the record has not changed since it was signed.

A plain comparison helps. A handwritten signature on a delivery note ties the note to the person who signed it, because others can compare the signature with a known example. A digital signature does the same work, with two strengths a handwritten signature lacks: it is tied to the exact contents of the record, so changing one digit breaks the signature, and it can be checked by any computer in the network without a person comparing handwriting. The private key is like a pen that only one person holds; the public key is like a sample of their handwriting kept on file for comparison.

Keeping private keys safe is a practical duty. If a private key is lost, its owner cannot sign new records until a replacement is arranged. If a private key is stolen, the thief can sign records in the owner name until the theft is found and the key is revoked. Food businesses must therefore treat private keys like the keys to a store room: held by named people, stored safely, never shared by email, and replaced promptly if lost or suspected stolen. A chain whose signatures cannot be trusted is a notebook whose writers cannot be identified, and its records lose much of their value.

Signatures also make the checking step in consensus possible. When a node receives a proposed block, it checks that each record in the block carries a valid signature from a member allowed to write that kind of record. A delivery record signed by the transporter passes. The same record signed by a stranger, or by a member who is not allowed to record deliveries, fails. In this way, the network enforces who may say what, not only what may be said.

Quick self-check

Question: What does a digital signature prove about a record?

It proves which key holder signed it, and that the record has not changed since signing. Anyone with the public key can check both facts without knowing the private key.

Question: What goes wrong if a private key is stolen?

The thief can sign records in the owner name until the theft is found and the key is revoked. Records signed with the stolen key during that time cannot be trusted on the signature alone.

Try it yourself

Take a sheet of paper and make a small chain by hand. Write three records: a harvest note, a delivery note, and a packing note, each with a batch number, a date, and a quantity. For each record, invent a short seal: write the first letter of each word in the record, in order, as a simple fingerprint. Now make a block: copy the three fingerprints, add a time, and make a block seal from the first letters of all of them. Make a second block with three more records, and copy the first block seal into it as its link. Then change one digit in the first block, and try to work out what else must change to hide the edit. Write down every step you would have to redo. That list is a plain picture of why linked, sealed blocks resist quiet editing.

Key ideas to carry forward

  • A block holds a set of records plus a timestamp, the hash of the previous block, and its own hash.
  • A hash is a short fixed code made from data: same data gives the same code, any change gives a different code, and the code cannot be turned back into the data.
  • Blocks link by carrying the previous block hash, so changing one old block breaks the links in every block after it.
  • The first block, the genesis block, has no previous block.
  • Nodes are computers that keep copies of the chain; consensus is the agreed method by which they decide a new block is valid.
  • Closed food networks can use voting or turn taking for consensus, using far less energy than open money networks.
  • Tracing follows batch numbers forward and back along the linked records.
  • Wrong entries are fixed by new correcting records, not by editing sealed blocks.
  • Digital signatures tie each record to its writer, using a private key to sign and a public key to check.

Glossary

Block hash

The short code made from everything inside a block, including its records, timestamp, and previous block hash, used as the block seal. Food tech example: the block hash changes if a delivery date inside the block is edited.

Consensus

The agreed method by which nodes decide that a new block is valid and should be added to the chain. Food tech example: the network agrees a block is valid only when enough member nodes have checked and accepted it.

Digital signature

A mark made with a private key that ties a record to its writer and shows whether the record changed after signing. Food tech example: a transporter signs a delivery record, and any node can check the signature with the transporter public key.

Fingerprint

A plain word for a hash: a short code that identifies a piece of data and changes when the data changes. Food tech example: the fingerprint of a test result changes if one digit of the result is altered.

Fork

A short split in the chain when two blocks are proposed at the same time, settled by consensus rules. Food tech example: two packing houses propose blocks at the same moment, and the network keeps one branch as the agreed history.

Genesis block

The first block in a chain, with no previous block to link to. Food tech example: the genesis block of a dairy chain holds the first milk collection records when the chain starts.

Hash

A short fixed-length code made from data by a hash method, which changes completely when the data changes. Food tech example: a hash of a milling record lets anyone check that the record was not edited after sealing.

Node

One computer in a blockchain network that keeps a copy of the ledger and helps check new blocks. Food tech example: the mill computer is a node in the wheat chain.

Off-chain

Stored outside the blocks, such as full reports and photographs, linked to the chain by hashes. Food tech example: a full laboratory report is stored off-chain, and its hash is stored on-chain.

On-chain

Stored inside the blocks, such as batch numbers, dates, quantities, and hashes. Food tech example: the batch number and harvest date of a wheat lot are stored on-chain.

Previous block hash

The hash of the block before the current one, copied into the current block as its link backwards. Food tech example: each new block in a tomato chain carries the hash of the block before it.

Private key

A secret key held only by its owner, used to sign records. Food tech example: a farmer keeps a private key safe and uses it to sign harvest records.

Public key

A key shared openly, used by anyone to check a digital signature made with the matching private key. Food tech example: the packing house public key lets anyone check that a packing record was signed by that house.

Seal

A plain word for a block hash: the mark that shows whether a block contents have changed since sealing. Food tech example: a broken seal on a block tells an auditor that its contents were changed.

Timestamp

The date and time recorded with a block, showing when the block was made. Food tech example: the timestamp on a delivery block shows when the delivery record was sealed.

Transaction

One record added to a blockchain, such as a harvest note or a test result. Food tech example: recording a milk collection is one transaction on a dairy chain.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.

Unit 3: Traceability: Following Food from Farm to Fork

Note

Unit 3: Traceability: Following Food from Farm to Fork

A question to start with

A crate of mangoes arrives at a packing house. The crates are washed, graded, packed into boxes, cooled, loaded onto a truck, and sent to a distribution centre, where the boxes are split and sent to many shops. Weeks later, a shopper asks a simple question: which orchard did these mangoes come from, and what happened to them on the way? In a paper system, the answer means searching the packing house log, the cooling log, the transport log, and the distribution log, and matching lot numbers by hand at each step. In a well built traceability system, the answer is a single walk along linked records, from the shop shelf back to the orchard, with every handover in between.

Traceability is the ability to follow a food forward and back through its journey. This unit explains what traceability means in food work, how a chain of records is built step by step, and how blockchain changes the way that chain is kept. It also explains the points where a traceability chain breaks, because a chain is only as strong as its weakest link.

Questions to think about

  • A bag of flour has a batch number on it. What should that number let you find out, and what can it not tell you?
  • When a food is mixed, split, or repacked, what happens to its identity, and how should the records handle that?
  • Why is tracing a food forward, to its buyers, as important as tracing it back to its origin?
Think about the mango crate before you read on

The batch number should let you find the orchard, the picking date, the packing date, the cooling and transport records, and the shops that received boxes from that crate. It cannot tell you those things by itself: it is only a pointer. The records behind the pointer do the work, and they work only if every handler used the same number and recorded each handover.

What traceability means in food work

Traceability has a plain definition: the ability to follow the movement of a food through specified stages of production, processing, and distribution. That definition hides three separate abilities, and each one matters.

The first is tracing back, also called backward traceability. Starting from a finished product, you follow the records back to its ingredients, its suppliers, and its origin. A loaf is traced back to flour, flour to wheat, wheat to a field. Backward tracing answers the question: where did this come from?

The second is tracing forward, also called forward traceability. Starting from an ingredient or a raw material, you follow the records forward to every finished product that contains it. A wheat lot is traced forward to every flour batch milled from it, and to every loaf baked from that flour. Forward tracing answers the question: where did this go?

The third is internal traceability, the record keeping inside one business. A factory receives an ingredient, stores it, uses it in several production runs, and ships the finished products. Internal traceability links the incoming lot to the outgoing lots inside that factory, so that a problem in one incoming lot can be tied to the exact production runs that used it, and no others. Without internal traceability, a factory that used a faulty ingredient in one run out of ten would have to suspect all ten runs, because it could not tell them apart.

These three abilities rest on one foundation: identity. A lot must keep its identity as it moves, or the records must show how its identity changes. When wheat becomes flour, the identity changes from a wheat batch to a flour batch, and the record must link the two. When a large lot is split into small packs, one identity becomes many, and the record must list all of them. When several lots are mixed into one, many identities become one, and the record must list all the inputs. Losing identity at any of these steps breaks the chain, even if every other step is recorded perfectly.

Quick self-check

Question: What is the difference between backward and forward traceability?

Backward traceability follows a finished product back to its origin and ingredients. Forward traceability follows an ingredient forward to every finished product that contains it. Both use the same linked records, walked in opposite directions.

Question: Why does internal traceability matter inside a single factory?

Because a factory may use one incoming lot in only some of its production runs. Internal records link the incoming lot to the exact runs that used it, so a problem can be tied to those runs and no others.

Lots, batches, and keeping identity

A lot is a quantity of food produced, processed, or packed under the same conditions. A batch is a similar idea, often used for a production run. The exact words vary between businesses, but the idea is steady: a lot or batch is a group that is treated as one for tracing. When a problem is found in one item from a lot, the whole lot is suspected until the records show otherwise, because the items in a lot shared the same conditions.

Giving a lot a number is the first step, and it sounds simple, but it is where many chains fail. The number must be unique, meaning no two different lots share it. It must be used by every handler, meaning the same number travels with the food from one business to the next. It must be recorded at every handover, meaning the sender and the receiver both note the number. And it must be linked when identity changes, meaning a new number is tied to the old numbers it came from.

Consider a simple mixing step. Two wheat lots, W-10 and W-11, are milled together into flour batch F-20. The milling record must name both input lots. If it names only one, the link to the other is lost, and flour batch F-20 can only be traced back to one of its two sources. Now consider a splitting step. Flour batch F-20 is packed into one hundred sacks. The packing record must show that all one hundred sacks came from F-20, and each sack should carry a code that points back to F-20. If the sacks carry only a packing date, with no batch link, they cannot be traced back to the wheat at all.

Time also matters. A lot number alone does not say when a step happened. The record needs a date and a time, so that the order of events is clear. If two lots are mixed, the record should show which lots, in what amounts, and when. If a lot is stored, the record should show where it was stored and for how long, because storage conditions affect quality and safety. A lot number without dates and places is a name without a story.

Identity through mixing and splitting

Two wheat lots: W-10 and W-11, each with its own harvest record
↓
Milling record: F-20 is made from W-10 and W-11, amounts and date shown
↓
Packing record: F-20 is split into sacks, each sack code points to F-20
↓
Any sack can be traced back: sack to F-20, F-20 to W-10 and W-11

The diagram shows how identity is kept through a mix and a split. The steps point to the diagram: the milling record must name both inputs, and the packing record must link every sack to its flour batch, or the chain breaks at that step.

Quick self-check

Question: Two wheat lots are milled together, but the milling record names only one. What is lost?

The link to the second lot. Flour from that milling can only be traced back to the named lot, so a problem in the unnamed lot cannot be tied to the flour, and a problem in the flour cannot be tied to the unnamed lot.

Question: Why must a lot number be unique?

Because the number is the pointer that links records together. If two different lots share a number, their records mix together, and tracing follows the wrong path.

The journey in stages: farm, transport, processing, packing, shop

A food journey has stages, and each stage adds records. The farm stage records what was grown, where, when it was harvested, and what was applied to the crop or given to the animals. For crops, that may include the variety, the field, the planting and harvest dates, and the inputs used. For animals, it may include the breed, the feed, and health treatments. These records are the start of the chain: without a clear origin record, everything after it hangs from an unknown beginning.

The transport stage records movement. A load leaves the farm on a named vehicle, at a named time, at a named temperature, and arrives at a named place. If the food is chilled or frozen, temperature readings during the journey matter, because a break in the cold chain can spoil food that looks fine on arrival. Transport records also show handovers: the farmer hands the load to the driver, the driver hands it to the receiver, and each handover is a point where responsibility passes from one party to another. A record that shows a handover without a signature is a gap: nobody can prove who held the food at that point.

The processing stage records transformation. Wheat becomes flour. Milk becomes cheese. Tomatoes become sauce. Each transformation needs a record that names the inputs, the process, the date and time, the equipment or line used, and the outputs. Processing also creates the most complex identity changes, because inputs are mixed, split, heated, cooled, and combined. Internal traceability inside the factory is built at this stage, and it is the stage where a sloppy record causes the most damage, because one faulty input can spread into many outputs.

The packing stage records the finished product. The pack carries a code, a batch number, a date, and often a weight. Packing records link the finished packs to the production run, the production run to the inputs, and the inputs to their origins. Packing is also where the shopper meets the chain: the code on the pack is the pointer a shopper or an inspector can use to start a trace. If the code is wrong, unreadable, or missing, the trace cannot start, however good the records behind it are.

The shop stage records receipt, storage, and sale. The shop notes which delivery arrived, when, in what condition, and where it was stored. Some shops record sales by batch, so a sold item can be tied to a delivery. Others record only that a product was sold, without tying the sale to a batch. That difference decides whether a shop can find the buyers of a faulty batch or only know that the product was on sale. Shops that sell loose food, such as fruit from a crate, face a harder task: once the fruit is loose on a display, the link to its crate is broken unless the shop keeps a display record tying the display to the crate it came from.

Quick self-check

Question: At which stage does a food identity change most, and why?

At processing, because inputs are mixed, split, heated, cooled, and combined into new products. Each change needs a record linking the new identity to the old ones, or the chain breaks there.

Question: Why is a handover record important in transport?

Because a handover is the point where responsibility passes from one party to another. Without a signed handover, nobody can prove who held the food, when, and in what condition, at that point in the journey.

How blockchain changes the record keeping

Traceability without blockchain is possible, and many food businesses already do it with paper, spreadsheets, and databases. Blockchain does not invent traceability. It changes how the traceability record is kept, and that change brings three differences that matter in practice.

The first difference is sharing. In a paper system, each business holds its own records and shares them on request. In a blockchain system, the records are shared by design: every member holds a copy of the shared ledger, and a new record appears in every copy once it is checked and sealed. A question that once meant a round of phone calls becomes a search in a ledger that everyone already holds. The saving is not in the writing of records, which still takes the same work, but in the finding of records when a question arises.

The second difference is order and sealing. Paper records can be filed out of order, and a spreadsheet row can be edited without a trace. Blockchain records are sealed in order, and an edit after sealing is visible, as Unit 2 explained. For traceability, this means the history can be checked quickly: an auditor can verify the seals and links and know whether the record is intact, before spending time on the food facts themselves. A paper history cannot be checked that way; its trust rests on the people who kept it.

The third difference is a single agreed history. When each business keeps its own records, two businesses can hold different versions of the same event: the sender says a load left on Monday, the receiver says it arrived on Wednesday, and the dates do not line up. A shared ledger holds one version, agreed by the network, so disagreements appear at the time of recording, when they can be fixed, rather than weeks later, when memories have faded. The ledger does not stop disagreements, but it forces them into the open early.

These differences do not remove the hard parts of traceability. Someone must still decide what a lot is, give it a unique number, record each handover, and link identities through mixing and splitting. Someone must still enter records promptly and accurately. A blockchain makes a good traceability system faster to search and harder to alter quietly. It does not make a bad traceability system good. A chain with missing records, reused numbers, or late entries is still broken, whether the records are on paper or on a chain.

Quick self-check

Question: What does blockchain add to traceability that paper records lack?

Sharing by design, sealing in order, and one agreed history. Every member holds the same ledger, sealed records show tampering, and disagreements appear at recording time rather than weeks later.

Question: A business has sloppy lot numbers and late entries. Will a blockchain fix its traceability?

No. The chain will preserve sloppy numbers and late entries faithfully. Good lot discipline and prompt recording must come first; the blockchain only carries the records that people make.

Codes on packs: the pointer a shopper can use

A traceability chain is of little use to a shopper if the shopper cannot start a trace. The starting point is the code on the pack. Several kinds of code are used, and each has strengths and limits.

A bar code is a pattern of lines that a scanner reads as a number. It is cheap, familiar, and widely used, but it usually carries only a product number, not a batch number. Two packs of the same product from different batches may carry the same bar code, so a bar code alone cannot trace a single batch. It identifies the product, not the lot.

A square matrix code, often called a QR code, is a pattern of squares that can carry far more information than a bar code: a web address, a batch number, a date, or a short text. A shopper with a phone can scan it and open a page that shows the journey of that batch. The code itself is only a pointer to a record, as Unit 1 explained. Its value depends on the record it points to: a code that points to a marketing page tells a story, while a code that points to a traceability record lets the reader check the journey step by step.

A radio tag, often called an RFID tag, is a small chip that answers a radio signal with its stored number, without needing a line of sight. Tags are useful for crates and pallets, which can be read as they pass a reader on a loading dock, without each one being picked up and scanned. They cost more than printed codes, and they are usually used for cases and pallets rather than single retail packs. For traceability, their strength is speed: a whole pallet can be read at once, and its movement can be logged automatically.

No code is useful if it is damaged, unreadable, or wrong. Labels fall off in cold and damp. Ink smears. A code printed for one batch can be stuck onto another batch by mistake. Good practice checks codes at each handover: the receiver scans the code and confirms it matches the delivery note before accepting the load. A blockchain can record that check, but it cannot do the scanning. The physical link between the food and its code is made by people, and it is the most fragile link in the whole chain.

From a code on a pack to a journey

Shopper scans the code on the pack
↓
The code points to a batch number in the ledger
↓
The ledger shows the batch journey in order: farm, transport, processing, packing, shop
↓
The shopper reads the journey, and an inspector can check the seals behind it

The diagram shows the path from a pack code to a journey. The steps point to the diagram: the code is only the starting point, and the value lies in the linked records it opens.

Quick self-check

Question: Why can a bar code alone not trace a single batch?

Because a bar code usually carries only a product number. Two packs of the same product from different batches share that number, so the bar code identifies the product, not the lot.

Question: What makes a square matrix code more useful for traceability than a bar code?

It can carry more information, such as a batch number or a web address, so scanning it can open the journey of that specific batch rather than only naming the product.

Where chains break: the weak points to watch

A traceability chain breaks at predictable points, and knowing them helps a food technologist design a chain that holds. The first weak point is the farm gate. Small producers may keep records on paper, or in memory, or not at all. Asking them to enter records into a digital system takes training, time, and a device, and if the system is hard to use, records will be late or missing. A chain that starts with a gap at the farm cannot be repaired later, because the origin is the one fact that cannot be recreated from later records.

The second weak point is mixing and splitting, as explained earlier. A factory that mixes lots without recording every input, or splits a lot without linking every output, breaks identity at the very step where identity is hardest to keep. The fix is a disciplined rule: no mixing without a record naming all inputs, and no splitting without a record naming all outputs. That rule sounds simple, and it is hard to keep under production pressure, when a line must keep moving and paperwork feels like a delay. The system must make the record quick to make, or people will skip it when they are busy.

The third weak point is the handover between businesses. A load can leave one business with a record and arrive at the next without one, if the receiver does not check and confirm. The fix is a shared rule: a delivery is not complete until the receiver has scanned the code, checked the batch number, and confirmed receipt in the ledger. That confirmation closes the loop and proves the food arrived as recorded.

The fourth weak point is the last mile: the shop display, the market stall, the loose fruit, the cut cheese. Once food is taken out of its pack and sold loose, the link to its batch is easily lost. Shops need a simple display record: this display holds fruit from crate X, this cut cheese came from wheel Y. Without it, a trace that runs cleanly from farm to shop stops at the shelf, and the shopper cannot be tied to a batch.

The fifth weak point is data entry itself. A wrong digit in a batch number, a wrong date, a quantity in the wrong unit, all break links. The fix is a mix of design and checking: use scanners instead of typing where possible, use drop-down lists instead of free text for batch numbers, and check each entry against the rules before sealing it. A system that accepts any entry without checking will seal mistakes into the chain, and those mistakes will be preserved as faithfully as correct entries.

Quick self-check

Question: Why is the farm gate a common weak point in traceability?

Because small producers may keep records on paper or in memory, and a digital system takes training, time, and a device. If farm records are late or missing, the origin is lost and cannot be recreated from later records.

Question: A shop sells fruit loose from a crate. What record keeps the trace alive?

A display record tying the display to the crate it came from. Without it, the trace stops at the shelf, because loose fruit carries no code.

Try it yourself

Choose a food with several ingredients, such as a loaf of bread, a jar of jam, or a pack of biscuits. Draw its journey on a sheet of paper, from the farm or farms to the shop, with a box for each stage and an arrow between boxes. Under each box, write the records that stage should make: what was received, what was done, what was sent on, and which batch numbers link it to the next stage. Mark every place where identity changes, by mixing or splitting, and write the record that must link the old identity to the new one. Then mark the weak points in your drawing: where would a record most likely be missed, and what simple rule would close that gap? Bring the drawing to your next session and compare it with a classmate: whose chain has fewer gaps, and why?

Key ideas to carry forward

  • Traceability is the ability to follow a food forward to its buyers and back to its origin, through linked records.
  • Backward tracing finds where a finished product came from; forward tracing finds where an ingredient went; internal tracing links inputs to outputs inside one business.
  • A lot or batch keeps its identity through a journey, and records must link old identities to new ones when food is mixed or split.
  • Each stage adds records: farm origin, transport movement and handovers, processing transformation, packing codes, shop receipt and sale.
  • Blockchain changes traceability record keeping by sharing the ledger, sealing records in order, and holding one agreed history.
  • Codes on packs are pointers to records: a bar code usually names the product, while a square matrix code can point to a specific batch journey.
  • Chains break at the farm gate, at mixing and splitting, at handovers, at loose sale, and at data entry, and each break needs a simple rule to close it.
  • Traceability serves quality work, label claims, and waste reduction, not only safety and recalls.
  • A chain designed without a clear list of questions will record too much or too little; design starts from the questions it must answer.

Glossary

Backward traceability

Following a finished product back through its records to its ingredients and origin. Food tech example: tracing a loaf back to the flour batch, the wheat lot, and the field it came from.

Batch number

A unique number given to a batch so its records can be found and linked. Food tech example: a flour batch number links milling, packing, and baking records for that flour.

Forward traceability

Following an ingredient forward through its records to every finished product that contains it. Food tech example: tracing a wheat lot forward to every flour batch and every loaf made from it.

Handover

The point where a food passes from one party to another, with responsibility passing at the same time. Food tech example: a driver signs a handover when a milk tanker load is received at a plant.

Identity

The link between a food and its records, kept through a journey even when the food changes form. Food tech example: a wheat lot keeps its identity as it becomes flour, through a milling record that links the two batch numbers.

Internal traceability

Record keeping inside one business that links incoming lots to the production runs and outgoing lots that used them. Food tech example: a factory links a milk lot to the exact cheese batches made from it.

Lot

A quantity of food produced, processed, or packed under the same conditions, treated as one group for tracing. Food tech example: one day production of jam from one fruit delivery is one lot.

Matrix code

A square pattern of dark and light squares that can carry a batch number or a web address, read by a phone camera. Food tech example: a matrix code on a honey jar opens the journey of that honey batch.

Radio tag

A small chip that answers a radio signal with its stored number, used to read crates and pallets without a line of sight. Food tech example: a radio tag on a pallet lets a warehouse read the pallet as it passes a dock reader.

Traceability

The ability to follow a food forward to its buyers and back to its origin through linked records. Food tech example: a batch number lets a shop trace a loaf back to the wheat field it came from.

Tracing back

Walking linked records from a finished product towards its origin. Food tech example: tracing a cheese back to the milk, the farm, and the collection date.

Tracing forward

Walking linked records from an ingredient towards the finished products that contain it. Food tech example: tracing a fruit lot forward to every juice batch made from it.

Cold chain

The unbroken series of chilled or frozen links that keeps a perishable food at a safe low temperature from production to sale. Food tech example: a milk tanker, a cold store, and a chilled shop cabinet form one cold chain.

Display record

A simple record tying loose food on display to the crate or lot it came from. Food tech example: a shop note says the apples on display came from crate A-12.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.
  • Nielsen, S. S., Introduction to the Chemical Analysis of Foods, 1997.

Unit 4: Blockchain in Food Safety and Recalls

Note

Unit 4: Blockchain in Food Safety and Recalls

A question to start with

A laboratory test finds harmful bacteria in a batch of soft cheese. The cheese was made a week ago, sold in many shops, and eaten in many homes. The maker has one urgent job: find every pack from that batch, and only those packs, and get them back before more people eat them. In a paper system, that job means phoning every distributor, searching every delivery note, and guessing which shops received the batch, while the cheese keeps selling. In a system with linked, shared records, the job means one search: the batch number gives the list of shops, the quantities, and the dates, in minutes rather than days.

Food safety is the reason traceability matters most. This unit explains how a blockchain supports food safety work, how it changes a recall from a slow hunt into a fast, precise search, and where its limits lie. Safety still depends on good farming, clean processing, careful testing, and honest records. The chain makes the safety system faster and more precise; it does not replace it.

Questions to think about

  • When a food is found to be unsafe, what is the first question that must be answered, and what happens while the answer is being searched for?
  • Why is recalling too much food as harmful, in its own way, as recalling too little?
  • What would a shop need to know, in the first hour, to take the right packs off its shelves?
Think about the cheese question before you read on

The first question is: which exact batches are affected, and where are they now? While that question is being searched for, the unsafe food keeps selling and being eaten, so every hour of searching adds risk. Recalling too little leaves unsafe food on sale. Recalling too much throws away safe food, wastes money, and makes people stop trusting the next recall. A precise list, found fast, is the goal.

Food safety: the work a chain must support

Food safety means keeping food free from harm to the people who eat it. The harms fall into three broad groups. Biological harms come from living things: harmful bacteria, viruses, moulds, and parasites, and the toxins some of them make. Chemical harms come from substances: pesticide residues, cleaning chemicals, heavy metals, and allergens that are present when they should not be, or in amounts that are too high. Physical harms come from objects: pieces of glass, metal, stone, or plastic that find their way into food during growing, processing, or packing.

Keeping food safe needs many kinds of work, and each kind produces records. Growing and rearing need records of inputs, treatments, and hygiene. Processing needs records of temperatures, times, cleaning, and checks. Testing needs records of samples, methods, and results. Storage and transport need records of temperature and time. Selling needs records of receipt, storage, and date limits. When a safety problem appears, the investigation walks back through these records to find where the harm entered, and walks forward through them to find where the harmed food went.

A safety system also needs speed. Bacteria grow while records are searched. A perishable food with a short shelf life may be eaten before a slow trace finds it. A recall that takes a week to find its list is a recall that arrives after the food is gone. For that reason, safety work values two things above all: records that are ready before a problem appears, and a search that is fast when the problem does appear. A blockchain is judged, in safety use, by whether it delivers those two things.

Quick self-check

Question: Name the three broad groups of food safety harms.

Biological harms from harmful microbes and their toxins, chemical harms from unwanted substances such as residues and allergens, and physical harms from objects such as glass, metal, or stone in food.

Question: Why does speed matter so much in food safety tracing?

Because unsafe food keeps selling and being eaten while the trace is running, and bacteria grow with time. A slow trace means the recall list arrives after much of the food is already eaten.

How a recall works, step by step

A recall is the action of taking a food back from shops and buyers because it may be unsafe. It sounds like one action, but it is a sequence, and each step depends on records.

The sequence starts with detection. A laboratory test, a customer complaint, an inspection visit, or a supplier warning raises the alarm. The alarm names a product and, if the records are good, a batch. If the alarm names only a product, with no batch, the recall must cover every batch of that product, which is far wider and far more wasteful.

The next step is scope: deciding exactly which batches are affected. This is the tracing step. The investigators trace the suspect ingredient back to its source and forward to every product that used it, and they trace the finished product forward to every shop that received it. The scope should be as narrow as the evidence allows: every affected batch in, every unaffected batch out. A narrow scope saves safe food and keeps the recall credible. A wide scope, made because the records cannot tell batches apart, wastes safe food and teaches shops and shoppers to ignore the next recall.

The next step is notification. The maker tells its distributors, the distributors tell the shops, the shops tell their staff, and the public is told through notices, telling them which product, which batch, which dates, and what to do: return it, throw it away, or seek advice. Notification needs clear batch details, because a shopper who cannot tell whether their pack is affected will either keep eating it or throw away a safe pack.

The next step is removal and return. Shops take the affected packs off shelves, mark them, store them apart from safe food, and send them back or destroy them as instructed. The maker counts what comes back and compares it with what was shipped, to see how much is still missing. That comparison is a record in itself, and it shows whether the recall worked.

The last step is review. The maker, and often an inspector, asks how the harm entered, why it was not caught earlier, and what will change so it does not happen again. The review uses the same records as the trace, plus the test records, the cleaning records, and the process records. A good review turns a recall into a lesson; a poor review, with missing records, turns it into a mystery that may repeat.

At every step, the question is the same: can the records answer it, quickly and precisely? A blockchain does not run the recall, but it can make the record search at the centre of the recall far faster.

A recall, step by step

1. Detection: a test, a complaint, or a warning names a product and a batch
↓
2. Scope: trace back to the source, trace forward to every affected pack
↓
3. Notification: tell distributors, shops, and the public which batches, and what to do
↓
4. Removal: take packs off shelves, count returns, find what is still missing
↓
5. Review: find how the harm entered, and change the process so it does not repeat

The diagram shows the five recall steps in order. The steps point to the diagram: the scope step is the tracing step, and its speed and precision decide how well the whole recall works.

Quick self-check

Question: Why is a narrow recall scope better than a wide one, when both remove the unsafe food?

Because a wide scope also removes safe food, wastes money and food, and makes shops and shoppers less likely to act on the next recall. A narrow scope, based on precise batch records, removes only what is affected.

Question: What should a recall notice tell a shopper?

Which product, which batch numbers, which dates, and what to do with it: return it, throw it away, or seek advice. Without batch details, a shopper cannot tell whether their pack is affected.

Where blockchain helps a recall

Blockchain helps a recall in four plain ways, and each one maps to a step in the sequence above.

First, it shortens the scope step. In a paper system, tracing a batch means asking each business in turn, waiting for replies, and matching numbers by hand. In a shared ledger, the batch number is searched once, and the chain returns the linked records in order: the ingredients that went in, the production runs that used them, and the shops that received the outputs. The search that took days can take minutes, because the records are already joined by their links and already held by every member. The gain is largest when the chain is long and the businesses are many, because that is when a manual trace is slowest.

Second, it sharpens the scope. Because the ledger links inputs to outputs inside each factory, as Unit 3 explained, the trace can tell which production runs used a faulty ingredient and which did not. A factory that used a faulty milk lot in two runs out of ten can recall those two runs only, instead of all ten. That precision saves safe food, and it makes the recall more believable to shops and shoppers, because the list is exact rather than broad.

Third, it gives a shared, agreed list. In a paper recall, each business may hold a slightly different list of what was shipped where, and the lists must be reconciled before action. In a shared ledger, the list comes from one agreed history, so the maker, the distributor, and the shop read the same list. That agreement removes a round of arguing about numbers while the food is still on sale, and it lets the removal step start sooner.

Fourth, it leaves an audit trail for the review. Every step of the recall can be recorded on the chain: the detection record, the scope decision, the notifications sent, the quantities returned, and the review findings. Because the records are sealed in order, the review can show what was known when, and what was done when, without relying on memory. That trail is useful for the maker, for an inspector, and for a buyer who asks how the recall was handled.

These four helps are real, and they are the strongest case for blockchain in food. They are also conditional: they work only when the records are complete, the batch numbers are used consistently, and the members enter records promptly. A recall that must wait for a late entry is no faster than a paper recall, and a recall based on a chain with a missing link is no sharper than a guess.

Quick self-check

Question: How does a shared ledger shorten the scope step of a recall?

Because the records are already linked by batch numbers and already held by every member, so one search returns the ingredients, the production runs, and the shops in order, instead of a round of phone calls and hand matching.

Question: Why does a precise scope save safe food?

Because internal traceability links a faulty ingredient to only the runs that used it, so only those runs are recalled, and the runs that did not use it stay on sale.

Test results on the chain: what they can and cannot prove

Laboratory test results are central to food safety, and putting them on a blockchain raises a question that deserves care: what does a test result on a chain actually prove?

A test result on a chain proves that a named laboratory, or a named tester, recorded a named result, for a named sample, at a named time, and that the record has not been changed since. That is useful. It lets a buyer check that a test was done, and when, and by whom, without phoning the laboratory. It also lets an auditor see the full set of results for a lot, including any result that was later corrected, because corrections appear as new records.

What it does not prove is that the sample truly came from the lot it names, that the sample was taken correctly, that the method was the right one, or that the result is correct. Those facts belong to the physical work: sampling, handling, method choice, calibration, and the skill of the analyst. A chain can record that a sample was taken from a lot, but it cannot stand in the field and watch the sampling. A wrong sample, tested perfectly and recorded faithfully, gives a perfectly recorded wrong result.

This gap is sometimes called the link between the physical world and the digital record, and it is the most common source of overclaiming in food blockchain projects. A vendor may say a chain "guarantees safety" because test results are on it. The honest sentence is narrower: the chain guarantees that the test results recorded have not been changed since recording, and that anyone with permission can read them in order. Safety itself is guaranteed, as far as anything can be, by the sampling, the testing, the process control, and the handling that the records describe.

Good design narrows the gap where it can. Samples can carry codes that tie them to lots. Laboratories can sign their results with their own keys, so a result cannot be entered in a laboratory name by someone else. Test methods can be named in the record, so a reader can see whether the right method was used. Sensors can send readings directly to the chain, without a person typing them, so a temperature record is not a typed claim but a machine reading. Each of these steps makes the link between the physical world and the record stronger, but none of them removes it entirely. A food technologist should always ask, for any safety claim on a chain: who took the sample, how, and how does the record show it?

Quick self-check

Question: A test result on a blockchain says a milk lot passed. What does that prove, and what does it not prove?

It proves that a named tester recorded that result for a named sample at a named time, and the record has not changed since. It does not prove the sample was truly taken from that lot, taken correctly, or tested by the right method. Those facts belong to the physical sampling and testing work.

Question: How can design make a test result on a chain more trustworthy?

By tying samples to lots with codes, by having laboratories sign results with their own keys, by naming the test method in the record, and by letting sensors send readings directly without typing.

Temperature, the cold chain, and sensor records

Temperature is the safety record that matters most for perishable food, and it is also the record where blockchain and sensors work together most naturally. A chilled food must stay cold from production to sale. If the temperature rises for long enough, bacteria can grow, even if the food looks and smells fine when it is checked later. A temperature log shows whether the cold chain held, and for how long it broke if it did.

In a paper system, temperature is often recorded by hand, at intervals, by the driver or the store keeper. Hand records have gaps: a reading missed at night, a thermometer read wrongly, a log filled in from memory at the end of a journey. In a sensor system, a small device in the truck or the cold room measures the temperature at set intervals and sends the readings to a record, without a person writing them down. When those readings go onto a blockchain, they are sealed in order, time stamped, and shared with the other members, so a buyer can see the full temperature history of a load, not only a summary written at arrival.

That history is useful in three ways. First, it lets a receiver decide whether to accept a load: a load whose temperature stayed within limits is accepted, while a load that spent hours too warm is held for checking or refused. Second, it lets an investigator find the cause of a safety problem: a temperature break during one journey points to that journey, not to the farm or the factory. Third, it lets a business prove good handling: a transporter who kept the load cold can show the full log, rather than asking a buyer to take their word for it.

Sensor records have their own limits. A sensor measures the air near the sensor, not the temperature inside every pack. A sensor can fail, drift out of calibration, or be placed in a cold spot that does not represent the load. A sensor can be moved, or its readings can be delayed by a poor connection. Good design therefore checks sensor readings against sensible limits before sealing them, calibrates sensors on a schedule, and records the calibration as well as the readings. A temperature history is only as trustworthy as the sensor that made it, and the calibration record is the evidence for that trust.

Quick self-check

Question: Why is a sensor temperature log stronger evidence than a hand-written log?

Because the sensor measures at set intervals without a person writing numbers down, so there are no missed readings, no memory filling, and no reading errors. Sealed on a chain, the readings are also ordered and hard to change after the event.

Question: What does a sensor temperature reading not prove?

It does not prove the temperature inside every pack, only the temperature near the sensor. A faulty, uncalibrated, or badly placed sensor can give a true reading of the wrong place.

A worked recall, with and without a shared ledger

A concrete comparison makes the difference plain. Imagine a yoghurt maker who buys milk from five farms, makes yoghurt in daily batches, and sells it through a distributor to forty shops. One morning, a test shows a problem in the milk from one farm, delivered two days ago.

Without a shared ledger, the recall starts with a hunt. The maker searches its own records to find which yoghurt batches used milk from that farm on that day. Then it phones the distributor to find which shops received those batches. The distributor searches its delivery notes, which may list product names without batch numbers, and phones the shops in turn. Each shop searches its own receipt notes. The list grows slowly, shop by shop, and while it grows, the yoghurt stays on shelves. The maker, unsure which batches are truly affected, may recall a whole week production to be safe, throwing away good yoghurt with bad.

With a shared ledger, the recall starts with a search. The maker enters the milk lot number and reads the chain: the milk lot appears in two yoghurt batches, those two batches appear in delivery records to twelve shops, with quantities and dates. The list is ready in minutes, and it names exactly twelve shops, not forty, and two batches, not a whole week. The maker notifies those twelve shops with the exact batch numbers. The shops take those packs off shelves and count them. The other twenty eight shops keep selling, because their stock is not on the list. The review later shows the time saved and the good food saved, because the scope was precise.

The comparison is honest only if the conditions are stated. The fast version works because the milk lot number was recorded at collection, the yoghurt batches named their milk lots, the deliveries named their yoghurt batches, and all of it was entered promptly. If any of those records is missing, the fast version falls back to the slow version, and the chain adds nothing. The lesson is not that blockchain makes recalls fast by itself, but that a chain with disciplined records makes a fast recall possible, while a paper system makes a fast recall hard even with disciplined records.

The yoghurt recall, with a shared ledger

Milk lot M-7, one farm, one delivery, test problem found
↓
Search the chain: M-7 was used in yoghurt batches Y-31 and Y-32 only
↓
Search forward: Y-31 and Y-32 went to twelve shops, quantities and dates shown
↓
Notify twelve shops with exact batch numbers, remove those packs only

The diagram shows the yoghurt recall as a chain search. The steps point to the diagram: each step follows a link already in the ledger, so the list is ready before the food has time to sell on.

Quick self-check

Question: In the yoghurt example, why were only twelve shops notified, not forty?

Because the chain showed that only two yoghurt batches used the faulty milk lot, and those two batches went to twelve shops. The other shops received different batches, so their stock was not affected.

Question: What record, if missing, would break the fast yoghurt recall?

Any link in the chain: the milk lot at collection, the milk lots named in the yoghurt batches, or the yoghurt batches named in the deliveries. A missing link forces the recall back to phone calls and guessing.

Try it yourself

Write a short recall plan for a food you know well: a cheese, a juice, a loaf, or a jar of sauce. Name the product, its ingredients, and the businesses in its chain. Then write the five recall steps from this unit, and under each step write what record you would need, who holds it, and how long it would take to get it today. Now rewrite the plan as if the chain used a shared ledger, and mark which steps get faster, which get sharper, and which stay the same. Finish by listing three records that, if missing, would break your fast plan, and one simple rule that would keep each of those records from going missing.

Key ideas to carry forward

  • Food safety harms are biological, chemical, and physical, and each kind produces records that a trace must be able to follow.
  • A recall runs in five steps: detection, scope, notification, removal and return, and review, and the scope step is the tracing step.
  • A narrow, precise recall scope saves safe food and keeps recalls credible; a wide scope wastes food and trust.
  • Blockchain shortens the scope step, sharpens it through internal traceability, gives one agreed list, and leaves a sealed audit trail for review.
  • A test result on a chain proves the record was made and has not changed; it does not prove the sample was taken correctly or the result is true about the food.
  • Sensor temperature logs on a chain show the cold chain history in order, but they are only as trustworthy as the sensor and its calibration.
  • The chain cannot detect a hazard, cannot stop unsafe food from being sold, cannot prove a physical claim by itself, and cannot replace human judgement.
  • A fast recall depends on disciplined records: complete lot numbers, prompt entry, and every member taking part.

Glossary

Audit trail

A complete ordered record of what happened, when, and by whom, so a later review can check the history. Food tech example: the recall audit trail shows when the problem was found, when shops were told, and what was returned.

Biological hazard

Harm from living things, such as harmful bacteria, viruses, moulds, parasites, or their toxins. Food tech example: harmful bacteria in soft cheese are a biological hazard.

Chemical hazard

Harm from unwanted substances, such as pesticide residues, cleaning chemicals, heavy metals, or allergens present when they should not be. Food tech example: a cleaning chemical left in a tank is a chemical hazard.

Cold chain

The unbroken series of chilled or frozen links that keeps a perishable food at a safe low temperature from production to sale. Food tech example: a milk tanker, a cold store, and a chilled shop cabinet form one cold chain.

Detection

The first step of a recall, when a test, complaint, inspection, or warning raises the alarm about a food. Food tech example: a laboratory test detects harmful bacteria in a cheese batch.

Physical hazard

Harm from objects in food, such as pieces of glass, metal, stone, or plastic. Food tech example: a piece of metal in a loaf is a physical hazard.

Recall

The action of taking a food back from shops and buyers because it may be unsafe. Food tech example: a yoghurt maker recalls two batches after a milk test shows a problem.

Recall scope

The exact set of batches covered by a recall, decided by tracing the affected ingredient and product. Food tech example: the scope of a cheese recall is the two batches made from one faulty milk lot.

Sensor

A device that measures a physical condition, such as temperature, and sends the reading to a record. Food tech example: a sensor in a milk tanker measures the milk temperature every few minutes.

Calibration

Checking a measuring device against a known standard and adjusting it so its readings are correct. Food tech example: a temperature sensor is calibrated against a reference thermometer on a set schedule.

Sample

A small portion taken from a lot for testing, meant to represent the lot. Food tech example: a sample of milk is taken from a tanker for a bacteria test.

Allergen

A substance in food that can cause an allergic reaction in some people, such as peanut, milk, or wheat protein. Food tech example: a biscuit that contains peanut must name it, so people with a peanut allergy can avoid it.

Notification

Telling distributors, shops, and the public about a recall, with the product, batch numbers, and action to take. Food tech example: a recall notice tells shoppers which cheese batches to return.

Review

The last step of a recall, asking how the harm entered and what will change so it does not happen again. Food tech example: a review after a recall finds that a cleaning step was missed, and adds a check for it.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.
  • Nielsen, S. S., Introduction to the Chemical Analysis of Foods, 1997.

Unit 5: Smart Contracts and Trust in the Supply Chain

Note

Unit 5: Smart Contracts and Trust in the Supply Chain

A question to start with

A farmer delivers a load of tomatoes to a packing house. The packing house agreed to pay a higher price if the tomatoes arrive cool, on time, and in good condition, and a lower price if they arrive warm or late. In the old arrangement, the payment waits for a person to check the delivery note, read the temperature log, confirm the time, and approve the price. That takes days, and if the two sides disagree about the temperature, the payment waits longer while they argue. Now picture a different arrangement: the delivery record, the temperature log, and the time are all on a shared ledger, and a small program on that ledger reads them, works out the price by the agreed rule, and releases the payment as soon as the conditions are met. No one has to chase the paperwork, and no one can change the rule after the delivery.

That small program is a smart contract. This unit explains what smart contracts are, how they work, what they can do in a food supply chain, and where they need careful handling. The idea is simple: an agreement written as a program, stored on a blockchain, that runs by itself when its conditions are met.

Questions to think about

  • A buyer and a seller agree on a price that depends on quality. What usually slows the payment down, and what would remove that delay?
  • If a program decides whether a delivery is good enough, who decides what "good enough" means, and how is that decision written down?
  • What happens when the facts a program needs are wrong, late, or missing?
Think about the tomato payment before you read on

Payment slows down because a person must check the delivery, the temperature, and the time, and because the two sides may disagree about what the records show. A program removes the delay only if the records it reads are already on a shared ledger, the rule is agreed in advance, and the rule is written clearly enough for a program to follow without judgement.

What a smart contract is, in plain words

A smart contract is a small program stored on a blockchain. It holds a set of rules, in the form: if this condition is met, then do that action. When the conditions are met, the program runs by itself, without a person pressing a button or approving the step. When the conditions are not met, it does not run. Its results are recorded on the chain, like any other record, so the run itself becomes part of the shared history.

Three features make a smart contract different from an ordinary computer program. First, it lives on the chain, so every node holds a copy of it, and its code cannot be quietly changed after it is stored. Second, it runs on the network, not on one person computer, so no single party can stop it, skip it, or run a different version of it. Third, its actions are recorded on the chain, so anyone with permission can see that it ran, when it ran, and what it did.

The word "contract" can mislead. A smart contract is not, by itself, a legal contract in the ordinary sense. A legal contract is an agreement between people, written in words, enforced by courts and by the relationship between the parties. A smart contract is a program that carries out part of an agreement automatically. The two should go together: the legal agreement states what the parties intend, in words a court can read, and the smart contract carries out the mechanical steps, in code a computer can run. A business that relies on code alone, without a written agreement behind it, has a program without a promise.

The word "smart" can also mislead. A smart contract is not intelligent. It does not understand, judge, or negotiate. It follows its rules exactly, even when the result is surprising or unfair in a particular case. If the rule says "pay the lower price when the temperature is above the limit", the program will pay the lower price when the temperature reading is above the limit, even if the reading came from a faulty sensor. Writing the rules well, and planning for the cases where the rules give the wrong answer, is the main skill in using smart contracts.

Quick self-check

Question: What is a smart contract, in one sentence?

It is a small program stored on a blockchain that runs by itself when agreed conditions are met, and records its actions on the chain.

Question: Why is a smart contract not the same as a legal contract?

Because a legal contract is an agreement between people, written in words and enforced by courts, while a smart contract is a program that carries out mechanical steps. The two should go together: the written agreement states the intent, and the program carries out the steps.

How a smart contract runs

A smart contract runs in a simple sequence. First, it is written and agreed. The parties decide the rule, write it as code, and check the code carefully. Then the contract is stored on the chain, where it receives an address, like a house number, so other programs and records can find it. Then it waits. It does nothing until something calls it: a new record arrives, a date passes, or a person or a program sends it a message.

When it is called, the contract reads the facts it needs from the chain. Those facts may be delivery records, temperature readings, test results, or dates. It checks those facts against its rules. If the conditions are met, it carries out its actions: it may record a decision, release a payment instruction, send a message, or update a state, such as marking a delivery as accepted. If the conditions are not met, it records that the conditions were not met, or it does nothing, depending on how it was written. Either way, the run and its result are recorded on the chain.

An important limit shapes everything else: a smart contract can only read facts that are on the chain, or that are sent to it through an agreed channel. It cannot look at the world directly. It cannot see a tomato, taste it, or measure its temperature. It can only read the temperature record that someone, or some sensor, put on the chain. If that record is wrong, late, or missing, the contract will act on a wrong, late, or missing fact, and it will do so exactly as written. The quality of a smart contract is therefore limited by the quality of the facts it reads.

That limit leads to a piece of machinery called an oracle. An oracle is a service or a device that brings facts from outside the chain onto the chain, so a contract can read them. A temperature sensor that sends readings to the chain is a simple oracle. A laboratory that signs a test result and posts it to the chain is another. An oracle is a bridge, and like any bridge, it can be a weak point: if the oracle sends wrong facts, the contract will act on them. Good design therefore asks, for every fact a contract needs: who or what supplies it, how is it checked, and what happens if it is wrong?

How a smart contract runs

1. Agree the rule in words, then write it as code, and check the code
↓
2. Store the contract on the chain, where it waits for a call
↓
3. A record arrives: delivery, temperature, test result, or date
↓
4. The contract reads the facts, checks them against its rules, and acts
↓
5. The action and its result are recorded on the chain

The diagram shows the five steps from agreement to recorded action. The steps point to the diagram: the contract only reads facts already on the chain, so its result is only as good as those facts.

Quick self-check

Question: What can a smart contract read, and what can it not read?

It can read facts on the chain, or facts sent to it through an agreed channel such as an oracle. It cannot look at the physical world directly, so it cannot see, taste, or measure a food by itself.

Question: What is an oracle in blockchain use?

A service or device that brings facts from outside the chain onto the chain, so a contract can read them. A temperature sensor sending readings to the chain is an oracle.

Trust: what changes, and what does not

Smart contracts are often described as removing the need for trust. That description is too strong, and it misleads businesses that adopt them. Trust changes shape; it does not disappear.

In a supply chain without smart contracts, a seller trusts a buyer to pay after delivery, and a buyer trusts a seller to deliver as agreed. That trust rests on reputation, on contracts, on inspection, and on the cost of breaking a relationship. When a payment is late, or a delivery is short, the injured party must chase, argue, and sometimes go to a court or an arbitrator. The process is slow, and the outcome is uncertain.

With a smart contract, the mechanical step is taken out of human hands. If the delivery record and the temperature record meet the agreed limits, the payment instruction is released at once, without waiting for a person to approve it. The seller does not need to trust the buyer to remember to pay, and the buyer does not need to trust the seller to accept a lower price quietly. Both trust the program to follow the rule they agreed, and both trust the ledger to hold the facts the program reads.

But new trust is needed in new places. Both parties must trust the code: that it says what they agreed, that it has no mistake in it, and that it handles the edge cases they care about. Both must trust the facts: that the sensor was calibrated, that the sample was taken correctly, that the delivery record is true. Both must trust the network: that the chain will keep running, that the contract will stay stored, and that the members will not agree to change it without consent. And both must trust the written agreement behind the code, because when the code and the words disagree, a court will read the words, not the code.

The honest way to describe the change is this: a smart contract reduces trust in the other party willingness to carry out a mechanical step, and increases trust in the code, the facts, and the network. A business that understands that shift will spend its effort on writing clear rules, checking code, and securing facts. A business that believes trust has vanished will be surprised when a code mistake, a faulty sensor, or a missing record causes a wrong payment that no one can undo by pressing a button.

Quick self-check

Question: What trust does a smart contract remove, and what trust does it add?

It removes trust in the other party willingness to carry out a mechanical step, such as paying on time. It adds trust in the code, in the facts the code reads, in the network, and in the written agreement behind the code.

Question: Why must a smart contract be backed by a written agreement?

Because when code and words disagree, a court reads the words. The written agreement states what the parties intended, while the code only carries out mechanical steps.

Uses in a food supply chain

Smart contracts have several plain uses in food chains, and each one follows the same pattern: a rule agreed in advance, facts on the chain, and an automatic action when the facts meet the rule.

Payment on delivery is the most direct use. A buyer agrees to pay a set price when a delivery is recorded, with a higher price for a higher grade and a lower price for a lower grade. The contract reads the delivery record, the grade, and the temperature log, works out the price, and releases the payment instruction. The farmer is paid faster, the buyer pays only what the rule says, and neither side waits for paperwork. The rule must be written with care: the grade must be defined, the temperature limit must be stated, and the time window must be clear, or the contract will argue with reality every time a borderline delivery arrives.

Quality bonuses and penalties are a second use. A milk buyer may pay a bonus when the milk tests above a set fat level, or a penalty when the bacterial count is above a set limit. The contract reads the test result from the chain, compares it with the limit, and adjusts the payment. This use is only as good as the test: a test result entered late, or from a wrong sample, gives a wrong bonus. The contract should therefore read test results that are signed by the laboratory, and it should refuse to act when a result is missing or out of date, rather than acting on an old result.

Release and acceptance is a third use. A load of chilled food arrives at a warehouse. The contract checks the temperature log for the journey and the delivery record, and if both are within limits, it marks the load as accepted and lets it move into storage. If the temperature broke the limit, it marks the load as held for checking, and tells a person to inspect it. The contract does not decide the food is safe; it decides the load passes a mechanical check and needs a human decision when it does not. That division, machine check plus human judgement, is the safe way to use automation in food.

Provenance and certification checks are a fourth use. A buyer wants only food that carries a named certificate, such as a named farming method or a named quality mark. The contract checks that the certificate record for the lot is present, valid, and not expired, before it allows the lot to be accepted as meeting that claim. If the certificate is missing or expired, the contract refuses the acceptance, or accepts the lot at a lower grade without the claim. This use helps a buyer who must show, to a shopper or an inspector, that every lot they bought carried the certificate they claim.

Access and permission is a fifth use. A chain may hold records that some members may read and others may not. A contract can enforce those permissions automatically: when a member asks for a record, the contract checks their permission and releases the record only if they are allowed to see it. This use is less visible than payment, but it matters for privacy, because it makes the permission rule automatic rather than a matter of asking a person each time.

Quick self-check

Question: Give one example of a smart contract use in food, and name the facts it reads.

Payment on delivery: the contract reads the delivery record, the grade, and the temperature log, works out the price by the agreed rule, and releases the payment instruction when the conditions are met.

Question: Why should a quality bonus contract refuse to act when a test result is missing?

Because acting on an old or missing result would pay a bonus or a penalty for the wrong lot. Refusing to act, and flagging the missing result, is safer than guessing.

Writing a good rule: the hard part

The hardest part of a smart contract is not the code. It is writing the rule clearly enough that a program can follow it without judgement, and completely enough that it handles the cases that will actually happen.

A good rule names its facts precisely. "Good quality" is not a rule a program can follow. "Fat content at or above 3.5 percent, measured by the named method, on a sample taken as agreed" is a rule a program can follow, because each part can be checked against a record. A good rule names its limits as numbers, with units. "Kept cool" is not a rule. "Temperature at or below 4 C for the whole journey, measured every 15 minutes" is a rule. A good rule names its time window: "delivery within 24 hours of harvest" is a rule; "delivery soon" is not.

A good rule also names its edge cases. What happens if the temperature sensor fails and sends no readings? What happens if the test result arrives a day late? What happens if the delivery is half the agreed quantity? What happens if the certificate expires during transport? Each of these cases needs an answer in advance: hold the payment, pay a default price, flag for a person, or refuse the delivery. A contract that has no answer for an edge case will either do nothing, which stalls the chain, or do the wrong thing, which causes a dispute. The time to answer these questions is before the contract is stored, not after it has run.

A good rule is tested before it is used. Testing means running the contract against made-up records that cover the normal case, the borderline case, and the failure case, and checking that the contract does what the parties intended in each one. A borderline case deserves special care: a temperature of exactly 4 C when the limit is 4 C, a fat content of exactly 3.5 percent when the bonus starts at 3.5 percent, a delivery at exactly the last minute of the window. Programs treat limits exactly, while people often treat them loosely, so the parties must agree in advance whether "at or below" or "below" is the rule, and write it that way.

A good rule is also checked by someone who did not write it. A second pair of eyes, a person who knows the food business and a person who knows the code, should read the rule and the code together and ask: does the code say what the words say? That check, called an audit, is not a luxury. A mistake in a contract that runs by itself will repeat every time the contract runs, until someone notices and stops it. Finding the mistake before the contract is stored is far cheaper than finding it after it has paid the wrong price ten times.

Writing a good rule, in four checks

1. Name the facts precisely: numbers, units, methods, and times
↓
2. Name the edge cases: missing facts, late facts, faulty sensors, short deliveries
↓
3. Test the rule: normal case, borderline case, and failure case
↓
4. Audit the code: a second pair of eyes checks code against words

The diagram shows the four checks for a good rule. The steps point to the diagram: a rule that passes all four is ready to be stored, and a rule that fails any one of them is not.

Quick self-check

Question: Why is "kept cool" a poor rule for a smart contract?

Because a program cannot judge what "cool" means. A good rule gives a number, a unit, and a time pattern, such as temperature at or below 4 C for the whole journey, measured every 15 minutes.

Question: Why test a borderline case, such as a temperature of exactly 4 C?

Because programs treat limits exactly, while people treat them loosely. The parties must agree in advance whether the limit includes the exact value, and the test shows whether the code follows that agreement.

When a smart contract goes wrong

Smart contracts go wrong in predictable ways, and a food business should know them before it relies on one. The first way is a mistake in the code. A wrong number, a wrong comparison, or a missing check can make the contract pay the wrong price, accept a bad load, or refuse a good one. Because the contract runs by itself, the mistake repeats until it is found. The fix is prevention: careful writing, testing, and audit, as above, and a plan for stopping the contract if a mistake is found.

The second way is a wrong fact. A faulty sensor, a wrong sample, a mistyped batch number, or a late test result can make a correct contract act on a wrong fact. The contract is not at fault; the fact is. The fix is to check facts before the contract reads them, to refuse to act when a fact is missing or out of date, and to record the source of every fact so a wrong fact can be traced to its source.

The third way is a missing case. The parties agreed a rule for normal deliveries, but a delivery arrives half full, or a day late, or with a certificate that expired yesterday. The contract has no rule for that case, so it does nothing, or it applies the normal rule to an abnormal case. The fix is to list the cases that can happen, and to write a rule for each one, including a rule that says "flag for a person" when the case is not covered. A contract that knows when to ask a person is safer than a contract that pretends every case is covered.

The fourth way is a change that cannot be undone. Once a contract is stored on a chain, its code is hard to change, because every node holds a copy. If the parties want to change the price, the limit, or the rule, they cannot simply edit the stored code. They must store a new contract and agree that the new one replaces the old one, and they must handle the deliveries that are already in progress under the old rule. That process needs a plan, agreed in advance, or a simple price change becomes a dispute about which contract applies to which delivery.

The fifth way is a dispute about what the code means. The parties may agree on the words, but the code may say something slightly different, and only one side may notice. When the contract runs and the result surprises one side, the dispute is not about the facts, but about the translation from words to code. The fix is a written agreement that states, in plain words, what the code is meant to do, and an audit that checks the code against those words before the contract is stored. If the words and the code still disagree after that, the words should govern, and the contract should be replaced.

Quick self-check

Question: A contract pays the wrong price ten times before anyone notices. What failed?

The checking before storage failed, and the monitoring after storage failed. A mistake in the code repeats every time the contract runs, so testing, audit, and watching the first runs are the defences.

Question: Why is changing a stored smart contract hard?

Because every node holds a copy of the code, and the code cannot be quietly edited. The parties must store a new contract and agree that it replaces the old one, and handle deliveries already in progress under the old rule.

Try it yourself

Write a smart contract rule for a food you know, in words first, then as a short list of steps a program could follow. Choose a simple case: a milk delivery that earns a bonus when the fat content is at or above a set level, or a tomato delivery that earns a higher price when it arrives cool and on time. Write the rule with numbers, units, methods, and times. Then list five edge cases: a missing test result, a late delivery, a faulty sensor, a short quantity, and a certificate that expired yesterday. For each edge case, write what the contract should do: pay, hold, flag for a person, or refuse. Finally, write one paragraph explaining the rule to a farmer in plain words, without any technical terms. If you cannot explain it plainly, the rule is not ready to be coded.

Key ideas to carry forward

  • A smart contract is a small program stored on a blockchain that runs by itself when agreed conditions are met, and records its actions on the chain.
  • A smart contract is not a legal contract by itself; it needs a written agreement behind it that states what the parties intended.
  • A contract can only read facts on the chain or facts sent through an oracle; it cannot see, taste, or measure food directly.
  • Trust changes shape with smart contracts: less trust in a party willingness to carry out a mechanical step, more trust in the code, the facts, and the network.
  • Plain uses in food are payment on delivery, quality bonuses and penalties, release and acceptance, certificate checks, and permission control.
  • A good rule names facts precisely, with numbers, units, methods, and times, and it names its edge cases in advance.
  • Good rules are tested on normal, borderline, and failure cases, and audited by a second pair of eyes before storage.
  • Contracts go wrong through code mistakes, wrong facts, missing cases, hard-to-change code, and disputes about what the code means.
  • For small producers, contracts must be simple, plainly explained, and challengeable by a person when the result looks wrong.

Glossary

Smart contract

A small program stored on a blockchain that runs automatically when agreed conditions are met. Food tech example: a smart contract releases a milk payment when the delivery record and the fat test both meet the agreed limits.

Oracle

A service or device that brings facts from outside the chain onto the chain, so a contract can read them. Food tech example: a temperature sensor that sends readings to the chain is an oracle.

Edge case

A situation at the limit of a rule, or outside the normal case, that a contract must handle. Food tech example: a delivery that arrives with a faulty sensor is an edge case for a temperature rule.

Audit

A careful check of code against the written agreement, by someone who did not write the code, to find mistakes before the contract is stored. Food tech example: an auditor reads a payment contract and checks that its price rule matches the written agreement.

Bonus

An extra payment for meeting a higher standard, such as a higher fat content in milk. Food tech example: a milk buyer pays a bonus when the fat test is at or above the agreed level.

Penalty

A lower payment, or a deduction, when a delivery fails to meet an agreed standard. Food tech example: a tomato buyer pays a lower price when the delivery arrives above the agreed temperature limit.

Release

Allowing a load to move to the next stage, such as into storage, after it passes a check. Food tech example: a chilled load is released into a cold store when its temperature log is within limits.

Acceptance

The decision by a receiver that a delivery meets the agreed conditions and can be taken into stock. Food tech example: a packing house accepts a tomato delivery when its grade and temperature meet the agreed limits.

Grade

A class given to a food based on its quality, size, or composition, used to set its price or use. Food tech example: tomatoes are graded by size and condition, and a higher grade earns a higher price.

Condition

One of the facts a smart contract checks before it acts, such as a temperature limit or a test result. Food tech example: a delivery temperature at or below 4 C is one condition for a higher milk price.

Action

What a smart contract does when its conditions are met, such as releasing a payment instruction or marking a load as accepted. Food tech example: releasing payment is the action of a delivery contract when the delivery passes its checks.

Contract address

The identifier that lets other programs and records find a stored smart contract on the chain. Food tech example: a delivery record calls a payment contract by its address.

Legal contract

An agreement between people, written in words and enforced by courts and by the relationship between the parties. Food tech example: a written supply agreement states the price, the quality limits, and the payment terms that a smart contract then carries out.

Payment instruction

A recorded instruction to pay an amount, which a payment system then carries out. Food tech example: a smart contract records a payment instruction for a milk delivery, and the buyer bank system pays it.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.

Unit 6: Limits, Costs and When Blockchain Is Not the Answer

Note

Unit 6: Limits, Costs and When Blockchain Is Not the Answer

A question to start with

A small jam maker hears about blockchain at a trade meeting. A vendor promises that a blockchain will prove the jam is genuine, stop fraud, speed up payments, and win new buyers. The price is high, the setup takes months, and the jam maker must ask every fruit supplier to join. The jam maker asks a plain question: will this system solve a problem I actually have, or will it add a costly system on top of problems I could solve more simply? That question is the subject of this unit. Blockchain is a useful tool, but it is not the right tool for every job, and a food technologist must be able to tell the difference.

This unit works through the limits of blockchain in food, the costs in money, time, and effort, and the situations where a simpler tool, a shared spreadsheet, a database, a certificate, or a better paper system, does the job better. Knowing when not to use a technology is as useful as knowing how to use it.

Questions to think about

  • A business has one supplier and one buyer. What would a shared ledger add, and what would it cost?
  • A food problem is caused by dirty equipment. Would a blockchain make the food safer, or would it only record the dirty equipment more neatly?
  • How would you decide, before spending money, whether a blockchain project is worth trying?
Think about the jam maker before you read on

A shared ledger adds value when many parties must share records they all trust, when the history must be hard to change, and when tracing is slow today. With one supplier and one buyer, a shared spreadsheet or a simple database may do the same job for far less money. If the problem is dirty equipment, the fix is cleaning and checking, not record keeping. The decision should start from the problem, not from the technology.

The physical world gap: the limit that matters most

The most important limit of blockchain was introduced in Unit 4, and it deserves a full section here, because it decides many projects. A blockchain records facts. It does not observe the physical world. A record can say that a crate of apples came from a certain orchard, but the chain cannot stand in the orchard and watch the picking. A record can say that milk was kept at 4 C, but the chain cannot feel the milk. The link between the physical food and the digital record is made by people, by sensors, and by sampling, and that link is where mistakes and dishonesty enter.

Three kinds of gap appear. The first is a mistake: a wrong batch number typed in, a wrong date, a quantity in the wrong unit, a sample taken from the wrong lot. The chain preserves the mistake faithfully, and the mistake then travels with the food. The second is a sensor fault: a thermometer that drifts, a sensor placed in a cold spot, a device that stops sending readings. The chain records what the sensor sent, not what the food truly experienced. The third is deliberate fraud: a person enters a false origin, copies a certificate from one lot onto another, or records a test that was never done. The chain cannot detect the lie, because the lie is in the fact entered, not in the sealing of the fact.

Design can narrow these gaps, but it cannot close them. Scanners reduce typing mistakes. Sensors that send readings directly reduce hand entry. Laboratory signatures tie results to laboratories. Inspection visits check that the physical world matches the records. Each of these helps, and each costs money and effort. A project that promises to close the gap entirely, without inspection, sampling, or testing, is promising more than the technology can deliver. A food technologist should always ask, for any blockchain claim: how does this system check that the record matches the physical food, and who does that checking?

Quick self-check

Question: Name three ways a wrong fact can enter a blockchain.

By a mistake, such as a wrong batch number typed in; by a sensor fault, such as a thermometer that drifts; and by deliberate fraud, such as a false origin entered on purpose. The chain preserves each one faithfully.

Question: Why can inspection visits not be replaced by a blockchain?

Because only a visit can check that the physical world matches the records: that the orchard exists, that the equipment is clean, that the sample was taken from the lot it names. The chain can only show what was recorded.

Costs: money, time, and people

Blockchain projects cost more than their software price, and the full cost should be counted before a business commits. The costs fall into four groups.

The first group is setup cost. A business must choose a system, buy or rent the software, set up computers or cloud services to run the nodes, write the programs that let staff enter records and read them, and connect the system to the business existing systems, such as stock control and laboratory records. If the business partners use different systems, the systems must be made to work together, or the partners must agree on one system. That agreement alone can take months, because each partner has its own systems, budgets, and timetables.

The second group is running cost. The computers must be kept running, the software must be updated, the data must be backed up, and someone must watch the system for faults. Each record added to the chain costs a small amount of computing work and storage, and those small amounts add up when a chain records thousands of events a day. The cost is not large for one record, but it is real for a busy chain, and it continues for as long as the chain runs. A chain that is started and then left unmaintained will drift out of date, and its records will become unreliable.

The third group is people cost. Staff must be trained to enter records correctly, to use batch numbers consistently, to scan codes at handovers, and to correct mistakes by adding new records rather than editing old ones. That training takes time, and it must be repeated when staff change. Someone must also run the system day to day: checking that nodes are in step, that sensors are calibrated, that private keys are safe, and that the members are entering records promptly. That work is a real job, even if it is part time, and it must be counted in the budget.

The fourth group is the cost to partners, especially small ones. A farmer who must buy a device, pay for a connection, and spend time entering records bears a cost that a large buyer may not see. If the cost falls on the smallest members, they may enter records late, or not at all, and the chain will have gaps at the very places where it is most needed. A fair project shares the cost, or provides the devices and training, so that the smallest members can take part. A project that ignores partner costs will build a chain that only the large members use, and its trace will stop at the farm gate.

Quick self-check

Question: Name the four groups of blockchain cost.

Setup cost, running cost, people cost, and cost to partners, especially small ones. Setup covers software and connection; running covers computers and storage; people covers training and daily operation; partner cost covers devices, connections, and time for small members.

Question: Why is partner cost a risk to a food blockchain?

Because if small members cannot afford the device, the connection, or the time, they will enter records late or not at all, and the chain will have gaps at the farm gate, where origin records matter most.

When a simpler tool does the job better

Many food record problems have simpler answers than a blockchain. A food technologist should know the simpler tools, so they can recommend the right one for the job.

When one business keeps records for itself, a database is the right tool. A database is fast, easy to search, easy to correct, and cheap to run. It does not share records with other businesses, but if no sharing is needed, sharing is not a benefit. A single factory tracking its own lots, a single shop tracking its own stock, or a single laboratory tracking its own tests, all need a database, not a blockchain.

When a small group of businesses already trust each other and share records, a shared spreadsheet or a shared database may be enough. Two businesses that have worked together for years, that inspect each other, and that share a simple system, do not need the sealing and consensus of a blockchain to trust each other records. They need a clear agreement about who enters what, and when, and a simple shared store. Adding a blockchain would add cost and complexity without adding trust that is not already there.

When the problem is a missing certificate, the answer is a certificate, not a chain. A buyer who wants proof that a lot meets a named standard needs a certificate from a trusted body, with a check that the certificate is valid and not expired. That certificate can be stored as a file and checked by hand, or its hash can be stored on a chain, but the trust comes from the body that issued it, not from the chain that carries it. A chain full of certificates from an untrusted source is no better than a drawer full of them.

When the problem is slow tracing inside one business, the answer is better internal records, not a shared ledger. A factory that cannot trace a faulty ingredient to its production runs needs to fix its internal lot numbers, its mixing records, and its packing links. A blockchain shared with outside partners will not fix a factory that cannot trace inside its own walls. Internal traceability comes first, as Unit 3 explained, and it can be built with a database and disciplined practice.

When the problem is a single document, such as a delivery note or a test report, the answer may be a signed file. A laboratory report signed by the laboratory, sent as a file, proves the laboratory made that report. It does not need a chain to prove it. The chain adds value only when many such documents must be linked, ordered, and shared across many parties over time.

Choosing the simplest tool that does the job

One business, own records: use a database
↓
Small trusted group, shared records: use a shared database or spreadsheet
↓
Missing proof of a standard: use a certificate from a trusted body
↓
Many parties, low trust, shared history needed: consider a blockchain

The diagram shows the choice from simplest to most complex. The steps point to the diagram: start at the top and move down only when the simpler tool cannot do the job.

Quick self-check

Question: A factory cannot trace a faulty ingredient to its production runs. What should it fix first?

Its internal traceability: its lot numbers, mixing records, and packing links, using a database and disciplined practice. A shared blockchain will not fix a factory that cannot trace inside its own walls.

Question: When is a blockchain the right choice, rather than a shared database?

When many parties must share records, when those parties do not fully trust each other record keeping, when the history must be hard to change without detection, and when tracing across the whole chain is slow today.

Scale, speed, and storage: the technical limits

Blockchain systems have technical limits that matter for food chains, and a food technologist should know them in plain terms, without needing to build a system.

The first limit is speed. Adding a block takes a checking step, and that step takes time. In a closed food network, the time is usually short, seconds rather than minutes, because the network is small and the consensus method is simple. But it is still slower than writing a row in a database, which is almost instant. A chain that must record a reading every second from many sensors will fall behind, because the checking step cannot keep up. Food chains usually record events, such as deliveries and tests, which happen minutes or hours apart, not every second, so speed is rarely the binding limit. It becomes a limit only when a design tries to record every sensor reading, every second, on the chain, instead of recording summaries or exceptions.

The second limit is storage. Every node keeps a copy of every block, so the chain grows on every computer at once. A chain that records many events a day will grow large over months and years, and the computers must store it, back it up, and search it. The split between on-chain and off-chain storage, explained in Unit 2, is the answer: keep short facts and hashes on the chain, and keep bulky files outside. A design that ignores that split will build a chain that is heavy, slow to search, and costly to store.

The third limit is change. Once a record is sealed, it cannot be quietly edited. That is the strength of a blockchain, and it is also a limit. A mistake in a batch number, a wrong date, or a changed price, cannot be fixed by editing the record. It must be fixed by adding a new record, as Unit 2 explained. That is the right approach for a history that must be trusted, but it is slower and more awkward than editing a database cell. Staff must be trained to expect it, or they will see the chain as a system that punishes mistakes rather than a system that preserves history.

The fourth limit is connection. A blockchain needs its nodes to talk to each other. In places with poor connections, a node may fall behind, miss blocks, and need to catch up. A farmer with a weak connection may be unable to enter a record at the time it happens, and the record will arrive late. The chain can handle late records, by sealing them when they arrive, but the history will show a gap between the event and its recording. A project that assumes every member has a fast, steady connection will be surprised by the reality of rural areas and busy factories.

Quick self-check

Question: Why should sensor readings not all go on the chain every second?

Because adding a block takes a checking step, and the chain cannot keep up with a reading every second from many sensors. The chain should record events, summaries, or exceptions, while the full sensor log stays off the chain.

Question: How does the sealing strength of a blockchain also act as a limit?

Because a sealed record cannot be quietly edited. A mistake must be fixed by adding a new correcting record, which is slower and more awkward than editing a database cell, though it keeps the history trustworthy.

Privacy, personal data, and the right to be forgotten

A sealed record is hard to erase, and that creates a tension with privacy. Personal data, such as the name of a farmer, the phone number of a driver, or the address of a small supplier, should be handled with care on a blockchain. Once personal data is sealed into a block, it is copied to every node, and removing it means changing every copy, which the chain is designed to resist. That is the opposite of what privacy rules in many places require: that personal data can be corrected or removed when a person asks for it, or when it is no longer needed.

Good design keeps personal data off the chain. The chain stores a reference, such as a supplier number, and the personal details live in a separate system that can be corrected or deleted. The reference on the chain still lets the trace work, because the supplier number links the records, while the name and phone number stay in a system that can be changed. A design that puts names, phone numbers, and addresses directly into blocks creates a privacy problem that is hard to fix later, and it may break the law in the place where the chain operates.

Business privacy matters too. Prices, volumes, and supplier lists are business secrets, and a chain that shares them widely will lose members. A permissioned chain, with rules about who can read what, is the answer, as Unit 1 explained. But the rules must be set carefully: a member who can read the whole ledger can see every other member prices, and a member who can read too little cannot trace a food through the chain. The balance is a design decision, and it should be agreed by all members before the chain starts, not discovered after the first price leak.

A related question is who owns the data on the chain. Each member enters records about its own work, but the ledger as a whole belongs to the network. If a member leaves the network, what happens to its records? If a member wants its old records removed, can they be removed? These questions need answers in the written agreement between members, before the chain starts. A chain that starts without them will face a dispute the first time a member leaves or asks for a record to be changed.

Quick self-check

Question: Why should personal data be kept off a blockchain?

Because a sealed record is copied to every node and hard to erase, while privacy rules in many places give people a right to have personal data corrected or removed. Keeping personal data off the chain, with only a reference on it, makes those rights easier to honour.

Question: What business data should a permissioned chain protect?

Prices, volumes, and supplier lists, which are business secrets. The chain must set who can read what, so members can trace food without seeing each other prices.

A decision test: five questions before you build

Before a business spends money on a blockchain, it should answer five plain questions. The answers will show whether a blockchain is worth trying, or whether a simpler tool is better.

First, what is the problem, in one sentence? The problem should be a record problem: tracing is slow, records disagree, a history was changed, or buyers cannot check a claim. If the problem is dirty equipment, poor farming, or a missing test, the answer is not a blockchain, because the problem is not a record problem.

Second, how many parties must share records, and do they trust each other record keeping? A blockchain adds most value when many parties must share, and when they do not fully trust each other to keep records honestly. With one or two parties who trust each other, a shared database is simpler and cheaper.

Third, must the history be hard to change without detection? If the answer is yes, because buyers, auditors, or inspectors need to trust that old records were not rewritten, a blockchain sealing helps. If the answer is no, because records are corrected often and a simple edit history is enough, a database with a change log does the job.

Fourth, can every member take part? Every member needs a device, a connection, training, and time. If the smallest members cannot take part, the chain will have gaps, and the gaps will be where the trace matters most. A project that cannot bring every member along should start smaller, with the members who can take part, or choose a simpler tool that all can use.

Fifth, what will success look like, and how will it be measured? Success might be a recall list found in minutes instead of days, a payment made in a day instead of a week, or a buyer checking a claim without a phone call. The measure should be stated before the project starts, and the project should be judged against it after a trial. A project with no measure of success will always claim success, because no one can prove otherwise.

A business that answers these five questions honestly will often decide not to build a blockchain, and that decision is a success, not a failure. It has saved money, time, and effort for a problem that a simpler tool can solve. A business that answers them and still sees a case for a blockchain has a clear reason to try, and a clear way to judge whether the trial worked. Unit 7 builds a worked example that passes this test, so the reader can see what a good case looks like in practice.

Five questions before you build

1. What is the problem, in one sentence, and is it a record problem?
↓
2. How many parties must share, and do they trust each other records?
↓
3. Must the history be hard to change without detection?
↓
4. Can every member take part, including the smallest?
↓
5. What will success look like, and how will it be measured?

The diagram shows the five decision questions in order. The steps point to the diagram: answer them honestly before spending money, and let the answers decide whether to build.

Quick self-check

Question: A business has a record problem, but only two parties who trust each other. What should it use?

A shared database or spreadsheet, with a clear agreement about who enters what and when. A blockchain adds cost and complexity without adding trust that is not already there.

Question: Why state a measure of success before a blockchain trial starts?

Because without a measure, the project will always claim success. A stated measure, such as a recall list in minutes, lets the trial be judged honestly.

Try it yourself

Pick a food business you know: a dairy, a bakery, a fruit packer, or a jam maker. Write down its real problem in one sentence, then answer the five decision questions from this unit for that business. Be honest: if the problem is not a record problem, say so, and name the simpler fix. If the problem is a record problem, name the parties who must share, the history that must be trusted, and the members who might struggle to take part. Finish by writing a recommendation in three sentences: build a blockchain, use a simpler tool, or fix a different problem first, and give the reason for your choice. Bring your recommendation to your next session and defend it against a classmate who chose differently.

Key ideas to carry forward

  • The physical world gap is the main limit: a chain records facts, it does not observe food, so mistakes, sensor faults, and fraud enter through the facts.
  • Costs include setup, running, people, and partner costs, especially for small members who may struggle to take part.
  • A database is right for one business; a shared database is right for a small trusted group; a certificate is right for a missing proof; internal traceability must be fixed before a shared ledger helps.
  • Technical limits are speed, storage, the awkwardness of correcting sealed records, and the need for a steady connection.
  • Personal data should stay off the chain, with only a reference on it, so it can be corrected or removed.
  • Closed food networks should use low-energy consensus, such as turn taking or voting, not proof of work.
  • Five questions decide whether to build: is it a record problem, how many parties must share, must history be hard to change, can every member take part, and what will success look like?
  • Deciding not to build a blockchain, when a simpler tool does the job, is a success, not a failure.

Glossary

Proof of work

A consensus method in which computers solve hard puzzles to win the right to add a block, using a great deal of electricity. Food tech example: a proof of work system is a poor fit for a closed food chain, which can use voting instead.

Change log

A record in a database showing what was changed, when, and by whom, so edits can be reviewed. Food tech example: a database change log shows that a delivery date was corrected and who corrected it.

Decision test

A set of plain questions asked before building a system, to decide whether the system is worth trying. Food tech example: the five-question test in this unit decides whether a food business should build a blockchain.

Physical world gap

The gap between a physical food and the digital record about it, where mistakes, sensor faults, and fraud can enter. Food tech example: a false origin entered on a chain is a physical world gap, because the chain cannot check the orchard.

Running cost

The ongoing cost of keeping a system working, including computers, updates, backups, and storage. Food tech example: the running cost of a food chain includes keeping its nodes online and its data backed up.

Setup cost

The one-time cost of choosing, buying, and connecting a system, and writing the programs that use it. Food tech example: the setup cost of a food chain includes connecting it to the business stock system.

Partner cost

The cost borne by members of a chain, such as devices, connections, and time spent entering records. Food tech example: a farmer bears a partner cost when buying a device to enter harvest records.

Privacy

The protection of personal and business information, so it is seen only by those allowed to see it, and can be corrected or removed when needed. Food tech example: a farmer name is kept off the chain to protect privacy.

Scale

How large a system is, and how well it handles more records, more members, or more data. Food tech example: a chain that records thousands of events a day must be designed to scale without slowing down.

Storage

The space needed to keep records, on every node in a blockchain network. Food tech example: keeping bulky files off the chain keeps storage small and the chain fast.

Trial

A small test of a system with a few members and a few products, judged against a stated measure of success before a wider rollout. Food tech example: a jam maker trials a chain with two suppliers before asking all suppliers to join.

Vendor

A business that sells a system or a service, such as blockchain software. Food tech example: a vendor selling a food chain should be asked which consensus method it uses and what it costs.

Consensus method

The agreed method by which nodes decide that a new block is valid, such as voting, turn taking, or proof of work. Food tech example: a food chain uses voting among known members as its consensus method.

Connection

The network link that lets a node talk to other nodes and send records. Food tech example: a farmer with a weak connection may enter harvest records late.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.

Unit 7: Building a Traceability Chain: A Worked Example

Note

Unit 7: Building a Traceability Chain: A Worked Example

A question to start with

A group of businesses wants to trace honey from the hive to the jar. The group is small: six beekeepers, one extraction and packing house, one laboratory, one distributor, and twelve shops. The honey is sold as a single-origin product, so the claim on the jar matters: shoppers pay for honey from named hives, harvested in a named season, and the group wants to prove that claim. The group also wants a faster recall if a test ever finds a problem. They have read the earlier units, they know the limits, and they want to build a chain step by step, starting small and growing only when the small start works. This unit builds that chain with them, from the first decision to the first jar on a shelf, and then tests it with a recall.

This is a worked example, not a recipe for every food. Honey is chosen because its chain is short, its identity changes are simple, and its claim is easy to state. The steps, the records, the checks, and the lessons transfer to other foods, but the details, the batch sizes, the tests, and the limits, must be set fresh for each food.

Questions to think about

  • A honey jar claims a single origin. What records would prove that claim, and who would make each one?
  • Six beekeepers, one packer, one laboratory, one distributor, and twelve shops must share one record. What must they agree before the first record is written?
  • How would you test the chain before trusting it with real jars on real shelves?
Think about the honey claim before you read on

The claim needs a harvest record from the beekeeper, naming the hives and the date; an extraction record from the packing house, naming the honey lots that went into each jar batch; a test record from the laboratory, naming the sample and the result; and a delivery record from the distributor, naming the shops. Each record must use the same batch numbers, so the jar can be traced back step by step to the hives.

Step 1: name the question the chain must answer

Every chain starts with a question, not with software. The honey group writes its questions down, in plain words, and agrees them before anything else. Their questions are three.

First, can a shopper who scans a jar find which beekeeper hives the honey came from, when it was harvested, when it was extracted and packed, and what tests it passed? Second, can the packing house, if a test finds a problem, find every jar from the affected honey lot, and the shops that hold them, quickly and precisely? Third, can the laboratory result for a lot be checked by a buyer without phoning the laboratory, and can the buyer see that the result has not been changed since it was recorded?

These questions decide what the chain records, and what it does not record. The chain will record harvests, extractions, tests, packing, deliveries, and sales by batch. It will not record prices, because the members want prices private. It will not record the full laboratory report, because the report is long; it will record the test result in short form and the hash of the full report, so the report can be checked, as Unit 2 explained. It will not record every hive inspection, because the members agreed that the harvest record, the extraction record, and the test result answer their questions, and more records would add work without adding answers.

The group also writes down what success looks like. A shopper scan should show the journey in a readable page. A recall search should return the affected jars and shops in minutes, not days, in a trial run. A buyer should be able to check a test result without a phone call. These measures will be used to judge the trial, as Unit 6 advised. If the trial does not meet them, the group will change the design, not declare success anyway.

Quick self-check

Question: Why start a chain with questions, not with software?

Because the questions decide what the chain records and what it does not record. Starting with software invites recording everything, which makes the chain large, slow, and costly, without adding answers.

Question: Why does the honey chain not record prices?

Because the members want prices private. Prices do not answer the three questions the chain was built to answer, so recording them would add a privacy risk without adding value.

Step 2: name the members, the roles, and the permissions

The chain has twenty one members: six beekeepers, one extraction and packing house, one laboratory, one distributor, and twelve shops. Each member has a role, and each role has permissions: what the member may write, and what the member may read.

Beekeepers may write harvest records. A harvest record names the beekeeper, the hive group, the harvest date, the quantity, and the honey lot number. Beekeepers may read the records for their own lots, and the packing house records for lots that used their honey, but they may not read other beekeepers harvest quantities or prices, because those are private. In practice, the chain enforces this by permission rules, so a beekeeper who asks for another beekeeper record is refused by the system, not by a person.

The extraction and packing house may write extraction records and packing records. An extraction record names the honey lots that went into the extraction, the date, and the extracted batch number. A packing record names the extracted batch, the jar batch, the number of jars, the packing date, and the code printed on each jar. The packing house may read harvest records for the lots it receives, test records for those lots, and delivery records for the jar batches it sends.

The laboratory may write test records. A test record names the sample code, the honey lot it came from, the test method, the result, the date, and the name of the tester. The laboratory signs its test records with its own key, so a test result cannot be entered in the laboratory name by anyone else, as Unit 2 explained. The laboratory may read harvest and extraction records for the lots it tests, so it can check that the sample code matches the lot.

The distributor may write delivery records. A delivery record names the jar batch, the quantity, the shops receiving it, the delivery date, and the vehicle. The distributor may read packing records and test records for the batches it delivers, so it can refuse a delivery whose test result is missing or failed.

The shops may write receipt records. A receipt record names the jar batch, the quantity received, the date, and the condition on arrival. A shop may also write a sale record by batch, where the shop system allows it, so a sold jar can be tied to its batch. Shops may read the journey for the batches they receive, so they can answer a shopper question, but they may not read other shops receipt quantities.

These permissions are written into the agreement between members, and enforced by the system. The agreement also names who runs a node, meaning which members keep a copy of the ledger. In this small chain, the packing house, the laboratory, and the distributor each run a node, and the beekeepers and shops use the system through a simple phone app that talks to those nodes, without running a node themselves. That design keeps the cost down for small members, while keeping enough copies of the ledger that no single member holds the only copy.

The honey chain members and their records

Beekeepers: harvest records, hive group, date, quantity, honey lot number
↓
Packing house: extraction records, packing records, jar batch and code
↓
Laboratory: test records, sample code, method, result, date, signed
↓
Distributor: delivery records, jar batch, shops, date, vehicle
↓
Shops: receipt records, quantity, date, condition, sale by batch

The diagram shows the five member groups and the records each one writes. The steps point to the diagram: each record uses the batch numbers from the step before, so the jar can be traced back to the hives.

Quick self-check

Question: Why do beekeepers and shops not run a node in this design?

Because running a node costs money and effort, and small members may not have the equipment or the time. They use the system through a phone app that talks to the nodes run by the packing house, laboratory, and distributor, while the ledger still has enough copies to be safe.

Question: What does a laboratory signature on a test record prove?

It proves the record was signed with the laboratory private key, and that the record has not changed since signing. No other member can enter a test result in the laboratory name.

Step 3: design the batch numbers and the lot discipline

Batch numbers are the links that hold the chain together, so the group designs them before the first harvest. The design is simple, and it is written down so every member follows it.

A honey lot number is made of three parts: the beekeeper code, the hive group code, and the harvest date. A lot harvested by beekeeper B3, from hive group H2, on a named date, carries a number that shows all three. The number is unique, because no beekeeper harvests the same hive group twice on the same date, and it is readable, because a person can see the beekeeper, the hives, and the date in the number itself.

An extraction batch number names the honey lots that went into it. If extraction E-14 uses honey lots from two beekeepers, its record names both lots, with the quantity from each. A jar batch number names the extraction batch it came from, and the packing date. A jar code, printed as a square matrix code on each jar, points to the jar batch number, so scanning a jar opens the journey of that batch.

The group also sets rules for mixing and splitting, the weak points from Unit 3. Honey lots are never mixed without a record naming every lot in the mix, with quantities. An extraction batch is never split into jar batches without a record naming every jar batch, with jar counts. A jar batch is never split across deliveries without a delivery record naming every shop and quantity. These rules sound strict, and they are meant to be: a single unrecorded mix breaks the single-origin claim, because the honey in the jar can no longer be tied to its hives.

The group tests the numbering on paper before it goes live. They write out a full journey for one imagined lot, from hive to jar, and check that every step links to the next, that no number is reused, and that a person who was not in the room can follow the journey from the numbers alone. Only when the paper test passes do they build the numbering into the system.

Quick self-check

Question: What three parts make up a honey lot number in this example?

The beekeeper code, the hive group code, and the harvest date. Together they make a unique, readable number that ties the lot to its hives and its day.

Question: Why test batch numbering on paper before building it into the system?

Because a numbering mistake built into the system is costly to fix, while a mistake on paper is cheap to correct. The paper test checks that every step links, no number is reused, and a stranger can follow the journey from the numbers alone.

Step 4: build the records, the app, and the checks

With questions, members, and numbers agreed, the group builds the system. The build is kept small on purpose. The group does not buy a large system with many features. It builds, or rents, a simple permissioned blockchain with three nodes, a simple phone app for entering records and scanning codes, and a simple web page for shoppers who scan a jar.

Each record type is a short form in the app. A harvest form asks for the beekeeper code, the hive group, the harvest date, the quantity, and the honey lot number, which the app suggests from those entries so the beekeeper does not type it by hand. An extraction form asks for the honey lots used, with quantities, and suggests the extraction batch number. A packing form asks for the extraction batch, the jar count, and the packing date, and prints the jar codes. A test form, used by the laboratory, asks for the sample code, the honey lot, the method, the result, and the date, and signs the record with the laboratory key. A delivery form asks for the jar batch, the shops, the quantities, and the date. A receipt form asks for the jar batch, the quantity, and the condition.

Each form has checks before the record is sealed. The app refuses a harvest record with a missing date, a quantity of zero, or a lot number that already exists. It refuses an extraction record that names a honey lot that has no harvest record, or a quantity larger than the lot holds. It refuses a packing record that names an extraction batch with a failed test, or with no test at all. It refuses a delivery record that names a jar batch that was never packed. These checks are the consensus rules from Unit 2, written as simple form rules: a record that breaks them is refused at once, while the person is still there to fix it, rather than sealed into the chain as a mistake.

The shopper page is also kept simple. Scanning a jar code opens a page that shows, in plain words, the beekeeper, the hive group, the harvest date, the extraction and packing dates, the test result in short form, and the delivery date to the shop. It does not show prices, quantities, or other members private data. It shows a short note explaining that the page is a summary of the shared ledger, and that the full record can be checked by an auditor with permission. The page is tested with shoppers who have never seen it before, to check that they can read it and trust it.

Quick self-check

Question: Why does the app suggest a lot number instead of asking the beekeeper to type it?

Because typing is where mistakes enter. Suggesting the number from the beekeeper code, hive group, and date reduces typing errors and keeps numbers consistent across members.

Question: Why refuse a packing record for a batch with no test result?

Because packing a batch that was never tested, or that failed its test, would put untested honey into jars. Refusing the record at entry stops the mistake while the person is still there to fix it.

Step 5: run a trial with one lot, from hive to shelf

The group does not launch with all six beekeepers at once. It runs a trial with one beekeeper, one harvest, one extraction, one test, one packing run, one delivery, and two shops. The trial lot is real honey, sold in real shops, but the group watches it closely and meets each week to discuss what worked and what did not.

The trial follows the honey in order. The beekeeper harvests, enters the harvest record in the app, and checks that the record appears in the ledger. The packing house receives the honey, scans the lot number, confirms receipt, extracts it, enters the extraction record, and checks that the record names the right lot and quantity. The laboratory takes a sample, tests it, enters the test record, signs it, and checks that the packing house can read the result. The packing house packs the jars, prints the codes, enters the packing record, and checks that scanning a jar opens the right journey page. The distributor delivers the jars to two shops, enters the delivery record, and checks that the shops can see it. The shops receive the jars, scan the codes, enter receipt records, and put the jars on sale.

At each step, the group notes the time taken, the mistakes made, and the questions asked. The beekeeper finds the harvest form quick, but the phone connection in the field is weak, so the record arrives late and the beekeeper must remember to send it when back in range. The packing house finds the extraction form clear, but one jar code prints badly and must be reprinted, which teaches the group to check codes before the jars leave the packing house. A shopper scans a jar and asks what a test name means, which teaches the group to write the shopper page in plainer words. None of these are failures. They are the lessons a trial is meant to find, while the scale is small and the cost of fixing them is low.

The trial ends with a test of the three questions from Step 1. A volunteer shopper scans a jar and reads the journey. The packing house runs a recall search for the trial lot and times it. A buyer checks a test result without phoning the laboratory. If all three pass, the group agrees to add the other beekeepers, one at a time, with training each time. If any one fails, the group fixes the design and runs the trial again. The group does not add members to a system that has not yet proved it can answer its own questions.

The trial lot, hive to shelf

Beekeeper harvests, enters the harvest record in the app
↓
Packing house receives, extracts, enters the extraction record
↓
Laboratory tests a sample, signs and enters the test record
↓
Packing house packs jars, prints codes, enters the packing record
↓
Distributor delivers, shops receive, scan codes, enter receipt records

The diagram shows the trial lot in order. The steps point to the diagram: each step is checked before the next begins, so a mistake is found while the lot is still small and the fix is cheap.

Quick self-check

Question: Why run the trial with one beekeeper and two shops, not all members at once?

Because a small trial finds lessons, such as a weak phone connection or a badly printed code, while the scale is small and the fix is cheap. Adding all members to an untested system multiplies every mistake.

Question: What three tests end the trial?

A shopper scan that reads the journey, a recall search that returns the affected jars and shops quickly, and a buyer check of a test result without phoning the laboratory.

Step 6: add a smart contract, carefully, and only one

With the chain running and the recall tested, the group considers a smart contract. They choose one simple use, from Unit 5: payment on delivery, with a quality check. The rule is written in words first, then as code, and it is tested before it is stored.

The rule, in words, is this: when a honey lot is delivered to the packing house, and its test result is recorded as passing, and the quantity delivered matches the quantity in the harvest record within a small agreed tolerance, the contract records a payment instruction for the agreed price for that quantity. If the test result is missing, or the test failed, or the quantity differs by more than the tolerance, the contract does not record a payment instruction. Instead, it records that the conditions were not met, and flags the delivery for a person to review. The person then decides: pay a lower price, hold the lot for retesting, or refuse it.

The group writes the edge cases before coding. What if the test result arrives a day after delivery? The contract waits, and does not act until the result arrives, or until a set time passes, after which it flags the delivery for a person. What if the quantity is short by a small amount within tolerance? The contract pays for the quantity delivered, not the quantity promised. What if the sensor or the app fails and the delivery record is late? The contract reads the record when it arrives, and the delay is visible in the timestamps. What if the beekeeper disagrees with the test result? The written agreement gives the beekeeper a right to ask for a retest, and the contract waits for the retest result before acting.

The contract is tested with made-up records covering the normal case, the borderline case, and the failure case, as Unit 5 advised. A normal delivery passes and pays. A delivery with a missing test is flagged, not paid. A delivery with a quantity just inside tolerance pays for the delivered quantity. A delivery with a quantity just outside tolerance is flagged. An auditor who did not write the code reads the code against the words and confirms they match. Only then is the contract stored, and its first real runs are watched closely, with a person checking each payment instruction against the records before the money moves, until the group trusts the contract.

The group does not add a second contract until the first has run well for a full season. That discipline, one contract at a time, with testing each time, is what keeps smart contracts safe in food chains, where a mistake repeats with every delivery until it is found.

Quick self-check

Question: What three conditions must be met for the honey payment contract to act?

The honey lot is delivered, its test result is recorded as passing, and the quantity delivered matches the harvest record within the agreed tolerance. If any one fails, the contract flags the delivery for a person instead of paying.

Question: Why watch the first real runs of a smart contract closely?

Because a mistake in the code repeats every time the contract runs. Watching the first runs, with a person checking each payment against the records, catches a mistake before it has paid the wrong price many times.

Try it yourself

Choose a food chain you know: a dairy, a bakery, a fruit packer, or a vegetable box scheme. Follow the six steps in this unit for that food, on paper. Write the three questions the chain must answer. List the members, their roles, and their permissions. Design the batch numbers, and test them on paper with one imagined lot. Sketch the record forms, and write three checks each form should make before sealing a record. Plan a trial with one lot, and a practice recall for that lot. Write one smart contract rule in words, with its edge cases. Finish by answering the five decision questions from Unit 6 for your food, and write whether you would build the chain, use a simpler tool, or fix a different problem first. Bring your six-step plan to your next session and compare it with a classmate: whose plan is simpler, and whose chain is more likely to be used every day?

Key ideas to carry forward

  • Start with the questions the chain must answer, not with software, and write down what success will look like.
  • Name every member, their role, what they may write, and what they may read, and write those permissions into the agreement.
  • Design batch numbers on paper first, with rules for mixing and splitting that name every input and every output.
  • Build simple forms with checks that refuse a bad record at entry, while the person is still there to fix it.
  • Trial with one lot, from hive to shelf, and test the three questions before adding more members.
  • Add one smart contract at a time, with the rule written in words first, edge cases named, and the code audited before storage.
  • Tend the chain with daily, weekly, and monthly routines, handle mistakes by adding correcting records, and plan for growth without breaking old records.
  • The method transfers to other foods, but the details must be set fresh for each food, and a simpler tool is right when the decision test does not pass.

Glossary

Extraction batch

A batch of honey, or another food, produced by one extraction run, given one number so it can be traced. Food tech example: honey from two lots extracted together forms one extraction batch, whose record names both lots.

Harvest record

A record of a harvest, naming the grower, the place, the date, the quantity, and the lot number. Food tech example: a beekeeper harvest record names the hive group, the date, and the honey lot.

Jar batch

A batch of jars filled in one packing run from one extraction batch, given one number. Food tech example: jars filled from extraction batch E-14 form one jar batch, and each jar code points to it.

Packing record

A record of a packing run, naming the input batch, the output batch, the number of packs, and the date. Food tech example: a honey packing record names the extraction batch, the jar batch, and the jar count.

Practice recall

A planned test of a recall with a made-up problem, timed and reviewed, to find gaps before a real recall. Food tech example: a honey group runs a practice recall for one lot and times the shop list.

Receipt record

A record by a receiver that a delivery arrived, naming the batch, the quantity, the date, and the condition. Food tech example: a shop receipt record confirms that a jar batch arrived in good condition.

Tolerance

A small agreed difference allowed between a promised quantity or value and the delivered one, before a delivery is flagged. Food tech example: a honey delivery within the agreed tolerance for quantity is paid for the quantity delivered.

Trial

A small test of a system with a few members and a few products, judged against a stated measure of success before a wider rollout. Food tech example: a honey chain trials with one beekeeper and two shops before adding the rest.

Delivery record

A record of a delivery, naming the batch, the quantity, the receiver, the date, and the vehicle. Food tech example: a distributor delivery record names the jar batch and the shops that received it.

Test record

A record of a test, naming the sample, the lot, the method, the result, the date, and the tester. Food tech example: a laboratory test record for a honey lot names the method and the result, signed by the laboratory.

Single-origin

A claim that a food comes from one named place, producer, or group of producers, rather than a blend of many origins. Food tech example: single-origin honey comes from the hives of named beekeepers, shown by its harvest records.

Routine

A regular check or task, done daily, weekly, or monthly, that keeps a system working and honest. Food tech example: a daily routine checks that nodes are in step and records are arriving.

Shopper page

A simple web page opened by scanning a code on a pack, showing the journey of that batch in plain words. Food tech example: a honey jar code opens a shopper page showing the hives, harvest date, and test result.

Agreement

The written understanding between chain members, stating roles, permissions, numbering, and what happens when something goes wrong. Food tech example: the honey chain agreement states who may write each record and who may read it.

References

  • Irudayaraj, J., Food Processing Operations Modeling, Design, and Analysis, 2nd edition, 2002.
  • Singh, R. P., Computer Applications in Food Technology, 1996.
  • Nielsen, S. S., Introduction to the Chemical Analysis of Foods, 1997.