从aptos网络中的原始交易中获取交易哈希

问题描述 投票:0回答:1

在广播签名交易之前,我需要获取交易哈希或 ID。 我四处寻找图书馆或软件包,但没有找到。 查看aptos-core源代码后,发现了这些注释:

    /// To create a transaction hash by yourself, do the following:
    ///   1. Hash message bytes: "RawTransaction" bytes + BCS bytes of [Transaction](https://aptos-labs.github.io/aptos-core/aptos_types/transaction/enum.Transaction.html).
    ///   2. Apply hash algorithm `SHA3-256` to the hash message bytes.
    ///   3. Hex-encode the hash bytes with `0x` prefix.
    // TODO: Include a link to an example of how to do this ^

Srouce(https://github.com/aptos-labs/aptos-core/blob/main/api/src/transactions.rs#L186

我不知道如何执行步骤 1。 任何帮助将不胜感激。

我尝试按照“https://aptos-labs.github.io/aptos-core/aptos_types/transaction/enum.Transaction.html”中提供的说明进行操作,但此链接不可用或私有。

aptos
1个回答
0
投票

simulateTransaction功能有用吗?

© www.soinside.com 2019 - 2024. All rights reserved.