如何在不注入链的情况下获得操作的哈希值
1 个回答
- 投票数
-
- 2019-08-06
您可以使用rpc使用节点远程伪造操作: /chains/main/blocks/head/helpers/forge/operations. 这是一个POST请求,您必须提供一个json文件,例如: {"branch":block_hash," contents":操作列表}. 操作类型有些棘手,您可以在 http://tezos.gitlab.io/mainnet/api/rpc.html#post-block-id-helpers-forge-operations . 因此,操作的哈希取决于"分支",通常将其视为头哈希.如果使用相同的"分支"注入它,则将具有相同的哈希,但是要小心,因为"分支"在64个级别后将变得无效. 如果使用的是客户端,还可以将带有-D选项的transfer命令与" dry-run"一起使用,这将完成所有伪造和检查工作,但只会进行伪造注射.
You can forge operations remotly using a node, with the rpc : /chains/main/blocks/head/helpers/forge/operations. This is a POST request, you have to give a json file like: { "branch" : block_hash, "contents" : operation list}. Operation type is a bit tricky, you can find some documentation in http://tezos.gitlab.io/mainnet/api/rpc.html#post-block-id-helpers-forge-operations. So the hash of the operation depends on the "branch" which is normally taken as the head hash. If you inject it with the same "branch" it will have the same hash, but be careful since the "branch" becomes invalid after 64 levels. If you are using the client, you can also use the transfer command with the -D option as "dry-run", that will do all the work of forging and checking but only do a fake injection.
-
伪造一个op之后,您必须对其进行签名,然后将签名附加到数据向量上,对其进行blake2b哈希(32字节),在0x0574之前添加前缀,然后对结果进行base58编码.After you forged an op you have to sign it, append the signature to the data vector, take blake2b hash (32 bytes) of it, prepend 0x0574, and base58 encode the result.
- 0
- 2019-08-06
- Michael Zaikin
-
使用进样/操作数据 h:=blake2b.Sum256(rawBytes) 哈希:=CheckEncode(h [:],opPrefix)Use injection/operation data h := blake2b.Sum256(rawBytes) hash := CheckEncode(h[:], opPrefix)
- 0
- 2020-07-23
- Crossle Song
是否可以在不注入区块链操作的情况下获得txn哈希?注入后,我会得到相同的txn哈希吗?