美文网首页
CKB Transaction交易数据分析

CKB Transaction交易数据分析

作者: 空乱木 | 来源:发表于2020-05-02 23:37 被阅读0次

    前提条件-1地址

    Addresses-1
    Testnet ckt1qyqvkdgtra55kgh2ngcuppr5vy5pw7g5z7yqrajwwp

    Public Key
    Key(n/a)
    Hash 0xcb350b1f694b22ea9a31c0847461281779141788

    Lock Hash
    0xf36ae14f410b1cac72793362d15678c0ce42b8b0337f390be37789ee3993ff74

    Addresses-2
    Testnet ckt1qyqfjnuknk49hnz2ft8mmgeegczjxwclq70s3ww3ws

    Public Key
    Key(n/a)
    Hash 0x994f969daa5bcc4a4acfbda3394605233b1f079f

    Lock Hash
    0x719e94b1b0bf4beaa195f149af9da70ae95d324e908d74f44584f10d02212f6f

    前提条件-2加密算法-secp256k1

    codeHash 是secp256k1合约的CodeHash值,固定不变,deps中的txHash是合约部署时的交易Hash;不同的环境不同。

    codeHash = “0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
    hashType:ScriptHashType = “type”,
    deps:CellDep[] = [{
      outPoint: {
        txHash: “0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708”,
        index: “0x0”,
      },
      depType: “depGroup”,
    }]
    

    操作

    从Address1 转移200代币到Address2。

    解释

    001-cellDeps:

    默认加密算法secp256k1对应的Deps。

    "cellDeps”:[
        {
            "depType":”depGroup”,
            "outPoint”:{
                "txHash":”0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708”,
                "index":”0x0”
            }
        }
    ]
    

    002-inputs

    上一个交易的输出。(上一个交易的输出可以是多个)

    "inputs”:[
        {
            "since":”0x0”,
            "previousOutput”:{
                "txHash":”0x00aac36b14e0b2c374b4b6de97f797d20657bcfec1bdfaa15e36ef5b53ca0d79”,
                "index":”0x0”
            }
        }
    ]
    

    003-Outputs

    001-
    "hashType":”type”,
    "codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8” 为secp256k1中对应的hashType和codeHash。

    002-
    "args":”0x994f969daa5bcc4a4acfbda3394605233b1f079f” :Address2的Public Key Hash
    "capacity":”0x4a817c800”: 根据Args可以判断出为转移代币数量,并且知道代币属于谁。

    "args":”0xcb350b1f694b22ea9a31c0847461281779141788":Address1的Public Key Hash
    "capacity":” 0xdf8444ac0":根据Args可以判断为找零的代币数量。

    outputs中的记录数对应交易输出的数量。

    "outputs”:[
        {
            "capacity":”0x4a817c800”,
            "lock”:{
                "hashType":”type”,
                "codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
                "args":”0x994f969daa5bcc4a4acfbda3394605233b1f079f”
            },
            "type”:null
        },
        {
            "capacity":” 0xdf8444ac0”,
            "lock”:{
                "hashType":”type”,
                "codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
                "args":”0xcb350b1f694b22ea9a31c0847461281779141788”
            },
            "type”:null
        }
    ]
    

    交易截图

    image.png

    交易详细

    {
        "version":"0x0",
        "cellDeps":[
            {
                "depType":"depGroup",
                "outPoint":{
                    "txHash":"0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708",
                    "index":"0x0"
                }
            }
        ],
        "headerDeps":[
        ],
        "inputs":[
            {
                "since":"0x0",
                "previousOutput":{
                    "txHash":"0xba3bebf947c3392c49156786ae370c42fee95a428c78f9b48a305fceb82c7074",
                    "index":"0x1"
                }
            }
        ],
        "outputs":[
            {
                "capacity":"0x4a817c800",
                "lock":{
                    "hashType":"type",
                    "codeHash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                    "args":"0x994f969daa5bcc4a4acfbda3394605233b1f079f"
                },
                "type":null
            },
            {
                "capacity":"0xdf8444ac0",
                "lock":{
                    "hashType":"type",
                    "codeHash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                    "args":"0xcb350b1f694b22ea9a31c0847461281779141788"
                },
                "type":null
            }
        ],
        "outputsData":[
            "0x",
            "0x"
        ],
        "witnesses":[
            "0x55000000100000005500000055000000410000005a01989f7ecb68e1c6caa061668950124a1cbd5ea430489750054932deae0c2353079c182a7850925d468bef5bffe45a831f374d07575679215a16134335975500"
        ]
    }
    

    相关文章

      网友评论

          本文标题:CKB Transaction交易数据分析

          本文链接:https://www.haomeiwen.com/subject/ngqrghtx.html