Skip to content

Commit 31ef8bb

Browse files
authored
It is recommended to use ckb-cli to dump transactions (#148)
1 parent 0f4d195 commit 31ef8bb

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

ckb-debugger/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For Rust library usage, refer to the included tests, they are quite self-explana
99
See the command line help part for usage on the binary debugger:
1010

1111
```text
12-
ckb-debugger 0.116.1
12+
ckb-debugger 0.119.0
1313
1414
USAGE:
1515
ckb-debugger [FLAGS] [OPTIONS] --mode <mode> [args]...
@@ -30,7 +30,7 @@ OPTIONS:
3030
--gdb-listen <gdb-listen>
3131
Address to listen for GDB remote debugging server [default: 127.0.0.1:9999]
3232
33-
--max-cycles <max-cycles> Max cycles [default: 70000000]
33+
--max-cycles <max-cycles> Max cycles [default: 3500000000]
3434
--mode <mode>
3535
Execution mode of debugger [default: full] [possible values: decode-instruction, fast, full, gdb, probe]
3636
@@ -48,7 +48,7 @@ ARGS:
4848
<args>...
4949
```
5050

51-
[ckb-transaction-dumper](https://github.com/xxuejie/ckb-transaction-dumper) can be used to dump the full mocked transaction used in the debugger from CKB.
51+
[ckb-cli](https://github.com/nervosnetwork/ckb-cli) can be used to dump the full mocked transaction used in the debugger from CKB. This [example](./examples/mock_tx.md) shows how to use it.
5252

5353
# FAQ
5454

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": "0x0",
3+
"cell_deps": [
4+
{
5+
"out_point": {
6+
"tx_hash": "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",
7+
"index": "0x0"
8+
},
9+
"dep_type": "dep_group"
10+
},
11+
{
12+
"out_point": {
13+
"tx_hash": "0x584ddf4379ae4fc87a435162c77faf9bbd55e5704f7ffbdcfa5052ed81f6770f",
14+
"index": "0x1"
15+
},
16+
"dep_type": "code"
17+
}
18+
],
19+
"header_deps": [],
20+
"inputs": [
21+
{
22+
"since": "0x0",
23+
"previous_output": {
24+
"tx_hash": "0x129c00d14dfc2180df01382d9313692642c731bcdab75ff9b43cfb2291fd9555",
25+
"index": "0x0"
26+
}
27+
},
28+
{
29+
"since": "0x0",
30+
"previous_output": {
31+
"tx_hash": "0x7a3ee6010411ab3f314e094abf0be15d6add8f0b56d80c4431fc9b465f329e5b",
32+
"index": "0x1"
33+
}
34+
}
35+
],
36+
"outputs": [
37+
{
38+
"capacity": "0x35a4e9000",
39+
"lock": {
40+
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
41+
"hash_type": "type",
42+
"args": "0x3c2c45d0def478183ce14337d21bf55fa2308e03"
43+
},
44+
"type": {
45+
"code_hash": "0x8b9cf1c536c2590282c2896ca34778590a3784b7daeafa241fe98e170a743ee0",
46+
"hash_type": "data",
47+
"args": "0x937602c81c5e6628e1ff615a91727daa2f6dbded304a5629b78e36e137ec3ee9"
48+
}
49+
},
50+
{
51+
"capacity": "0x48a1ef9d10",
52+
"lock": {
53+
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
54+
"hash_type": "type",
55+
"args": "0x3c2c45d0def478183ce14337d21bf55fa2308e03"
56+
},
57+
"type": null
58+
}
59+
],
60+
"outputs_data": [
61+
"0x17000000984ced3318cf80c981010000",
62+
"0x"
63+
],
64+
"witnesses": [
65+
"0x55000000100000005500000055000000410000001e657939f58f9ed8fc677f50a7c13538dafd1d60a88860bbe7dfe7dc3e92bfc557f393b0c2980491b63b2cac1367ef5a93379756e3dc6964cd015413288fb46a01",
66+
"0x"
67+
]
68+
}

ckb-debugger/examples/mock_tx.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,13 @@ Run result: 1
3232
Total cycles consumed: 1706(1.7K)
3333
Transfer cycles: 764, running cycles: 942
3434
```
35+
36+
In addition to debugging transactions that have been committed to the chain, you can also debug transactions that are not committed to the chain (including unsent transactions and transactions that failed to be committed to the chain).
37+
38+
To do this, we first need to prepare a transaction in json format, the file content is the same as the payload of json rpc [send_transaction](https://github.com/nervosnetwork/ckb/tree/develop/rpc#method-send_transaction).
39+
40+
```sh
41+
$ ckb-cli --url https://mainnet.ckbapp.dev/rpc mock-tx dump --tx-file mock_raw_tx.json --output-file mock_tx.json
42+
```
43+
44+
In the above command, we use `--tx-file mock_raw_tx.json` to specify a transaction, which is equivalent to `--tx-hash 0x5f0a4162622daa0e50b2cf8f49bc6ece22d1458d96fc12a094d6f074d6adbb55`.

0 commit comments

Comments
 (0)