Skip to content

Commit

Permalink
update README about action data schema
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian committed Feb 27, 2024
1 parent c873fae commit ffa3f10
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,35 @@

## Disclaimer

TODO
This is a Proof-of-Concept demo to show how to use the building packet lock actions in [CoBuild](https://talk.nervos.org/t/ckb-transaction-cobuild-protocol-overview/7702) to collect multisig signatures.

## Background

TODO
This PoC utilizes the CoBuild building packet as an intermediate format for enabling collaboration among various tools in the collection of multisig signatures. Currently, it supports ckb-cli and Neuron.

CoBuild enables lock scripts to include their pending actions in the `lock_actions` field of the building packet.

This PoC defines `MultisigAction` to store the mulgisig config and collected signatures.

```
array PubkeyHash [byte; 20];
vector PubkeyHashVec <PubkeyHash>;
table MultisigConfig {
require_first_n: byte,
threshold: byte,
signer_pubkey_hashes: PubkeyHashVec,
}
array Signature [byte; 65];
struct PubkeyHashSignaturePair {
pubkey_hash: PubkeyHash,
signature: Signature,
}
vector PubkeyHashSignaturePairVec <PubkeyHashSignaturePair>;
table MultisigAction {
config: MultisigConfig,
signed: PubkeyHashSignaturePairVec,
}
```

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion src/lib/__snapshots__/multisig-lock-action.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Object {
}
`;

exports[`buildScriptInfo 2`] = `
exports[`buildScriptInfo 1`] = `
Object {
"message_type": "MultisigAction",
"name": "secp256k1_blake160_multisig_all",
Expand Down
10 changes: 6 additions & 4 deletions src/lib/multisig-lock-action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { decodeHex } from "@ckb-cobuild/hex-encoding";
test("buildScriptInfo", () => {
const { schema, ...remaining } = buildScriptInfo();

expect(schema).toMatchInlineSnapshot(`
"array PubkeyHash [byte; 20];
expect(schema).toMatch(
`
array PubkeyHash [byte; 20];
vector PubkeyHashVec <PubkeyHash>;
table MultisigConfig {
require_first_n: byte,
Expand All @@ -22,8 +23,9 @@ vector PubkeyHashSignaturePairVec <PubkeyHashSignaturePair>;
table MultisigAction {
config: MultisigConfig,
signed: PubkeyHashSignaturePairVec,
}"
`);
}
`.trim(),
);
expect(toJson(remaining)).toMatchSnapshot();
});

Expand Down

0 comments on commit ffa3f10

Please sign in to comment.