⚡ Quick Start Guide

Get up and running with Sead SimpleSDK in 5 minutes!

← Back to Docs
🎯 GOAL: Working backup system in your wallet

5-Minute Integration

No NPM, no dependencies, no build process. Just one JavaScript file and you're ready to go!

1

Get Your Package

30 seconds

Contact Sead and receive:

  • 1 file sead-simple-api-bundle.js
  • 1 API key abc123...xyz789.123def...890xyz
  • 1 API URL https://b2bapi.sead.world/api/v1

✅ That's it! No NPM, no dependencies, no build process.

2

Add to Your HTML

30 seconds

Just one line in your HTML:

<!DOCTYPE html>
<html>
<head>
    <title>My Wallet</title>
</head>
<body>
    <!-- Your wallet UI here -->
    
    <!-- Add SimpleSDK (just one line!) -->
    <script src="sead-simple-api-bundle.js"></script>
    
    <!-- Your code -->
    <script src="quickstart.js"></script>
</body>
</html>
3

Copy This Code

2 minutes

Create quickstart.js and paste:

// ===== QUICKSTART: Complete Working Example =====

// 1. Your credentials from Sead
const SEAD_API_KEY = 'your-api-key-here';  // Replace with your key
const SEAD_API_URL = 'https://b2bapi.sead.world/api/v1';

// 2. Initialize SDK (do this once per user)
function initSDK(userId) {
    return new SeadSimpleWithAPI({
        apiUrl: SEAD_API_URL,
        apiKey: SEAD_API_KEY,
        userId: userId  // Required: consistent ID per user
    });
}

// 3. Backup function - IT'S THIS SIMPLE!
async function backupWallet() {
    try {
        const seedPhrase = prompt('Enter your seed phrase:');
        const userId = 'user_' + Date.now(); // Better: use wallet address
        const sead = initSDK(userId);
        
        // Create backup - THAT'S IT!
        const result = await sead.backup({
            seedPhrase: seedPhrase
            // Optional: n: 5, m: 3, password: 'secret'
        });
        
        if (result.success) {
            console.log('✅ Backup successful!');
            result.shares.forEach((share, i) => {
                console.log(`Share ${i + 1}:`, share.text);
                displayQR(share.qrCode, i + 1);
            });
        }
    } catch (error) {
        console.error('Backup failed:', error);
    }
}

// 4. Restore function - EQUALLY SIMPLE!
async function restoreWallet() {
    try {
        const share1 = prompt('Enter share 1:');
        const share2 = prompt('Enter share 2:');
        const sead = initSDK('restore_temp');
        
        // Restore - THAT'S IT!
        const result = await sead.restore({
            shareTexts: [share1, share2]
            // Optional: password: 'secret'
        });
        
        if (result.success) {
            console.log('✅ Restored:', result.seedPhrase);
            alert('Wallet restored: ' + result.seedPhrase);
        }
    } catch (error) {
        console.error('Restore failed:', error);
    }
}

// 5. Helper to display QR codes
function displayQR(qrBase64, shareNumber) {
    const img = document.createElement('img');
    img.src = qrBase64;
    img.style.width = '200px';
    img.style.margin = '10px';
    img.title = `Share ${shareNumber}`;
    document.body.appendChild(img);
}
4

Add Basic UI

1 minute

Add this to your HTML body:

<!-- Quick UI -->
<div style="padding: 20px; font-family: Arial;">
    <h1>Wallet Backup Demo</h1>
    
    <button onclick="backupWallet()" 
            style="padding: 10px 20px; background: #4CAF50; 
                   color: white; border: none; cursor: pointer;">
        🔐 Backup Wallet
    </button>
    
    <button onclick="restoreWallet()" 
            style="padding: 10px 20px; background: #2196F3; 
                   color: white; border: none; cursor: pointer; 
                   margin-left: 10px;">
        ♻️ Restore Wallet
    </button>
    
    <div id="results" style="margin-top: 20px;"></div>
</div>
5

Test It!

1 minute
  1. 1 Open your HTML file in a browser
  2. 2 Click "Backup Wallet"
  3. 3 Enter test seed: test seed phrase for demo
  4. 4 See 3 QR codes appear!
  5. 5 Copy the share texts
  6. 6 Click "Restore Wallet"
  7. 7 Paste 2 shares & get your seed back!

🎉 Congratulations!

You've integrated Sead's wallet backup solution!

📋 Complete Minimal Example

Here's the entire integration in one file:

<!DOCTYPE html>
<html>
<head>
    <title>SimpleSDK QuickStart</title>
