This is the SCNU LOST GOODS of Hyperledger Composer samples.
This business network defines:
Participant
Person
, SystemAdmin
Asset
GoodsAsset
, WalletAsset
Transaction
SubmitLostGoodsTransaction
: I lost my goods, submit and write it to blockchain;SubmitFoundGoodsTransaction
: I found something, submit and write it to blockchain;SubmitLostGoodsTransaction
: Someone revert lost goods, submit and write it to blockchain;PickTransaction
: Someone picked your lost goods and tell everyone I found it;RevertTransaction
: Picker reverts the lost goods to STUU and reward picker (if exists) 10 coins;ReturnBackTransaction
: Lost goods are returned back to its owner and reward picker (if exists) 90 coins;CancelTransaction
: Owner cancel to find his goods;InitWalletTransaction
: Owner init his wallet when registering.
Read
lost.cto
to know structure of transactions
Event
GoodsLostEvent
, GoodsFoundEvent
, GoodsRevertedEvent
,
GoodsReturnEvent
, GoodsCancelEvent
, WalletInitEvent
,
WalletCoinChangeEvent
This project can run in Hyperledger Composer Playground, you can browse composer-playground.mybluemix.net to test online demo. If you live in China Mainland, maybe you can not connect to this website but use proxy or VPN to bypass the firewall.
To test this Business Network Definition in the Test tab:
Create a SchoolParticipant
participant:
{
"$class": "cn.edu.scnu.lost.SchoolParticipant",
"cardId": "20180123",
"name": "Toby",
"department": "Network Center"
}
Submit a SubmitLostGoodsTransaction
transaction:
{
"$class": "cn.edu.scnu.lost.SubmitLostGoodsTransaction",
"goodsId": "1",
"type": "STUDENT_ECARD"
}
After submitting this transaction, you should now see the transaction in the Transaction Registry and that a GoodsLostEvent
has been emitted. And new lost goods is submitted in Blockchain.
Congratulations!
Namespace: cn.edu.scnu
A normal user of university, including students, teachers, staffs and other people.
Person CAN submit infomation of goods that he lost or found. If person give up, he can cancel and remove the information of his own lost goods.
Namespace: cn.edu.scnu.lost
A administator of SCNU-LOST-GOODS system, including super admin, admin and student assistants.
ONLY SystemAdmin CAN DO REVERTING and RETURNING transactions.
Fields Name | Type | Default | Description | |
---|---|---|---|---|
goodsId | String | required | None | ID of goods |
owner | Person | optional | None | Owner of goods |
picker | Person | optional | None | Who pick this goods |
receiver | SystemAdmin | optional | None | Who goods reverted to |
state | GoodsState | required | 'LOST' | Statement of goods |
type | GoodsType | required | None | Type of goods |
subject | String | optional | None | Name of this goods |
description | String | optional | None | More detial of goods |
canceledReason | String | optional | None | Reason why owner canceled |
revertedPlace | String | optional | None | Place where goods was reverted |
returnedPlace | String | optional | None | Place where goods was returned |
createAt | DateTime | required | None | Time of goods is submitted |
foundAt | DateTime | optional | None | Time of goods is found |
revertedAt | DateTime | optional | None | Time of goods is reverted |
finishAt | DateTime | optional | None | Time of goods is canceled or returned |
Fields Name | Type | Default | Description | |
---|---|---|---|---|
userId | String | required | None | User ID of wallet |
coin | Integer | required | 0 | Coin count of wallet |
SCNU_ECARD
: SCNU E-CardGZ_UNITOWN_ECARD
: Guangzhou university town E-CardSTUDENT_ID_CARD
: Student ID CardTRANSPORT_PASS
: Transport pass, such as YangchengtongMOBILE_PHONE
: Mobile phoneBICYCLE
: BicycleLAPTOP
: LaptopKEY_PAIR
: Key pairOTHERS
: Other goods
LOST
: This goods is lostFOUND
: This goods is found but not revertedREVERTED
: This goods is reverted and stayed in STUU StationRETURNED
: This goods is returned to its ownerCANCELED
: The owner canceled this order
SUPER_ADMIN
: Super admin of this system, such as teacherADMIN
: Admin of this system, such as leader studentsASSISTANT
: People who work in STUU Station and are in charge of reverting and returning
Apache-2.0