@x1scroll/permastake-sdk
v0.2.0
Published
SDK for PermaStake — permanent document storage with staking yield on X1
Downloads
323
Maintainers
Readme
@x1scroll/permastake-sdk
Permanent document storage with staking yield on X1.
Stamp your data on-chain. Your rent earns staking rewards while it lives. Claim rewards anytime — data stays alive. Nuclear exit when you're done — rent comes back.
Program: 3C112FmQdrctJ3STAEuzohawJQikofDfuFHLQCMES3wy
Network: X1 MainnetInstall
npm install @x1scroll/permastake-sdkHow It Works
Stamp document:
Your data → gzip compress → AES-256-GCM encrypt
→ PermaData (permanent bytes on X1)
→ PermaStake (rent staked to validator, earns yield)
Claim yield (anytime):
stake_balance - original_rent = rewards
70% → you | 20% → protocol | 10% burned
Data alive. Stake continues.
Nuclear exit (your choice):
Deactivate → wait one epoch → withdraw everything
Get back: original rent + all unclaimed rewards
Data gone. That's the only delete.Quick Start
import { PermaStake } from '@x1scroll/permastake-sdk';
import { Keypair } from '@solana/web3.js';
const wallet = Keypair.fromSecretKey(yourSecretKey);
const sdk = new PermaStake({ wallet, network: 'x1-mainnet' });
// Stamp a document (compress + encrypt + store + stake in one tx)
const result = await sdk.stamp({
data: Buffer.from('your document content here'),
});
console.log('Store PDA: ', result.storePda);
console.log('Stake PDA: ', result.stakePda);
console.log('Rent staked:', result.originalRent, 'XNT');
console.log('TX: ', result.tx);Claim Yield
// Check available yield
const status = await sdk.getYieldStatus(result.storeId);
console.log('Available yield:', status.availableYield, 'XNT');
console.log('Your share: ', status.userShare, 'XNT (70%)');
// Claim it (data untouched, stake keeps earning)
const sig = await sdk.claimYield(result.storeId);Nuclear Exit
// Step 1 — deactivate stake
await sdk.deactivate(result.storeId);
// Wait one epoch (~2-3 hours on X1)...
// Step 2 — close store, get everything back
await sdk.closeStore(result.storeId);
// Rent + all unclaimed rewards returned to your wallet.
// Data permanently erased.Validator Choice
import { PublicKey } from '@solana/web3.js';
// Default: x1scroll validator (we earn commission)
await sdk.stamp({ data: myDoc });
// Custom validator: you choose
await sdk.stamp({
data: myDoc,
validatorOverride: new PublicKey('YourValidatorVoteAccount...'),
});
// Either way: 70/20/10 yield split applies on claimFee Schedule
| Action | Fee | Notes | |--------|-----|-------| | Stamp | 0.06 XNT | + rent (rent goes to stake, not lost) | | Update | 0.01 XNT | Stake untouched | | Claim yield | Free | 70% yours, 20% treasury, 10% burned | | Close | Free | Rent returned |
API
new PermaStake(options)
const sdk = new PermaStake({
wallet: Keypair, // required
network: 'x1-mainnet', // or full RPC URL
});stamp(opts) → StampResult
Compress + encrypt + store + stake in one transaction.
const result = await sdk.stamp({
data: Buffer | string, // your content
storeId?: bigint, // defaults to Date.now()
encrypt?: boolean, // default true
validatorOverride?: PublicKey, // default x1scroll
});
// result.storeId, storePda, stakePda, contentHash, originalRent, txgetYieldStatus(storeId) → YieldStatus
Check available yield without claiming.
claimYield(storeId) → string (tx sig)
Harvest rewards. Data alive. Stake continues.
deactivate(storeId) → string
Step 1 of nuclear exit. Sets stake to deactivating.
closeStore(storeId) → string
Step 2. Close everything. Rent + rewards returned.
getStoreRecord(storeId) → StoreRecord | null
Fetch on-chain store metadata.
Links
- Program: 3C112FmQ...
- x1scroll.io: https://x1scroll.io
- GitHub: https://github.com/x1scroll-io/permastake-sdk
