ton函数函数hash的两种形式

// Send Msg
        let msg =  beginCell()
        .storeBuffer(Buffer.from("c5341626", "hex")) // 发送结构体
        .storeStringRefTail("2") // storeStringTail 会报错不支持?
        .endCell()

        // let msg =  beginCell()
        // .storeUint(3308525094, 32) // c5341626的10进制数 3308525094
        // .storeStringRefTail("1")
        // .endCell()

        let seqno: number = await wallet_contract.getSeqno()
        console.log("wallet_contract seqno is ",seqno);
        let result =await wallet_contract.sendTransfer({
                seqno: seqno,
                secretKey: keyPair.secretKey,
                messages: [
                    internal({
                        to: deployContract,
                        value: toNano("0.1"), // 给个0.2Ton作为gas费
                        init: null,
                        bounce: false,
                        body: msg ,
                    }),
                ],
        });

 

      let msg =  beginCell()
        .storeBuffer(Buffer.from("c5341626", "hex")) // 发送结构体
        .storeStringRefTail("2") 
        .endCell()

和这个区块是一样的:

      let msg =  beginCell()
        .storeUint(3308525094, 32) // c5341626的10进制数 3308525094
        .storeStringRefTail("1")
        .endCell()

根据上面的转换,c53416263308525094 实际上是相同的数值,只不过一个是十六进制表示,另一个是十进制表示。因此,这两个字符串代表的数值是相同的,只是表达方式不同。

在 TON 区块链中,这两个数值作为头部标识符可能用于区分不同的消息或数据类型。因此,在合约中可能会根据这些头部标识符来识别不同类型的消息或数据。请根据具体的合约逻辑和 ABI 定义来确认这些头部标识符的具体含义和用途。

posted @ 2024-10-13 23:50  若-飞  阅读(66)  评论(0)    收藏  举报