Skip to content

inc4/gonka-inference-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gonka Inference Examples

Tools for sending inference requests to the Gonka network.

Quick Start

Already have a privkey and a gonka1... address? Pick your interface:

inference-web inference-raw inference-openai
Interface Browser UI Python CLI Python CLI
Dependencies Node.js (proxy only) requests, ecdsa gonka-openai
Signing in-browser (no server) manual, visible automatic in SDK
Use case interactive chat debugging, exploration app integration

One-Time Setup

This section is only needed if you don't have a Gonka wallet and private key yet.

Step 1: Download inferenced

inferenced is the Gonka chain node binary, required for wallet creation and on-chain transactions.

wget https://github.com/gonka-ai/gonka/releases/download/release/v0.2.10-post7/inferenced-amd64.zip
unzip inferenced-amd64.zip
chmod +x inferenced
LD_LIBRARY_PATH=. ./inferenced version

Latest version and all files: https://github.com/gonka-ai/gonka/releases

Step 2: Create a wallet

# Create a new wallet
LD_LIBRARY_PATH=. ./inferenced keys add MY_WALLET --keyring-backend test

# Show address (gonka1...)
LD_LIBRARY_PATH=. ./inferenced keys list --keyring-backend test

# Export private key in hex (64 chars, no 0x prefix)
LD_LIBRARY_PATH=. ./inferenced keys export MY_WALLET \
    --keyring-backend test \
    --unarmored-hex \
    --unsafe

Save:

  • address — string like gonka1...
  • privkey — hex without 0x, 64 characters

Step 3: Fund and register

Three things to do before your first inference:

3.1. Get GNK via faucet — https://gonka.gg/faucet

  • Sign in with Google
  • Enter your gonka1... address
  • Click "Claim" — you'll receive 0.01 GNK (once per 24 hours)

3.2. Register your public key — send a bank transaction:

# Get account_number (replace with your address)
curl -s "http://node1.gonka.ai:8000/chain-api/cosmos/auth/v1beta1/accounts/gonka1YOUR_ADDRESS" \
    | python3 -m json.tool

Find account_number in the response and replace 1234 with it:

LD_LIBRARY_PATH=. ./inferenced tx bank send \
    gonka1YOUR_ADDRESS \
    gonka1y2a9p56kv044327uycmqdexl7zs82fs5ryv5le \
    1000ngonka \
    --chain-id gonka-mainnet \
    --account-number 1234 \
    --sequence 0 \
    --fees 2000ngonka \
    --keyring-backend test \
    --generate-only > /tmp/unsigned.json

LD_LIBRARY_PATH=. ./inferenced tx sign /tmp/unsigned.json \
    --from MY_WALLET \
    --chain-id gonka-mainnet \
    --account-number 1234 \
    --sequence 0 \
    --keyring-backend test \
    --offline > /tmp/signed.json

TX_BYTES=$(LD_LIBRARY_PATH=. ./inferenced tx encode /tmp/signed.json)

curl -s -X POST "http://node1.gonka.ai:8000/chain-api/cosmos/tx/v1beta1/txs" \
    -H "Content-Type: application/json" \
    -d "{\"tx_bytes\": \"${TX_BYTES}\", \"mode\": \"BROADCAST_MODE_SYNC\"}" \
    | python3 -m json.tool

3.3. Register as a participant (sequence = 1):

LD_LIBRARY_PATH=. ./inferenced tx inference submit-new-participant "" \
    --from MY_WALLET \
    --chain-id gonka-mainnet \
    --account-number 1234 \
    --sequence 1 \
    --fees 2000ngonka \
    --keyring-backend test \
    --generate-only > /tmp/unsigned_p.json

LD_LIBRARY_PATH=. ./inferenced tx sign /tmp/unsigned_p.json \
    --from MY_WALLET \
    --chain-id gonka-mainnet \
    --account-number 1234 \
    --sequence 1 \
    --keyring-backend test \
    --offline > /tmp/signed_p.json

TX_BYTES=$(LD_LIBRARY_PATH=. ./inferenced tx encode /tmp/signed_p.json)

curl -s -X POST "http://node1.gonka.ai:8000/chain-api/cosmos/tx/v1beta1/txs" \
    -H "Content-Type: application/json" \
    -d "{\"tx_bytes\": \"${TX_BYTES}\", \"mode\": \"BROADCAST_MODE_SYNC\"}" \
    | python3 -m json.tool

Available Nodes

Node URL Transfer Agent
node1 http://node1.gonka.ai:8000 gonka1y2a9p56kv044327uycmqdexl7zs82fs5ryv5le
node2 http://node2.gonka.ai:8000 gonka1dkl4mah5erqggvhqkpc8j3qs5tyuetgdy552cp

Check the current TA address of a node:

curl -s "http://node1.gonka.ai:8000/v1/identity" | python3 -m json.tool

Common Errors

Error Cause Fix
500 nil pointer public key not registered Step 3.2: send bank TX
403 not a registered participant not in participants store Step 3.3: submit-new-participant
403 Transfer Agent not allowed wrong --transfer-address Check /v1/identity of the node
401 invalid signature wrong private key Double-check --privkey
429 rate limit too many requests Add --delay 3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors