Table 5 Smart contract logic design.
Contract function | Contractual method | Description | Input | Output |
|---|---|---|---|---|
Upload Biological Risk Factor BBPR-AC Access Control Information | addSubjectAttribute() | Write the information on agricultural biological risk factor traceability subjects into the blockchain | Information on Traceability Subjects of Agricultural Biological Risk Factors | True/False |
addObjectAttribute() | Write biological risk factor object information for each link in the agricultural supply chain into the blockchain | Agricultural Biological Risk Factor Object Information | True/False | |
addPolicy() | Write the information of the designed access strategy for biological risk factors into the blockchain | Subject information, biological risk factor object information, environment, correspondence action | True/False | |
setFixedEnvironment() | Writing environmental information involved in access control to the blockchain | Strategic Environmental Information | True/False | |
Upload () | Public traceability information of agricultural biological risk factors written on the chain | Biorisk factor traceability data | True/False | |
Biological Risk Factor Data Query | getRecordByID() | Traceability information by batch number | Agricultural batch number | Public or private information about the traceability of the produce with the corresponding batch number |
getRecordByName() | Query policy information by name | Name of the strategy | Policy name, information on subjects allowed to access, resource information, authorization action | |
Strategic decision making | checkAccessPermission() | Input information such as subject ID, subject attributes, resource ID you want to access, and actions to determine whether the subject has the relevant permissions | Subject ID, Subject Organisation, Subject Role, Subject Affiliated Link, Resource ID, Action | Authorization information. Returns authorization success if the permissions are correct, or authorization failure if the permissions are incorrect |