Skip to content

feat: multisig support with partial signing for P-Chain operations#21

Open
owenwahlgren wants to merge 3 commits intomainfrom
feature/multisig-partial-signing
Open

feat: multisig support with partial signing for P-Chain operations#21
owenwahlgren wants to merge 3 commits intomainfrom
feature/multisig-partial-signing

Conversation

@owenwahlgren
Copy link
Collaborator

Summary

  • Adds multisig ownership support for P-Chain operations (subnets, validators, delegators)
  • Adds partial signing workflow: build tx → sign with key 1 → sign with key 2 → submit
  • New pkg/multisig package with JSON-based tx file format for exchanging partially-signed transactions between signers
  • New platform tx sign|commit|inspect CLI commands for the signing workflow
  • --owners, --threshold, --output-tx flags on subnet commands
  • --reward-addresses, --reward-threshold flags on validator/delegator commands

Workflow Example

# 1. Create a 2-of-3 multisig subnet
platform subnet create \
  --owners P-fuji1abc,P-fuji1def,P-fuji1ghi \
  --threshold 2 \
  --output-tx unsigned.json \
  --key-name builder

# 2. First signer signs
platform tx sign --tx-file unsigned.json --key-name signer1

# 3. Second signer signs
platform tx sign --tx-file unsigned.json --key-name signer2

# 4. Submit (any key can submit, tx is already signed)
platform tx commit --tx-file unsigned.json --network fuji

# Inspect at any point
platform tx inspect --tx-file unsigned.json

Architecture

  • pkg/multisig/ — tx file format, partial signing helpers, OutputOwners builder
  • cmd/tx.go — sign, commit, inspect subcommands
  • pkg/pchain/ — config structs now accept optional RewardOwner *secp256k1fx.OutputOwners (backward compatible)
  • Leverages avalanchego's native partial signing support (signer leaves empty sigs for missing keys)

Test plan

  • go vet ./... passes
  • staticcheck ./... passes
  • All existing unit tests pass
  • New pkg/multisig tests pass (OutputOwners creation, TxFile round-trip, signature status, address parsing)
  • E2E test: create multisig subnet on local network
  • E2E test: partial sign → sign → commit flow

Add support for multi-address ownership and threshold-based signing on
P-Chain transactions, enabling multisig workflows where transactions can
be built, partially signed by different key holders, and then submitted.

New package pkg/multisig/:
- TxFile JSON format for exchanging partially-signed transactions
- ReadTxFile/WriteTxFile for file I/O
- NewOutputOwners for creating multisig owners with threshold
- IsFullySigned/CredentialSignatureStatus for tracking signature progress
- ParseAddresses for parsing comma-separated P-Chain addresses

New CLI commands (platform tx):
- tx sign: add signatures to a tx file using available keys
- tx commit: submit a fully-signed tx file to the network
- tx inspect: display tx file details and signature status

Updated commands with multisig flags:
- subnet create: --owners, --threshold, --output-tx
- subnet transfer-ownership: --owners, --threshold, --output-tx
- validator add: --reward-addresses, --reward-threshold
- validator delegate: --reward-addresses, --reward-threshold

Updated pkg/pchain config structs with optional RewardOwner field
that overrides single RewardAddr when set (backward compatible).
…flow

Three new E2E tests (require network, gated behind networke2e build tag):
- TestCreateSubnetWithMultisigOwner: creates subnet with 1-of-1 multisig owner
- TestMultisigPartialSignFlow: build unsigned tx → file → read → verify → submit
- TestMultisigTransferSubnetOwnership: create subnet then transfer to multisig
GetSubnetOwners doesn't exist on this SDK version. Use GetSubnet
which returns threshold and controlKeys.

All 3 multisig E2E tests verified passing on Fuji testnet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant