Technical Reference
"Technical Reference" provides developers with core technical details of WSCChain, including API interfaces, smart contract ABIs, consensus mechanism parameters, and other key configuration information. This chapter is intended as a technical manual for developers to help you interact with the WSCChain mainnet, debug applications, and optimize development workflows. WSCChain is designed with a focus on high performance, low cost, and EVM compatibility; all reference information is built on these characteristics.
1. JSON-RPC API Reference
JuChain offers a standard JSON-RPC API to support interaction with the blockchain.
1.1 Configuration
Endpoint:
https://rpc.onwsc.com/Protocol: HTTP/HTTPS or WebSocket (wss://rpc.onwsc.com/ws)
1.2 Common Methods
eth_blockNumber
Description: Returns the current block height.
Request:
{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 }Response:
{ "jsonrpc": "2.0", "id": 1, "result": "0x1a2b3c" // Hexadecimal block height }Example(cURL):
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' https://rpc.onwsc.com/
eth_getBalance
Description: Query the WSC balance of a specified address.
Parameters:
address: 20-byte address (e.g."0x1234567890abcdef1234567890abcdef12345678").block: Block tag (e.g."latest").
Request:
{ "jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0x1234567890abcdef1234567890abcdef12345678", "latest"], "id": 2 }Response:
{ "jsonrpc": "2.0", "id": 2, "result": "0x16345785d8a0000" // Balance (wei) }
eth_sendRawTransaction
Description: Send a signed transaction.
Parameters:
rawTx: Signed transaction data (hex string).
Request:
{ "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": ["0xf86c018502540be400825208941234567890abcdef1234567890abcdef1234567888016345785d8a00008025a0..."], "id": 3 }Response:
{ "jsonrpc": "2.0", "id": 3, "result": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" // Transaction hash }
eth_call
Description: Call a smart contract's read-only method.
Parameters:
transaction: Includesto(contract address) anddata(method signature and parameters).block: Block tag.
Request:
{ "jsonrpc": "2.0", "method": "eth_call", "params": [{"to": "0xContractAddress", "data": "0x6d4ce63c"}, "latest"], "id": 4 }Response:
{ "jsonrpc": "2.0", "id": 4, "result": "0x000000000000000000000000000000000000000000000000000000000000002a" // Return value (e.g. 42) }
1.3 Full API List
More methods (such as
eth_getTransactionByHash,eth_getBlockByNumber) are compatible with the Ethereum API; please refer to Ethereum JSON-RPC Documentation.
2. Smart Contract ABI
Below is an ABI example for JuChain core contracts, used to interact with the WSC token and other features.
2.1 WSC Token ABI
Contract Address:
0x253Ef4d73b20a1F55651B8788238dad355AbB11FStandard: ERC-20.
Core Methods:
[ { "constant": true, "inputs": [{"name": "_owner", "type": "address"}], "name": "balanceOf", "outputs": [{"name": "balance", "type": "uint256"}], "type": "function" }, { "constant": false, "inputs": [ {"name": "_to", "type": "address"}, {"name": "_value", "type": "uint256"} ], "name": "transfer", "outputs": [{"name": "success", "type": "bool"}], "type": "function" }, { "constant": false, "inputs": [ {"name": "_spender", "type": "address"}, {"name": "_value", "type": "uint256"} ], "name": "approve", "outputs": [{"name": "success", "type": "bool"}], "type": "function" } ]
3. WPoSA Parameters
WPoSA (WSCChain Proof of Stake Authorization) is WSCChain's consensus mechanism. The following are key parameters:
3.1 Consensus Parameters
Block Time: 1 second.
Transaction Finality: 1 second (1 block).
Maximum Number of Core Validators: 21.
Minimum Staking Requirement: 10,00 WSC.
Validation Cycle: Default 7200 blocks (about 6 hours), dynamically adjustable in the range 3600-14400 blocks.
3.2 Fault Tolerance
Byzantine Fault Tolerance: Can tolerate failure or malicious behavior of 1/3 of validators (up to 7 core validators).
Penalty Mechanism: If a validator fails to produce blocks for 100 consecutive blocks, 5% of staked WSC is deducted.
3.3 Rewards
Block Reward: Receive all GAS revenue per block, dynamically adjusted.
Delegation Reward Distribution: Validators and delegators share rewards at a 70:30 ratio.
6. Error Codes
Below are common errors and their solutions:
Error Code
Description
Solution
-32000
Insufficient funds
Check the account balance and obtain more WSC tokens.
-32603
Out of gas
Increase the gas limit for the transaction.
429
Too Many Requests
Wait 1 minute and retry, or check rate limits.
0x
Transaction failed (Reverted)
Check contract logic or input parameters.
6. Tools and SDKs
6.1 Truffle Configuration
Example(
truffle-config.js):Copy
const HDWalletProvider = require("@truffle/hdwallet-provider"); module.exports = { networks: { wscchain: { provider: () => new HDWalletProvider("mnemonic", "https://rpc.onwsc.com"), network_id: 20180422, gas: 5500000, gasPrice: 1000000000, }, }, };
7. Other References
EVM Compatibility: WSCChain supports all Ethereum opcodes; refer to Ethereum Yellow Paper.
Block Structure:
Header: version, previous hash, timestamp, Merkle root.
Body: list of transactions.
State Database: Based on MPT, refer to Ethereum Trie.
Last updated