bun start-validator.
createSwigAccount helper.
Example
- Classic
- Kit
1. Import Required SDKs
- Classic
- Kit
2. Generate a Unique Swig ID
- Classic
- Kit
💡 This can really be anything, as long as it’s globally unique. You can even use other public keys, strings, or a boring old number if needed.
3. Derive the Swig PDA
- Classic
- Kit
🧠 This is a standard Solana pattern—Swig just makes it easier.
4. Create the Root Role
Swig is role-based: it combines Authorities (who) and Actions (what) to determine permissions. This section builds the root role.- Classic
- Kit
manageAuthority() or all().
✅You can find all available action types in the Swig SDK docs. New types may be added over time. Swig supports multiple Authority types—this example uses Ed25519 authorities, but others are available for different credentials or verification methods. These handle the Authentication half of Swig’s model. You can find all the types of authorities on the SDK Docs.manageAuthority()is restrictive but safe. 🚨all()gives full control—use carefully in production.
5. Create the Swig Account On-Chain
- Classic
- Kit
6. Simulate a Funded User
- Classic
- Kit
7. Connect to the Validator
- Classic
- Kit
- Classic
- Kit
8. Log Success
- Classic
- Kit

