# Tutorial 1: Getting Started with Synor Welcome to Synor, the first post-quantum secure blockchain! This tutorial will help you set up your development environment and make your first transactions. ## What You'll Learn - Set up a local Synor node - Create a wallet and address - Send and receive SYNOR tokens - Query the blockchain ## Prerequisites - Docker and Docker Compose - Node.js 18+ or Rust 1.70+ - Basic command line knowledge --- ## Part 1: Running a Local Node The easiest way to start is with Docker. ### Step 1: Clone the Repository ```bash git clone https://github.com/synor/synor.git cd synor ``` ### Step 2: Start the Local Testnet ```bash docker compose -f docker-compose.testnet.yml up -d seed1 ``` This starts a single node for development. Wait about 30 seconds for it to initialize. ### Step 3: Verify the Node is Running ```bash curl -X POST http://localhost:17110 \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"synor_getBlockCount","params":[],"id":1}' ``` You should see: ```json {"jsonrpc":"2.0","result":1,"id":1} ``` --- ## Part 2: Creating Your First Wallet ### Option A: Using the CLI ```bash # Install the Synor CLI cargo install synor-cli # Generate a new wallet synor-cli wallet new # Output: # Mnemonic: abandon abandon abandon ... (24 words) # Address: tsynor1qz232pysw8kezv2f4qxnhdufrlx5cmq78522mpuf8x5qlxu6j8sgcp05get # # IMPORTANT: Save your mnemonic phrase securely! ``` ### Option B: Using JavaScript Create a new project: ```bash mkdir my-synor-app cd my-synor-app npm init -y npm install @synor/sdk ``` Create `wallet.js`: ```javascript import { generateMnemonic, createWallet } from '@synor/sdk'; async function main() { // Generate a 24-word mnemonic const mnemonic = generateMnemonic(24); console.log('Mnemonic:', mnemonic); // Create wallet from mnemonic const wallet = await createWallet(mnemonic, '', 'testnet'); console.log('Address:', wallet.address); // IMPORTANT: In production, encrypt and securely store the mnemonic! } main().catch(console.error); ``` Run it: ```bash node wallet.js ``` --- ## Part 3: Getting Test Tokens ### From the Faucet If you're on testnet, request tokens from the faucet: ```bash curl -X POST http://localhost:8080/request \ -H "Content-Type: application/json" \ -d '{"address": "tsynor1your_address_here"}' ``` ### Check Your Balance ```bash curl -X POST http://localhost:17110 \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0", "method":"synor_getBalance", "params":["tsynor1your_address"], "id":1 }' ``` Response: ```json { "jsonrpc": "2.0", "result": { "confirmed": "10.00000000", "pending": "0.00000000" }, "id": 1 } ``` --- ## Part 4: Sending Your First Transaction ### Using the CLI ```bash synor-cli send \ --to tsynor1recipient_address \ --amount 1.5 \ --password yourpassword ``` ### Using JavaScript ```javascript import { createSendTransactionHybrid, serializeTransaction } from '@synor/sdk'; async function sendTransaction(wallet, toAddress, amount) { // Build and sign the transaction const tx = await createSendTransactionHybrid( wallet.address, toAddress, amount, wallet ); console.log('Transaction ID:', tx.id); // Broadcast to the network const response = await fetch('http://localhost:17110', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', method: 'synor_sendRawTransaction', params: [serializeTransaction(tx)], id: 1 }) }); const result = await response.json(); console.log('Broadcast result:', result); return tx.id; } ``` --- ## Part 5: Understanding Hybrid Signatures Synor is unique because it uses **hybrid signatures**: ``` ┌────────────────────────────────────────────────┐ │ Transaction │ ├────────────────────────────────────────────────┤ │ Signed with: │ │ ┌─────────────┐ ┌──────────────────┐ │ │ │ Ed25519 │ + │ Dilithium3 │ │ │ │ (64 bytes) │ │ (~3.3 KB) │ │ │ └─────────────┘ └──────────────────┘ │ │ │ │ Both signatures must verify! │ └────────────────────────────────────────────────┘ ``` **Why hybrid?** - **Ed25519**: Fast, well-tested, secure against classical computers - **Dilithium3**: Secure against future quantum computers (NIST PQC standard) This means your funds are protected even if quantum computers become powerful enough to break Ed25519. --- ## Part 6: Next Steps Congratulations! You've: - ✅ Set up a local Synor node - ✅ Created a wallet - ✅ Received test tokens - ✅ Sent a transaction ### Continue Learning - [Tutorial 2: Building a Wallet Application](./02-building-a-wallet.md) - [Tutorial 3: Smart Contracts on Synor](./03-smart-contracts.md) - [Tutorial 4: Working with the API](./04-api-guide.md) ### Resources - [API Reference](../API_REFERENCE.md) - [Developer Guide](../DEVELOPER_GUIDE.md) - [Exchange Integration](../EXCHANGE_INTEGRATION.md) --- ## Troubleshooting ### Node not responding ```bash # Check if container is running docker ps | grep synor # Check logs docker logs synor-seed1 ``` ### Transaction stuck - Ensure you have enough balance for the fee - Check that UTXOs are confirmed - Try with a higher fee ### Invalid address error - Testnet addresses start with `tsynor1` - Mainnet addresses start with `synor1` - Addresses are case-sensitive (use lowercase) --- *Next: [Building a Wallet Application](./02-building-a-wallet.md)*