</head>
<body>
    <h1>Sead Backup - 5 Minute Demo</h1>
    
    <button onclick="backup()">Backup</button>
    <button onclick="restore()">Restore</button>
    
    <div id="output"></div>
    
    <!-- SimpleSDK -->
    <script src="sead-simple-api-bundle.js"></script>
    
    <script>
        // Your API credentials
        const sdk = new SeadSimpleWithAPI({
            apiUrl: 'https://b2bapi.sead.world/api/v1',
            apiKey: 'your-api-key',
            userId: 'demo-user-001'
        });
        
        // Backup
        async function backup() {
            const result = await sdk.backup({
                seedPhrase: 'your twelve word seed phrase'
            });
            
            if (result.success) {
                document.getElementById('output').innerHTML = 
                    result.shares.map(s => 
                        `<img src="${s.qrCode}" width="150">`
                    ).join('');
            }
        }
        
        // Restore  
        async function restore() {
            const shares = prompt('Enter 2 shares (comma separated):').split(',');
            const result = await sdk.restore({
                shareTexts: shares
            });
            
            if (result.success) {
                alert('Restored: ' + result.seedPhrase);
            }
        }
    </script>
</body>
</html>

🔥 Common Patterns

Production-Ready Backup

async function productionBackup(seedPhrase, userId) {
    const sead = new SeadSimpleWithAPI({
        apiUrl: 'https://b2bapi.sead.world/api/v1',
        apiKey: process.env.SEAD_API_KEY,
        userId: userId
    });
    
    return await sead.backup({
        seedPhrase: seedPhrase,
        n: 3,  // 3 shares
        m: 2,  // Need 2 to restore
        password: getUserPassword(),
        onPaymentRequired: async (amt, cur) => {
            const tx = await paymentProvider.send(amt, cur);
            return { transactionId: tx.id, proof: tx.proof };
        }
    });
}

Restore with Error Handling

async function safeRestore(shares, password) {
    try {
        const sead = new SeadSimpleWithAPI({
            apiUrl: 'https://b2bapi.sead.world/api/v1',
            apiKey: process.env.SEAD_API_KEY,
            userId: 'restore-session'
        });
        
        const result = await sead.restore({
            shareTexts: shares,
            password: password
        });
        
        if (!result.success) {
            if (result.error.includes('password')) {
                throw new Error('Wrong password');
            }
            throw new Error('Invalid shares');
        }
        
        return result.seedPhrase;
    } catch (error) {
        console.error('Restore failed:', error);
        throw error;
    }
}

React Component

function BackupButton({ seedPhrase, userId }) {
    const [loading, setLoading] = useState(false);
    const [shares, setShares] = useState([]);
    
    const handleBackup = async () => {
        setLoading(true);
        
        const sead = new SeadSimpleWithAPI({
            apiUrl: 'https://b2bapi.sead.world/api/v1',
            apiKey: 'your-api-key',
            userId: userId
        });
        
        const result = await sead.backup({ seedPhrase });
        
        if (result.success) {
            setShares(result.shares);
        }
        
        setLoading(false);
    };
    
    return (
        <>
            <button onClick={handleBackup} disabled={loading}>
                {loading ? 'Creating backup...' : 'Backup Wallet'}
            </button>
            
            {shares.map((share, i) => (
                <img key={i} src={share.qrCode} alt={`Share ${i + 1}`} />
            ))}
        </>
    );
}

Vue Component

// Vue 3 Composition API
const { ref } = Vue;

export default {
    setup() {
        const loading = ref(false);
        const shares = ref([]);
        
        const backup = async () => {
            loading.value = true;
            
            const sead = new SeadSimpleWithAPI({
                apiUrl: 'https://b2bapi.sead.world/api/v1',
                apiKey: 'your-api-key',
                userId: store.userId
            });
            
            const result = await sead.backup({
                seedPhrase: store.seedPhrase
            });
            
            if (result.success) {
                shares.value = result.shares;
            }
            
            loading.value = false;
        };
        
        return { loading, shares, backup };
    }
}

🛠️ Configuration Options

Minimal (Defaults)

sead.backup({
    seedPhrase: 'your seed phrase'
});
// Creates 3 shares, needs 2 to restore

Custom Threshold

sead.backup({
    seedPhrase: 'your seed phrase',
    n: 5,  // Create 5 shares
    m: 3   // Need 3 to restore
});

With Encryption

sead.backup({
    seedPhrase: 'your seed phrase',
    password: 'secret123'
});

❓ Quick FAQ

What if I lose my API key?

Contact Sead support for a new one.

How many free backups do I get?

25,000 per wallet + 3 per user.

Is the seed phrase sent to servers?

NO! All crypto happens locally.

What browsers are supported?

Chrome 90+, Firefox 88+, Safari 14+, Edge 90+

🚨 Quick Troubleshooting

Problem Solution
"API key invalid" Check format: hex.hex
"User ID required" Always provide consistent userId
"Quota exhausted" Implement payment handler
"Network error" Check CORS and HTTPS
"Invalid shares" Ensure shares from same backup

📚 Next Steps

You're done with the quickstart! 🎉