diff --git a/README.md b/README.md index 5c582cd..93a71b1 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,33 @@ Everytime you run a transaction, you can debug it with the transaction hash: offckb debug ``` +It will verify all the scripts in the transaction and print the detailed info in the terminal. + +```sh +offckb debug --tx-hash 0x64c936ee78107450d49e57b7453dce9031ce68b056b2f1cdad5c2218ab7232ad +Dump transaction successfully + +****************************** +****** Input[0].Lock ****** + +hello, this is new add! +Hashed 1148 bytes in sighash_all +sighash_all = 5d9b2340738ee28729fc74eba35e6ef969878354fe556bd89d5b6f62642f6e50 +event = {"pubkey":"45c41f21e1cf715fa6d9ca20b8e002a574db7bb49e96ee89834c66dac5446b7a","tags":[["ckb_sighash_all","5d9b2340738ee28729fc74eba35e6ef969878354fe556bd89d5b6f62642f6e50"]],"created_at":1725339769,"kind":23334,"content":"Signing a CKB transaction\n\nIMPORTANT: Please verify the integrity and authenticity of connected Nostr client before signing this message\n","id":"90af298075ac878901282e23ce35b24e584b7727bc545e149fc259875a23a7aa","sig":"b505e7d5b643d2e6b1f0e5581221bbfe3c37f17534715e51eecf5ff97a2e1b828a3d767eb712555c78a8736e9085b4960458014fa171d5d169a1b267b186d2f3"} +verify_signature costs 3654 k cycles +Run result: 0 +Total cycles consumed: 4013717(3.8M) +Transfer cycles: 44947(43.9K), running cycles: 3968770(3.8M) + +****************************** +****** Output[0].Type ****** + +verify_signature costs 3654 k cycles +Run result: 0 +Total cycles consumed: 3916670(3.7M) +Transfer cycles: 43162(42.2K), running cycles: 3873508(3.7M) +``` + If you want to debug a single cell script in the transaction, you can use the following command: ```sh diff --git a/example-mol/attributes.mol b/example-mol/attributes.mol deleted file mode 100644 index c20d088..0000000 --- a/example-mol/attributes.mol +++ /dev/null @@ -1,13 +0,0 @@ -import basic_types; - -// Each role has 8 attributes. The size is fixed. -struct Attributes { - strength: AttrValue, - dexterity: AttrValue, - endurance: AttrValue, - speed: AttrValue, - intelligence: AttrValue, - wisdom: AttrValue, - perception: AttrValue, - concentration: AttrValue, -} diff --git a/example-mol/basic_types.mol b/example-mol/basic_types.mol deleted file mode 100644 index 188b4f2..0000000 --- a/example-mol/basic_types.mol +++ /dev/null @@ -1,25 +0,0 @@ -// AttrValue is an alias of `byte`. -// -// Since Molecule data are strongly-typed, it can gives compile time guarantees -// that the right type of value is supplied to a method. -// -// In this example, we use this alias to define an unsigned integer which -// has an upper limit: 100. -// So it's easy to distinguish between this type and a real `byte`. -// Of course, the serialization wouldn't do any checks for this upper limit -// automatically. You have to implement it by yourself. -// -// **NOTE**: -// - This feature is dependent on the exact implementation. -// In official Rust generated code, we use new type to implement this feature. -array AttrValue [byte; 1]; - -// SkillLevel is an alias of `byte`, too. -// -// Each skill has only 10 levels, so we use another alias of `byte` to distinguish. -array SkillLevel [byte; 1]; - -// Define several unsigned integers. -array Uint8 [byte; 1]; -array Uint16 [byte; 2]; -array Uint32 [byte; 4]; diff --git a/example-mol/role.mol b/example-mol/role.mol deleted file mode 100644 index 663865b..0000000 --- a/example-mol/role.mol +++ /dev/null @@ -1,22 +0,0 @@ -import attributes; -import skills; -import basic_types; - -// We have only 3 classes: Fighter, Ranger and Mage. A `byte` is enough. -array Class [byte; 1]; - -table Hero { - class: Class, - level: Uint8, - experiences: Uint32, - hp: Uint16, - mp: Uint16, - base_damage: Uint16, - attrs: Attributes, - skills: Skills, -} - -table Monster { - hp: Uint16, - damage: Uint16, -} diff --git a/example-mol/skills.mol b/example-mol/skills.mol deleted file mode 100644 index bcb3e2b..0000000 --- a/example-mol/skills.mol +++ /dev/null @@ -1,33 +0,0 @@ -import basic_types; - -// We define several skills. -// None means the role can learn a skill but he/she doesn't learn it. -option ArmorLight (SkillLevel); -option ArmorHeavy (SkillLevel); // only Fighter can learn this -option ArmorShields (SkillLevel); // only Fighter can learn this -option WeaponSwords (SkillLevel); // only Mage can't learn this -option WeaponBows (SkillLevel); // only Ranger can learn this -option WeaponBlunt (SkillLevel); -option Dodge (SkillLevel); -option PickLocks (SkillLevel); -option Mercantile (SkillLevel); -option Survival (SkillLevel); -// ... omit other skills ... - -// Any skill which is defined above. -union Skill { - ArmorLight, - ArmorHeavy, - ArmorShields, - WeaponSwords, - WeaponBows, - WeaponBlunt, - Dodge, - PickLocks, - Mercantile, - Survival, - // ... omit other skills ... -} - -// A hero can learn several skills. The size of learned skills is dynamic. -vector Skills ;