Supersig Tutorial
Follow a blog post guide about the quick set up of a substrate node template containing supersig, and polkadot-js apps fork here.
In this tutorial you require a node-template with supersig pallet (and rpc functions) added.
Repo: substrate-supersig-template
Create a supersig account
Go to Governance > Supersig > Create/Approve > supersig > createSupersig(members)
Alternatively Go to Developer > Extrinsics > supersig > createSupersig(members)
Notice how if you are the creator of the supersig, you must also add yourself as a member.
Name the Supersig Address (and fund it)
- Give the supersig a name.
- Fund the supersig account from any account that has funds.
If the blockchain you are creating your supersig has the identity pallet (like Kabocha) then you can make a proposal to register your supersig to have an identity so it becomes a known entity.
Make a call from your Supersig
Now that your supersig is funded and has members, you can create a proposal. Thereafter the members of the supersig can vote for it.
You can click the Propose button from the dashboard.
Or you can go to
Governance > Supersig > Create/Approve > submitCall(supersigAccount, call)
If you created a proposal you will also need to vote on it. Votes are not automatically counted by the proposer.
Members vote/sign transactions
Go to Governance > Supersig > Dashboard > Vote
A simpleMajority of members sign a call for the supersig account.
- Notice that Alice created the call, but she also has to approve the call.
- The callId here is
0
which is a call nonce. This is the first ever call from this supersig so we know it is zero. - You can also view the call nonce from the event log or from
> chain_state
. - Remeber to approve a call, you need to be a member with a sufficiently funded balance.
Alice has voted on Call with nonce of
0
. Now we just need one of the 2 other members to make a simpleMajority.
Bob voted and then the simpleMajority threshold was reached and the Call was executed. Ferdie now receives his balance of 500.
Add/remove members
Go to Governance > Supersig > Create/Approve > submitCall > addMembers(newMembers)
Or go to Developer > Extrinsics > supersig > addMembers(newMembers)
A common mistake
Here is a common way to submit a call. In this example we want to add a member, but just because the call is a supersig call it doesn't mean we can skip starting with submitCall
In this example we add Dave as a member, which also requires simpleMajority vote. But wait, it did not work because we need to submitCall then addMember within the call.
The correct way
Now we have wrapped the addMember call correctly within submitCall, and have selected the Supersig we want to interact with.
- Add a member (Dave)
- In this example we add Dave as
master
- This means he will have 50% voting power. And no matter how many members there are, if he votes then only one other person is required to create a
simpleMajority
.
- This means he will have 50% voting power. And no matter how many members there are, if he votes then only one other person is required to create a
This is the second ever call for the Supersig. So the
callId
is now 1
.
Supersig members need to vote in order to accept Dave as a member.
Dont't forget to add the correct callId when voting for the call.
...Alice and Bob vote and Dave is now a member of the Supersig.
Get Information about your Supersig
Find your AccountNonce from your AccountId
Go to Developer > Runtime Calls > accountNonceApi > accountNonce(accountId)
select your AccountId to get your AccountNonce
Your AccountNonce is the number of your Supersig that is used to represent your supersig. Here we find the nonce is 0
.
In our exmaple, there are now 4 members in the Supersig, 3 Standard
members, and 1 Master
member. But if we lose track of this let's check from the chain state.
Go to Developer > chain state > supersig > members(u128, AccountId32): PalletSupersigRole
- Select the id of the supersig. In this case we know theres only one, so it's
0
- For the second parameter
Option<AccountId32>
untick the box so that we can get a list of all theMembers
of the selected supersig. - As we can see from the screenshot there are 4 accounts, each with their Member type (standard or master).