Create comprehensive step-by-step tutorials: - Tutorial 1: Getting Started - node setup, wallet creation, transactions - Tutorial 2: Building a Wallet - React app with state management, encryption - Tutorial 3: Smart Contracts - Rust WASM contracts, token example, testing - Tutorial 4: API Guide - JSON-RPC, WebSocket subscriptions, client building Each tutorial includes working code examples and best practices.
6 KiB
6 KiB
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
git clone https://github.com/synor/synor.git
cd synor
Step 2: Start the Local Testnet
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
curl -X POST http://localhost:17110 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"synor_getBlockCount","params":[],"id":1}'
You should see:
{"jsonrpc":"2.0","result":1,"id":1}
Part 2: Creating Your First Wallet
Option A: Using the CLI
# 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:
mkdir my-synor-app
cd my-synor-app
npm init -y
npm install @synor/sdk
Create wallet.js:
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:
node wallet.js
Part 3: Getting Test Tokens
From the Faucet
If you're on testnet, request tokens from the faucet:
curl -X POST http://localhost:8080/request \
-H "Content-Type: application/json" \
-d '{"address": "tsynor1your_address_here"}'
Check Your Balance
curl -X POST http://localhost:17110 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"synor_getBalance",
"params":["tsynor1your_address"],
"id":1
}'
Response:
{
"jsonrpc": "2.0",
"result": {
"confirmed": "10.00000000",
"pending": "0.00000000"
},
"id": 1
}
Part 4: Sending Your First Transaction
Using the CLI
synor-cli send \
--to tsynor1recipient_address \
--amount 1.5 \
--password yourpassword
Using 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
- Tutorial 3: Smart Contracts on Synor
- Tutorial 4: Working with the API
Resources
Troubleshooting
Node not responding
# 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)