xssnick / tonutils-go

TON SDK Library in pure Golang for interacting with The Open Network ecosystem using native protocols, such as ADNL, RLDP and etc.
Apache License 2.0
535 stars 109 forks source link

Message hash is different from tonscan's message hash. #245

Open fishTsai20 opened 1 month ago

fishTsai20 commented 1 month ago

src_tx_hash:'8do0P2NEK7qtycZHniERQWGQ9Wy7BJQKtarpMkOa/gw=' hash:'5cOyEmX7zMOffQ41NkjeEuAfVaAFbGis8wIExCxlOVI=' src:'EQCN8t4vcAdfIinTuARZ49Ue3Wbx4XPUUET2KgVu579AhnYv' dest:'EQDkLxDcJbXAlP3pzhrK6BRVLgYB538FENOIUQSBTWR6GypP' the way we parse message.hash as below

message tlb.Message
msgCell, err := tlb.ToCell(message)
msg.Hash = msgCell.Hash()
hash = base64.StdEncoding.EncodeToString(msg.Hash)

https://tonscan.org/tx/f1da343f63442bbaadc9c6479e2111416190f56cbb04940ab5aae932439afe0c But tonscan's message hash is 'ZpxcGqC4otnm2wIXgrSTMGaEmAe7f5UKgkPHV+bpNMQ=' image

xssnick commented 1 month ago

Try calc hash of message.Msg (ExternalMessage type)

fishTsai20 commented 1 month ago

this is internal message

xssnick commented 1 month ago

then hash InternalMessage type, same Msg field, not full tlb.Message

fishTsai20 commented 1 month ago

I use msg field. the base64 the same as full tlb.Message. and still different from tonscan. the hash I get: '5cOyEmX7zMOffQ41NkjeEuAfVaAFbGis8wIExCxlOVI=', but tonscan 'ZpxcGqC4otnm2wIXgrSTMGaEmAe7f5UKgkPHV+bpNMQ='