面向农产品交易流程的多链式区块链应用技术研究
梁昊, 刘思辰, 张一诺, 吕科

Multi-blockchain application technology for agricultural products transaction
Hao Liang, Sichen Liu, Yinuo Zhang, Ke Lv
Step 1. Registration of users information

1 : function RegistrationUserInformation( U s e r u s e r )

2 : Let L = l e n g t h ( u s e . i n f o ) ;

3 : Let u s e r . c e r t i f i c a t a b l e = t r u e ;

4 : for ( i = 0 ; i < L ; i + + )

5 : if ( u s e r . i n f o [ i ] t r u e ) Then

6 : u s e r . c e r t i f i c a t a b l e = f a l s e ;

7 : break;

8 : End if

9 : End for

10: if ( u s e r . c e r t i f i c a t a b l e = = t r u e ) Then

11: u s e r . D C = D i g i t a l C e r t i f i c a t e ( u s e r ) ;

12: u s e r . p u b l i c k e y = P u b l i c K e y u s e r ;

13: u s e r . p r i v a t e k e y = P r i v a t e K e y ( u s e r ) ;

14: u s e r . a d d r e s s = A d d r e s s ( u s e . p u b l i c k e y ) ;

15: u s e r . i n f o = E n c r y p t ( u s e r . i n f o ) ;

16: B l o c k u s e r b u = n e w B l o c k u s e r ( ) ;

17: b u . u s e r . i n f o = u s e r . i n f o ;

18: b u . h a s h = M e r k l e h a s h ( u s e r . i n f o ) ;

19: b u . t i m e s t a m p = n o w ( ) ;

20: b u . c o n s e n s u s = C A . s i g n a t u r e ;

21: b u . c o n s h a s h = h a s h ( b l o c k . c o n s e n s u s ) ;

22: push b u into U s e r I n f o r m a t i o n B l o c k c h a i n ;

23: End if;

24: End function