The graduation certificate of Tianjin University will be permanently recorded on the CyberMiles blockchain, which can be stored permanently and cannot be tampered with! How is this achieved?

The entire Dapp design is divided into two parts: * The smart contract records key information to ensure that the information cannot be corrected. This part is equivalent to the replacement of traditional applications; * The front-end display page is implemented using HTML, JavaScript, and CSS, 100% copying the real world certificate.

The two parts of the smart contract and the front-end display page are implemented through web3-cmt.js.

The following is a detailed explanation of the smart contract part for everyone. The contract basically does not involve calculations, and is mainly implemented through strings

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
contract TianjinStudent { //Contract name, here can be changed at will
  string private name; //Contract
  bool private isFemale; //Select gender
  string private birth; // Birth date
  string private prog_date; // Study time
  string private certId; //The number of the paper certificate is unique
  string private cert_date; //Certificate awarding date
  string private url; // Certificate photo link
  
  //The parameters here can be customized based on needs

  constructor (string _name, bool _isFemale, string _birth, string _certId, string _url ) public {
    name = _name;
    isFemale = _isFemale;
    birth = _birth;
    certId = _certId;
    url = _url;
    prog_date = "5/1/2019-4/30/2020";
    cert_date = "7/18/2020";
    }
    
   // constructor defines the constructor. When the contract is created, the object is initialized. The object is called the initial value. In this example, it is the various parameters we mentioned above.

  function get() public view returns (string, bool, string, string, string, string, string) {
    return (name, isFemale, birth, certid, prog_date, url)
    
   }
  }
  
  // The stage function implements the parameters of calling the corresponding parameters, returning the parameters of name, isFemale, birth, certid, prog_date, and url.
  

Open BUIDL for CMT,Copy and paste the above code into BUIDL, click on compile,get the ABI and parameter of the contract.

Fill in the parameters on the graduation certificate, name, gender, date of birth, study time, certificate number, certificate submission time, and graduation certificate student photo link into the information field at the beginning, and click “Deploy on the chain”.

Pay a little gas, and the contract is deployed. Click the call button and you can see the information just recorded on the chain. In this way, the core information on the graduation certificate is put on the chain. The next thing that needs to work on is the front-end display page.