๐ Recover bitpacs
Each Bitpac is publicly auditable through Nostr, in which all the public keys of the Bitpac are viewable.
Nostr Events
2857
Bitpac member listing
2858
Bitpac creation event
2859
Bitpac proposal
Bitpac Creation
Bitpacs are represented as specific kinds of Nostr events. A Bitpac includes several attributes, which are passed down as an array in the content of the Nostr event.
name
The name of the Bitpac
String
[threshold, [pubkeys]]
The first element of the array is the threshold for the multisig, the second element is the list of pubkeys (base64)
Array<number, Array>
Additional tags are included in the Nostr event to facilitate future Bitpac filtering using only Nostr.
t
The name of the Bitpac
String
Here is a sample event:
const eventPayload = {
content: JSON.stringify([
name,
[threshold, [ ...pubkeys, bitpacPub]],
]),
created_at: Math.floor(Date.now() / 1000),
kind: 2858,
tags: [
['x', bitpacPub],
['t', name],
]
}
To publish the Nostr event, a random private/public key pair is generated, the events are not signed by the creator of the Bitpac, as XVerse does not yet support schnorr signatures, which are required in order to publish an event on nostr.
Fetching the Bitpac from Nostr
Every Bitpac that's created in Tribe, is also published to Nostr in the following relays
['wss://relay.damus.io', 'wss://nos.lol', 'wss://booger.pro']
This allows anyone to audit who the members of a bitpac are on Tribe, and allows the ability for members to recover their Bitpacs.
We created a small recovery tool that enables members to connect their Xverse wallet, just like they would on Tribe. Members can fetch the list of Bitpacs they belong to from Nostr, view how to do this here.
First, we have an event that relates bitpacs with pubkeys, due to the nature of Nostr filters, it is not possible to filter Nostr events by a specific pubkey. To circumvent this, we have created a new type of Nostr event that enables this filtering.
pubkey
The pubkey associated with the Bitpac
String
This is how our server pushes the event:
{
content: pub,
created_at: Math.floor(Date.now() / 1000),
kind: 2857,
tags: [
['d', event.id],
['z', pub]
]
}
Additional tags are included in the Nostr event to facilitate future Bitpac filtering using only Nostr.
In tribe core you can view how we filter and fetch the members Bitpacs using Nostr.
d
The ID of the Bitpac
String
z
The associated pubkey
XVerse ~ Nostr
If you wish to filter your Bitpacs or anyone else's Bitpacs by pubkey, you can use the following filter:
const filter = [
{
kinds: [2857],
'#z': [pubkey],
},
];
Now that you have the Bitpac information, you can reconstruct the same wallet on your local machine like this, please remember that you should get the internal pubkey based off of XVerse
Once you are able to reconstruct your wallet, you can then create a transaction (PSBT) and have everyone within the threshold sign to publish the transaction to the network.
Here we published an example of how to create the transaction and generate the PSBT.
Last updated