前提條件-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是合約部署時(shí)的交易Hash拇舀;不同的環(huán)境不同逻族。
codeHash = “0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
hashType:ScriptHashType = “type”,
deps:CellDep[] = [{
outPoint: {
txHash: “0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708”,
index: “0x0”,
},
depType: “depGroup”,
}]
操作
從Address1 轉(zhuǎn)移200代幣到Address2。
解釋
001-cellDeps:
默認(rèn)加密算法secp256k1對(duì)應(yīng)的Deps你稚。
"cellDeps”:[
{
"depType":”depGroup”,
"outPoint”:{
"txHash":”0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708”,
"index":”0x0”
}
}
]
002-inputs
上一個(gè)交易的輸出瓷耙。(上一個(gè)交易的輸出可以是多個(gè))
"inputs”:[
{
"since":”0x0”,
"previousOutput”:{
"txHash":”0x00aac36b14e0b2c374b4b6de97f797d20657bcfec1bdfaa15e36ef5b53ca0d79”,
"index":”0x0”
}
}
]
003-Outputs
001-
"hashType":”type”,
"codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8” 為secp256k1中對(duì)應(yīng)的hashType和codeHash。
002-
"args":”0x994f969daa5bcc4a4acfbda3394605233b1f079f” :Address2的Public Key Hash
"capacity":”0x4a817c800”: 根據(jù)Args可以判斷出為轉(zhuǎn)移代幣數(shù)量刁赖,并且知道代幣屬于誰搁痛。
"args":”0xcb350b1f694b22ea9a31c0847461281779141788":Address1的Public Key Hash
"capacity":” 0xdf8444ac0":根據(jù)Args可以判斷為找零的代幣數(shù)量。
outputs中的記錄數(shù)對(duì)應(yīng)交易輸出的數(shù)量宇弛。
"outputs”:[
{
"capacity":”0x4a817c800”,
"lock”:{
"hashType":”type”,
"codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
"args":”0x994f969daa5bcc4a4acfbda3394605233b1f079f”
},
"type”:null
},
{
"capacity":” 0xdf8444ac0”,
"lock”:{
"hashType":”type”,
"codeHash":”0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8”,
"args":”0xcb350b1f694b22ea9a31c0847461281779141788”
},
"type”:null
}
]
交易截圖
交易詳細(xì)
{
"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"
]
}