Skip to content

Latest commit

 

History

History
183 lines (135 loc) · 3.25 KB

File metadata and controls

183 lines (135 loc) · 3.25 KB

Getting Started

Interact with SynapticChain and deploy your first contract.


Prerequisites

  • curl or any HTTP client
  • A SynapticChain address (or generate one below)
  • Testnet SYN (request from the faucet)

Generate an Address

SynapticChain uses Ed25519 signatures and bech32 encoding (prefix syn1).

# Using the Rust SDK (advanced)
cargo run --bin generate-test-wallets -- --count 1

# Or use the web wallet
open https://wallet.synapticchain.xyz

A fresh address looks like: syn1abc123... (42 characters total).


Get Testnet Funds

Visit the faucet at testnet.synapticchain.xyz/faucet or use the WhatsApp bot.


Query the Chain

Network status

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "syn_getStatus",
    "params": [],
    "id": 1
  }'

Account balance

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "syn_getBalance",
    "params": ["syn1rjzc59jwqflhme0gqu6mwf48eny8ms4xlx08mc"],
    "id": 1
  }'

Transaction by hash

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "syn_getTransaction",
    "params": ["0xabc123..."],
    "id": 1
  }'

Deploy a Contract

1. Write your contract

Save as hello.syn:

state {
    greeting: str,
    owner: Address,
}

pub fn init() {
    owner = msg.sender;
    greeting = "Hello, World!";
}

pub fn set_greeting(new_greeting: str) {
    require!(msg.sender == owner, "Only owner");
    greeting = new_greeting;
}

pub fn get_greeting() -> str {
    return greeting;
}

2. Compile

synlang compile hello.syn --output hello.plan

3. Deploy via RPC

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "syn_deployContract",
    "params": [
      "syn1YOURADDRESS...",
      "0x`xxd -p hello.plan | tr -d \"\\n\"`",
      100000
    ],
    "id": 1
  }'

4. Interact

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "syn_callContract",
    "params": [
      "syn1CONTRACTADDRESS...",
      "get_greeting",
      []
    ],
    "id": 1
  }'

Use the Forge IDE

For a browser-based experience:

  1. Visit forge.synapticchain.xyz
  2. Write or paste your contract
  3. Click Compile
  4. Connect your wallet
  5. Click Deploy

Run a Local Node (Advanced)

# Clone the node binary (validator partners only)
# Contact: info@synapticchain.xyz

# Initialize data directory
synaptic init --data-dir ~/.synaptic/node1

# Start local devnet (single node)
synaptic start --config config/local-node1.toml

# Check status
curl http://localhost:8545 -d '{"jsonrpc":"2.0","method":"syn_getStatus","params":[],"id":1}'

Next Steps