{
  "schemaVersion": "1.0",
  "item": {
    "slug": "xian-sdk-skill",
    "name": "Xian SDK",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/Endogen/xian-sdk-skill",
    "canonicalUrl": "https://clawhub.ai/Endogen/xian-sdk-skill",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/xian-sdk-skill",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=xian-sdk-skill",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/contract-patterns.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/xian-sdk-skill"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/xian-sdk-skill",
    "agentPageUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Xian SDK Skill",
        "body": "Build applications on Xian using the xian-py Python SDK."
      },
      {
        "title": "Installation",
        "body": "pip install xian-py\n\n# With Ethereum wallet support\npip install \"xian-py[eth]\""
      },
      {
        "title": "Quick Reference",
        "body": "from xian_py import Xian, Wallet\n\nwallet = Wallet()  # New wallet\nxian = Xian('http://node:26657', wallet=wallet)\n\n# Common operations\nbalance = xian.get_balance(wallet.public_key)\nstate = xian.get_state('contract', 'variable', 'key')\nresult = xian.send(amount=100, to_address='recipient')\nresult = xian.send_tx('contract', 'function', {'arg': 'value'})\nresult = xian.submit_contract('name', code)"
      },
      {
        "title": "Basic Wallet",
        "body": "from xian_py import Wallet\n\n# Create new wallet (random seed)\nwallet = Wallet()\n\n# From existing private key\nwallet = Wallet('ed30796abc4ab47a97bfb37359f50a9c362c7b304a4b4ad1b3f5369ecb6f7fd8')\n\nprint(wallet.public_key)   # Address\nprint(wallet.private_key)  # Keep secret!"
      },
      {
        "title": "HD Wallet (BIP39/BIP32)",
        "body": "from xian_py.wallet import HDWallet\n\n# Create with new 24-word mnemonic\nhd = HDWallet()\nprint(hd.mnemonic_str)  # Save this!\n\n# Restore from mnemonic\nhd = HDWallet('word1 word2 word3 ... word24')\n\n# Derive Xian wallet\npath = [44, 0, 0, 0, 0]  # m/44'/0'/0'/0'/0'\nwallet = hd.get_wallet(path)\n\n# Derive Ethereum wallet (requires eth extras)\neth_wallet = hd.get_ethereum_wallet(0)  # First account\neth_wallet2 = hd.get_ethereum_wallet(1)  # Second account"
      },
      {
        "title": "Signing & Verification",
        "body": "wallet = Wallet()\n\n# Sign message\nsignature = wallet.sign_msg(\"Hello Xian\")\n\n# Verify\nis_valid = wallet.verify_msg(\"Hello Xian\", signature)\n\n# Validate key format\nWallet.is_valid_key(wallet.public_key)  # True"
      },
      {
        "title": "Blockchain Queries",
        "body": "from xian_py import Xian\n\nxian = Xian('http://node:26657')\n\n# Balance (default: currency contract)\nbalance = xian.get_balance('address')\n\n# Custom token balance\nbalance = xian.get_balance('address', contract='token_contract')\n\n# Contract state\nstate = xian.get_state('contract_name', 'variable', 'key')\n\n# Get contract source\nsource = xian.get_contract('contract_name', clean=True)"
      },
      {
        "title": "Simple Token Transfer",
        "body": "from xian_py import Xian, Wallet\n\nwallet = Wallet('your_private_key')\nxian = Xian('http://node:26657', wallet=wallet)\n\n# Send tokens (auto stamp calculation)\nresult = xian.send(amount=100, to_address='recipient')\n\nif result['success']:\n    print(f\"TX: {result['tx_hash']}\")"
      },
      {
        "title": "Contract Interaction",
        "body": "# Call any contract function\nresult = xian.send_tx(\n    contract='currency',\n    function='transfer',\n    kwargs={'to': 'recipient', 'amount': 1000}\n)\n\n# With custom token\nresult = xian.send_tx(\n    contract='my_token',\n    function='transfer',\n    kwargs={'to': 'recipient', 'amount': 500}\n)"
      },
      {
        "title": "Stamp Estimation",
        "body": "from xian_py.transaction import simulate_tx, get_nonce\n\n# Simulate to get stamp cost\npayload = {\n    \"contract\": \"currency\",\n    \"function\": \"transfer\",\n    \"kwargs\": {\"to\": \"recipient\", \"amount\": 100},\n    \"sender\": wallet.public_key,\n}\n\nresult = simulate_tx('http://node:26657', payload)\nprint(f\"Stamps needed: {result['stamps_used']}\")"
      },
      {
        "title": "Deploy Contract",
        "body": "code = '''\nbalances = Hash(default_value=0)\n\n@construct\ndef seed():\n    balances[ctx.caller] = 1_000_000\n\n@export\ndef transfer(to: str, amount: float):\n    assert amount > 0, \"Amount must be positive\"\n    assert balances[ctx.caller] >= amount, \"Insufficient balance\"\n    \n    balances[ctx.caller] -= amount\n    balances[to] += amount\n\n@export\ndef balance_of(address: str) -> float:\n    return balances[address]\n'''\n\nresult = xian.submit_contract('my_token', code)\nprint(f\"Deployed: {result['success']}\")"
      },
      {
        "title": "Contract Patterns",
        "body": "See references/contract-patterns.md for common patterns (tokens, access control, pausable, upgrades)."
      },
      {
        "title": "Contract Validation",
        "body": "Validate against Xian standards:\n\nfrom xian_py.validator import validate_contract, XianStandard\n\nis_valid, errors = validate_contract(code)  # XSC001 default\n\n# Specific standard\nis_valid, errors = validate_contract(code, standard=XianStandard.XSC001)\n\nif not is_valid:\n    print(errors)"
      },
      {
        "title": "Read-Only Execution",
        "body": "Query contract without spending stamps:\n\nfrom xian_py.transaction import simulate_tx\n\npayload = {\n    \"contract\": \"my_token\",\n    \"function\": \"balance_of\",\n    \"kwargs\": {\"address\": \"some_address\"},\n    \"sender\": wallet.public_key,\n}\n\nresult = simulate_tx('http://node:26657', payload)\nprint(f\"Balance: {result['result']}\")"
      },
      {
        "title": "Async Operations",
        "body": "For high-performance applications:\n\nimport asyncio\nfrom xian_py import XianAsync, Wallet\n\nasync def main():\n    wallet = Wallet()\n    \n    async with XianAsync('http://node:26657', wallet=wallet) as xian:\n        # Concurrent queries\n        balance, state = await asyncio.gather(\n            xian.get_balance(wallet.public_key),\n            xian.get_state('currency', 'balances', 'address')\n        )\n        \n        # Send transaction\n        result = await xian.send(amount=100, to_address='recipient')\n\nasyncio.run(main())"
      },
      {
        "title": "Batch Operations",
        "body": "async def check_balances(addresses: list[str]):\n    async with XianAsync('http://node:26657') as xian:\n        balances = await asyncio.gather(*[\n            xian.get_balance(addr) for addr in addresses\n        ])\n        return dict(zip(addresses, balances))"
      },
      {
        "title": "Sync Wrapper",
        "body": "Call async from sync code:\n\nfrom xian_py import XianAsync, run_sync\n\ndef get_balance_sync(address: str) -> float:\n    async def _get():\n        async with XianAsync('http://node:26657') as xian:\n            return await xian.get_balance(address)\n    return run_sync(_get())\n\nbalance = get_balance_sync('address')"
      },
      {
        "title": "Encryption",
        "body": "Two-way encrypted messaging:\n\nfrom xian_py import Wallet\nfrom xian_py.crypto import encrypt, decrypt_as_sender, decrypt_as_receiver\n\nsender = Wallet()\nreceiver = Wallet()\n\n# Encrypt\nencrypted = encrypt(sender.private_key, receiver.public_key, \"Secret message\")\n\n# Decrypt as sender\nmsg = decrypt_as_sender(sender.private_key, receiver.public_key, encrypted)\n\n# Decrypt as receiver  \nmsg = decrypt_as_receiver(sender.public_key, receiver.private_key, encrypted)"
      },
      {
        "title": "Error Handling",
        "body": "from xian_py import Xian, XianException\n\ntry:\n    result = xian.send_tx('contract', 'function', {})\nexcept XianException as e:\n    print(f\"Blockchain error: {e}\")"
      },
      {
        "title": "Token Transfer Service",
        "body": "class TokenService:\n    def __init__(self, node_url: str, private_key: str):\n        self.wallet = Wallet(private_key)\n        self.xian = Xian(node_url, wallet=self.wallet)\n    \n    def transfer(self, to: str, amount: float, token: str = 'currency'):\n        balance = self.xian.get_balance(self.wallet.public_key, contract=token)\n        if balance < amount:\n            raise ValueError(f\"Insufficient: {balance} < {amount}\")\n        \n        return self.xian.send_tx(token, 'transfer', {'to': to, 'amount': amount})"
      },
      {
        "title": "DEX Swap",
        "body": "async def swap(xian, dex: str, token_in: str, token_out: str, \n               amount: float, min_out: float):\n    # Approve DEX\n    await xian.send_tx(token_in, 'approve', {'to': dex, 'amount': amount})\n    \n    # Execute swap\n    return await xian.send_tx(dex, 'swap', {\n        'token_in': token_in,\n        'token_out': token_out,\n        'amount_in': amount,\n        'min_amount_out': min_out\n    })"
      },
      {
        "title": "Resources",
        "body": "xian-py GitHub — Full SDK docs\nXian Standard Contracts — Token standards\nxian.org — Project site"
      }
    ],
    "body": "Xian SDK Skill\n\nBuild applications on Xian using the xian-py Python SDK.\n\nInstallation\npip install xian-py\n\n# With Ethereum wallet support\npip install \"xian-py[eth]\"\n\nQuick Reference\nfrom xian_py import Xian, Wallet\n\nwallet = Wallet()  # New wallet\nxian = Xian('http://node:26657', wallet=wallet)\n\n# Common operations\nbalance = xian.get_balance(wallet.public_key)\nstate = xian.get_state('contract', 'variable', 'key')\nresult = xian.send(amount=100, to_address='recipient')\nresult = xian.send_tx('contract', 'function', {'arg': 'value'})\nresult = xian.submit_contract('name', code)\n\nWallets\nBasic Wallet\nfrom xian_py import Wallet\n\n# Create new wallet (random seed)\nwallet = Wallet()\n\n# From existing private key\nwallet = Wallet('ed30796abc4ab47a97bfb37359f50a9c362c7b304a4b4ad1b3f5369ecb6f7fd8')\n\nprint(wallet.public_key)   # Address\nprint(wallet.private_key)  # Keep secret!\n\nHD Wallet (BIP39/BIP32)\nfrom xian_py.wallet import HDWallet\n\n# Create with new 24-word mnemonic\nhd = HDWallet()\nprint(hd.mnemonic_str)  # Save this!\n\n# Restore from mnemonic\nhd = HDWallet('word1 word2 word3 ... word24')\n\n# Derive Xian wallet\npath = [44, 0, 0, 0, 0]  # m/44'/0'/0'/0'/0'\nwallet = hd.get_wallet(path)\n\n# Derive Ethereum wallet (requires eth extras)\neth_wallet = hd.get_ethereum_wallet(0)  # First account\neth_wallet2 = hd.get_ethereum_wallet(1)  # Second account\n\nSigning & Verification\nwallet = Wallet()\n\n# Sign message\nsignature = wallet.sign_msg(\"Hello Xian\")\n\n# Verify\nis_valid = wallet.verify_msg(\"Hello Xian\", signature)\n\n# Validate key format\nWallet.is_valid_key(wallet.public_key)  # True\n\nBlockchain Queries\nfrom xian_py import Xian\n\nxian = Xian('http://node:26657')\n\n# Balance (default: currency contract)\nbalance = xian.get_balance('address')\n\n# Custom token balance\nbalance = xian.get_balance('address', contract='token_contract')\n\n# Contract state\nstate = xian.get_state('contract_name', 'variable', 'key')\n\n# Get contract source\nsource = xian.get_contract('contract_name', clean=True)\n\nTransactions\nSimple Token Transfer\nfrom xian_py import Xian, Wallet\n\nwallet = Wallet('your_private_key')\nxian = Xian('http://node:26657', wallet=wallet)\n\n# Send tokens (auto stamp calculation)\nresult = xian.send(amount=100, to_address='recipient')\n\nif result['success']:\n    print(f\"TX: {result['tx_hash']}\")\n\nContract Interaction\n# Call any contract function\nresult = xian.send_tx(\n    contract='currency',\n    function='transfer',\n    kwargs={'to': 'recipient', 'amount': 1000}\n)\n\n# With custom token\nresult = xian.send_tx(\n    contract='my_token',\n    function='transfer',\n    kwargs={'to': 'recipient', 'amount': 500}\n)\n\nStamp Estimation\nfrom xian_py.transaction import simulate_tx, get_nonce\n\n# Simulate to get stamp cost\npayload = {\n    \"contract\": \"currency\",\n    \"function\": \"transfer\",\n    \"kwargs\": {\"to\": \"recipient\", \"amount\": 100},\n    \"sender\": wallet.public_key,\n}\n\nresult = simulate_tx('http://node:26657', payload)\nprint(f\"Stamps needed: {result['stamps_used']}\")\n\nSmart Contracts\nDeploy Contract\ncode = '''\nbalances = Hash(default_value=0)\n\n@construct\ndef seed():\n    balances[ctx.caller] = 1_000_000\n\n@export\ndef transfer(to: str, amount: float):\n    assert amount > 0, \"Amount must be positive\"\n    assert balances[ctx.caller] >= amount, \"Insufficient balance\"\n    \n    balances[ctx.caller] -= amount\n    balances[to] += amount\n\n@export\ndef balance_of(address: str) -> float:\n    return balances[address]\n'''\n\nresult = xian.submit_contract('my_token', code)\nprint(f\"Deployed: {result['success']}\")\n\nContract Patterns\n\nSee references/contract-patterns.md for common patterns (tokens, access control, pausable, upgrades).\n\nContract Validation\n\nValidate against Xian standards:\n\nfrom xian_py.validator import validate_contract, XianStandard\n\nis_valid, errors = validate_contract(code)  # XSC001 default\n\n# Specific standard\nis_valid, errors = validate_contract(code, standard=XianStandard.XSC001)\n\nif not is_valid:\n    print(errors)\n\nRead-Only Execution\n\nQuery contract without spending stamps:\n\nfrom xian_py.transaction import simulate_tx\n\npayload = {\n    \"contract\": \"my_token\",\n    \"function\": \"balance_of\",\n    \"kwargs\": {\"address\": \"some_address\"},\n    \"sender\": wallet.public_key,\n}\n\nresult = simulate_tx('http://node:26657', payload)\nprint(f\"Balance: {result['result']}\")\n\nAsync Operations\n\nFor high-performance applications:\n\nimport asyncio\nfrom xian_py import XianAsync, Wallet\n\nasync def main():\n    wallet = Wallet()\n    \n    async with XianAsync('http://node:26657', wallet=wallet) as xian:\n        # Concurrent queries\n        balance, state = await asyncio.gather(\n            xian.get_balance(wallet.public_key),\n            xian.get_state('currency', 'balances', 'address')\n        )\n        \n        # Send transaction\n        result = await xian.send(amount=100, to_address='recipient')\n\nasyncio.run(main())\n\nBatch Operations\nasync def check_balances(addresses: list[str]):\n    async with XianAsync('http://node:26657') as xian:\n        balances = await asyncio.gather(*[\n            xian.get_balance(addr) for addr in addresses\n        ])\n        return dict(zip(addresses, balances))\n\nSync Wrapper\n\nCall async from sync code:\n\nfrom xian_py import XianAsync, run_sync\n\ndef get_balance_sync(address: str) -> float:\n    async def _get():\n        async with XianAsync('http://node:26657') as xian:\n            return await xian.get_balance(address)\n    return run_sync(_get())\n\nbalance = get_balance_sync('address')\n\nEncryption\n\nTwo-way encrypted messaging:\n\nfrom xian_py import Wallet\nfrom xian_py.crypto import encrypt, decrypt_as_sender, decrypt_as_receiver\n\nsender = Wallet()\nreceiver = Wallet()\n\n# Encrypt\nencrypted = encrypt(sender.private_key, receiver.public_key, \"Secret message\")\n\n# Decrypt as sender\nmsg = decrypt_as_sender(sender.private_key, receiver.public_key, encrypted)\n\n# Decrypt as receiver  \nmsg = decrypt_as_receiver(sender.public_key, receiver.private_key, encrypted)\n\nError Handling\nfrom xian_py import Xian, XianException\n\ntry:\n    result = xian.send_tx('contract', 'function', {})\nexcept XianException as e:\n    print(f\"Blockchain error: {e}\")\n\nCommon Patterns\nToken Transfer Service\nclass TokenService:\n    def __init__(self, node_url: str, private_key: str):\n        self.wallet = Wallet(private_key)\n        self.xian = Xian(node_url, wallet=self.wallet)\n    \n    def transfer(self, to: str, amount: float, token: str = 'currency'):\n        balance = self.xian.get_balance(self.wallet.public_key, contract=token)\n        if balance < amount:\n            raise ValueError(f\"Insufficient: {balance} < {amount}\")\n        \n        return self.xian.send_tx(token, 'transfer', {'to': to, 'amount': amount})\n\nDEX Swap\nasync def swap(xian, dex: str, token_in: str, token_out: str, \n               amount: float, min_out: float):\n    # Approve DEX\n    await xian.send_tx(token_in, 'approve', {'to': dex, 'amount': amount})\n    \n    # Execute swap\n    return await xian.send_tx(dex, 'swap', {\n        'token_in': token_in,\n        'token_out': token_out,\n        'amount_in': amount,\n        'min_amount_out': min_out\n    })\n\nResources\nxian-py GitHub — Full SDK docs\nXian Standard Contracts — Token standards\nxian.org — Project site"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/Endogen/xian-sdk-skill",
    "publisherUrl": "https://clawhub.ai/Endogen/xian-sdk-skill",
    "owner": "Endogen",
    "version": "0.1.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/xian-sdk-skill",
    "downloadUrl": "https://openagent3.xyz/downloads/xian-sdk-skill",
    "agentUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/xian-sdk-skill/agent.md"
  }
}