## Smart Tags and Containers (STAC) | Team Sixsee
### Preface
Our idea aims to solve the following in a cost efficient, and scalable
way:
1. Identifying and tagging counterfeit products before it reaches the customer
2. Tracking the possible damage to goods enroute. This happens in the
both cases:
- When a customer recieves the order
- When a customer returns the order
3. Ensuring the goods are not swapped in between the supply chain, be it
by the customer or by an employee
### Components
Our teams proposes _Smart Containers_ and _Tags_ (STAC) for the given theme.
It comprises of several physical and digital components:
#### Physical
1. A reusable physical container, with a ADXL based shock detection
module attached to it, which we call the __Smart Container__.
- With enough research, we have decided to go with ADXL sensors for
the best accuracy when it comes to shock and lowest electric current
usage when it comes to battery [1].
2. A ephemeral __Smart Tag__ which can be a sticker or a normal tag, which will
have a printed QR code.
#### Digital
- A blockchain based supply chain.
- Entries to blockchain will be stopped once a defected value is recorded hence preventing further transfers.
- Asymmetric Key Cryptography.
- A dashboard in **React** which is accessible to the Amazon admin and the customer.
- Smart Contracts will be deployed on **Polygon Blockchain** which is Ethereum based blockchain with consensus mechanism based on **Proof of Stake**.
- We also plan to introduce **Amazon Tokens** that can be used for payments and easy refunds.
- PoC Backend made in NodeJS.
### Overview

In order to easily explain our idea, let's imagine it is incorporated into Amazon
already. Now we walkthrough the supply chain:
1. Alice makes a new customer account on Amazon.
- When the new account is created, it also creates an unique
asymmetric keypair for Alice.
2. Bob makes a retail account on Amazon, and lists a pair of shoes as one
of their shop's product.
- When the new commodity (shoes) is created, it also creates an
unique asymmetric keypair for each pair of shoes.
3. Alice is ordering one of Bob's pair of shoes from Amazon.
- When the order is made, a string of text is generated based on the
properties of order. This string is then __encrypted using Alice's
private key and the shoes' public key__ and sent to Bob digitally.
- Bob can verify the order request by __decrypting the encrypted
string using Alice's public key first and then the shoes' private
key__.
- Once verified, a _Smart Container_ will be associated with the order
digitally, and in the blockchain.
- A string with the order details and ___Smart Container_ ID__ with its
contents will be generated at Bob's end. The string will be
__encrypted by the shoes' private key first and then Alice's public
key__.
- The encrypted string will be be available to Bob as a QR code,
which they can print on a _Smart Tag_.
- An entry is made into the blockchain which encapsulates all the
details of the product (pair of shoes), the seller, Alice, etc.
4. Inside the Amazon workhouse, the __employees will attach the _Smart Tag_
with the shoes, and place it inside the assigned _Smart Container___.
5. During the time when the order is enroute, the __ADXL module will keep
track of all the necessary physical properties which include Shock or
Vibrations, etc__.
- Every reading will be broadcasted into the blockchain.
- __If a reading crosses some threshold, the _Smart Container_ will be
marked for checking in its next checkpoint__.
- If the shoes were deemed damaged on inspection, they will be sent
back to the warehouse
6. If the _Smart Container_'s readings did not cross any threshold, or was
marked undamaged during its checkpoints, it will be delivered to
Alice.
- Alice now has to scan the QR code (recall that it was the encrypted
message from Bob's end).
- __If Alice is able to decrypt the message using their private key and
the shoes' public key, it means the shoes were not swapped in between
the supply chain.__
- Once the decrypted message is obtained, Alice can check for the
_Smart Container_ ID, and cross-check it with the _Smart Container_ the
delivery person presented to them.
- __If the _Smart Container_ ID matches, it means the _Smart Containers_
were not swapped as well, which ensures that the shoes did not
undergo any physical damage.__
- All the necessary transanctional data will be added to the
Blockchain.
- The _Smart Container_ will now be returned to the warehouse, where it
awaits its next order.
7. If Alice decides to return the order, the exact same process will be
executed, but now Alice will become Bob, and Bob will become Alice.
- __If the _Smart Tag_ is damaged or swapped, then the message
decryption will fail, which ensures that the same product is
returned.__
- __The newly assigned _Smart Container_ will again track all the
necessary physical properties while enroute, which ensures that any damage caused was not by Alice, but was caused enroute__
### Implementation
1. **Smart Contract** will be generated on placing an order. A unique entry will be generated corresponding to order ID and a **unique hash** will be assigned to all the orders based on Users and Products.
2. All the reading which are recorded from **Smart Container** will be sent to blockchain after a specific amount of time using **NodeMCU**. We will use modifiers that will ensure that product will not get transferred once it is marked defected.
3. All the checkpoints in transfers will be checked and stored in the blockchain to ensure proper delivery of the asset. At the consumer end it will be signed by the consumer using product's private key and customers public key and hence the delivery will be marked successful.
4. **Smart Container** can be reused as it will be taken to the warehouse by Amazon employee. Hence keeping the usage cost very low.
5. At the time of refund the employee can scan the **Smart Tag** attached with the product and all the details regarding ownership and history will be displayed on their device. User can sign the return/refund using their private key and after verification of no physical damage amount will automatically get refund in customer's account in form of **Amazon Tokens**.
6. We will also introduce a concept of **Amazon Tokens** that can be used to pay for the order and automated refund in amazon wallets using smart contracts.
### About Us
Our team includes Blockchain developers, IoT developers, Web developers
in terms of experience, while in terms of relevant Acheivements, it
includes Smart India Hackathon 2022 Qualifiers and Flipkart GRiD 3.0 National
Winners.
### References
[1]: J. Zidar, I. Aleksi, T. Matić and D. Žagar, "Comparison of different acceleration sensors for low power vibrations and shock detection in supply chain," 2022 45th Jubilee International Convention on Information, Communication and Electronic Technology (MIPRO), 2022, pp. 829-834, doi: 10.23919/MIPRO55190.2022.9803798.