Skip to content

Commit f7ba3fc

Browse files
committed
Switch to pnpm, improve multisig support, update scripts, etc.
1 parent 3de85c4 commit f7ba3fc

11 files changed

Lines changed: 5431 additions & 1931 deletions

File tree

README.md

Lines changed: 90 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,110 @@ This ensures the new authority has signed before accepting, making accidental tr
1010

1111
Build with `cargo build-sbf` and test with `cargo test-sbf`.
1212

13-
## Scripts
13+
## Tutorial: Transfer Program Authority to a Squads Multisig
1414

15-
TypeScript scripts are provided to interact with the on-chain program. All scripts support:
16-
- File-based keypairs or Ledger hardware wallets
17-
- Squads v3 multisig proposals via `--multisig`
15+
This tutorial walks through transferring a Solana program's upgrade authority from a single keypair to a Squads v3 multisig vault.
1816

19-
Install dependencies with `yarn install`. See `scripts/helpers.ts` for documentation on CLI arguments.
17+
### Prerequisites
2018

21-
### Propose
19+
Install dependencies:
2220

23-
Transfer program authority to the escrow. The current authority proposes the transfer:
21+
```shell
22+
pnpm install
23+
```
24+
25+
You'll need:
26+
- The current program authority keypair (file path or Ledger hardware wallet)
27+
- Your program's address
28+
- Your Squads v3 multisig address
29+
- A multisig member keypair to create and approve the proposal
30+
31+
### Step 1: Propose the Transfer
32+
33+
The current authority proposes transferring the program to the escrow. This moves authority from your keypair to a temporary escrow PDA, where it waits for the new authority to accept.
2434

2535
```shell
26-
yarn propose --keypair <path|ledger> --program <program_address> --authority <new_authority>
36+
pnpm propose \
37+
--keypair /path/to/current-authority.json \
38+
--program <PROGRAM_ADDRESS> \
39+
--authority <MULTISIG_VAULT_ADDRESS>
2740
```
2841

29-
### Accept
42+
The `--authority` should be the multisig vault PDA that will become the new program authority. You can find this address in the Squads UI or derive it using vault index 1 (the default).
3043

31-
Accept a proposed authority transfer. The new authority accepts:
44+
If using a Ledger:
3245

3346
```shell
34-
yarn accept --keypair <path|ledger> --program <program_address> --authority <previous_authority>
47+
pnpm propose \
48+
--keypair ledger \
49+
--derivation-path 0/0 \
50+
--program <PROGRAM_ADDRESS> \
51+
--authority <MULTISIG_VAULT_ADDRESS>
3552
```
3653

37-
### Revert
54+
### Step 2: Accept via Multisig Proposal
55+
56+
The new authority (the multisig vault) must accept the transfer. Since a vault can't sign directly, this creates a Squads proposal that members vote on.
57+
58+
```shell
59+
pnpm accept \
60+
--keypair /path/to/multisig-member.json \
61+
--program <PROGRAM_ADDRESS> \
62+
--authority <PREVIOUS_AUTHORITY_ADDRESS> \
63+
--multisig <MULTISIG_ADDRESS>
64+
```
65+
66+
Here:
67+
- `--keypair` is a multisig member who will create and initially approve the proposal
68+
- `--authority` is the previous authority that proposed the transfer (from Step 1)
69+
- `--multisig` is the Squads multisig address (not the vault)
70+
71+
This command:
72+
1. Creates a new transaction in the multisig
73+
2. Adds the accept instruction
74+
3. Activates the transaction
75+
4. Casts the first approval vote
76+
77+
### Step 3: Complete Multisig Approval
78+
79+
Other multisig members must now approve the proposal in the Squads UI until it reaches the threshold. Once approved and executed, the program authority transfer is complete.
80+
81+
### Reverting a Transfer
82+
83+
If you need to cancel before the new authority accepts, the current authority can revert:
84+
85+
```shell
86+
pnpm revert \
87+
--keypair /path/to/current-authority.json \
88+
--program <PROGRAM_ADDRESS> \
89+
--authority <NEW_AUTHORITY_ADDRESS>
90+
```
91+
92+
If the current authority is already a multisig vault:
93+
94+
```shell
95+
pnpm revert \
96+
--keypair /path/to/multisig-member.json \
97+
--program <PROGRAM_ADDRESS> \
98+
--authority <NEW_AUTHORITY_ADDRESS> \
99+
--multisig <MULTISIG_ADDRESS>
100+
```
101+
102+
### Advanced Options
103+
104+
All scripts support these additional options:
105+
106+
| Option | Description |
107+
|--------|-------------|
108+
| `-u, --url <rpc_url>` | RPC endpoint (default: `https://mainnet.fogo.io`) |
109+
| `-i, --authority-index <n>` | Multisig vault index (default: 1) |
110+
| `-M, --multisig-program <address>` | Custom Squads v3 program address |
111+
| `-d, --derivation-path <path>` | Ledger derivation path as `account/change` |
38112

39-
Revert a proposed transfer before it's accepted. The current authority reverts:
113+
Run any script without arguments to see full usage:
40114

41115
```shell
42-
yarn revert --keypair <path|ledger> --program <program_address> --authority <new_authority>
116+
pnpm propose
117+
pnpm accept
118+
pnpm revert
43119
```

0 commit comments

Comments
 (0)