package Ġcom . D ak ar wallet . core . app . block chains . tron Ċ Ċ import Ġcom . google . protobuf . ByteString Ċ import Ġcom . D ak ar wallet . core . app . utils . to Hex ByteArray Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Test Ċ import Ġwallet . core . java . Any Signer Ċ import Ġwallet . core . jni . proto . Tr on Ċ import Ġwallet . core . jni . proto . Tr on . Signing Output Ċ import Ġcom . D ak ar wallet . core . app . utils . Numeric Ċ import Ġorg . junit . Assert . assertArrayEquals Ċ import Ġwallet . core . jni . Coin Type . TR ON Ċ Ċ class ĠTest Tr on Transaction Signer Ġ{ ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠSystem . load Library (" D ak ar Wallet Core ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Sign Transfer Tr c 2 0 Contract () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtr c 2 0 Contract Ġ= ĠTr on . Transfer TR C 2 0 Contract . newBuilder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Owner Address (" T JR y Ww Fs 9 w TF GZ g 3 J br V ri Fb Nf C ug 5 t De C ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Contract Address (" TH TR 7 5 o 8 x X Ag CT Qq pi ot 2 A FR A jv W 1 t Sb VV ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set To Address (" TW 1 d U 4 L 3 e Nm 7 Lw 8 Wv ie L KE Hp X WA uss RG 9 Z ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġ 1 0 0 0 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Amount ( ByteString . copyFrom (" 0 x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 e 8 ". to Hex ByteArray ())) ĊĊĠĠĠĠĠĠĠ Ġval Ġblock Header Ġ= ĠTr on . Block Header . newBuilder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Timestamp ( 1 5 3 9 2 9 5 4 7 9 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Tx T rie Root ( ByteString . copyFrom (" 0 x 6 4 2 8 8 c 2 db 0 6 4 1 3 1 6 7 6 2 a 9 9 dbb 0 2 ef 7 c 9 0 f 9 6 8 b 6 0 f 9 f 2 e 4 1 0 8 3 5 9 8 0 6 1 4 3 3 2 f 8 6 d ". to Hex ByteArray ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setParent Hash ( ByteString . copyFrom (" 0 x 0 0 0 0 0 0 0 0 0 0 2 f 7 b 3 af 4 f 5 f 8 b 9 e 2 3 a 3 0 c 5 3 0 f 7 1 9 f 1 6 5 b 7 4 2 e 7 3 5 8 5 3 6 b 2 8 0 ee ad 2 d ". to Hex ByteArray ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Number ( 3 1 1 1 7 3 9 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set W itness Address ( ByteString . copyFrom (" 0 x 4 1 5 8 6 3 f 6 0 9 1 b 8 e 7 1 7 6 6 da 8 0 8 b 1 dd 3 1 5 9 7 9 0 f 6 1 de 7 d ". to Hex ByteArray ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Version ( 3 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġtransaction Ġ= ĠTr on . Transaction . newBuilder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Transfer Tr c 2 0 Contract ( trc 2 0 Contract ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Timestamp ( 1 5 3 9 2 9 5 4 7 9 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Block Header ( block Header ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġsigning Input Ġ= ĠTr on . Signing Input . newBuilder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Transaction ( transaction ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set PrivateKey ( ByteString . copyFrom (" 2 d 8 f 6 8 9 4 4 bdb fbc 0 7 6 9 5 4 2 fba 8 fc 2 d 2 a 3 de 6 7 3 9 3 3 3 4 4 7 1 6 2 4 3 6 4 c 7 0 0 6 da 2 aa 5 4 ". to Hex ByteArray ())) ĊĊĠĠĠĠĠĠĠ Ġval Ġoutput Ġ= ĠAny Signer . sign ( signing Input . build (), ĠTR ON , ĠTr on . Signing Output . parser ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( Numeric . to HexString ( output . id . toByteArray ()), Ġ" 0 x 0 d 6 4 4 2 9 0 e 3 cf 5 5 4 f 6 2 1 9 c 7 7 4 7 f 5 2 8 7 5 8 9 b 6 e 7 e 3 0 e 1 b 0 2 7 9 3 b 4 8 ba 3 6 2 da 6 a 5 0 5 8 ") ĊĠĠĠĠĠĠĠ ĠassertEquals ( Numeric . to HexString ( output . signature . toByteArray ()), Ġ" 0 xb ec 7 9 0 8 7 7 b 3 a 0 0 8 6 4 0 7 8 1 e 3 9 4 8 b 0 7 0 7 4 0 b 1 f 6 0 2 3 c 2 9 ecb 3 f 7 b 5 8 3 5 4 3 3 c 1 3 fc 5 8 3 5 e 5 cad 3 bd 4 4 3 6 0 ff 2 dd ad 5 ed 7 dc 9 d 7 dee 6 8 7 8 f 9 0 e 8 6 a 4 0 3 5 5 b 7 6 9 7 f 5 9 5 4 b 8 8 c 0 1 ") ĊĠĠĠ Ġ} Ċ } Ċ