Technical Reference
"Technical Reference" provides developers with the 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 for high performance, low cost, and EVM compatibility; all reference information is built on these characteristics.
1. JSON-RPC API Reference
WSCChain provides 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:
Response:
eth_sendRawTransaction
Description: Send a signed transaction.
Parameters:
rawTx: Signed transaction data (hex string).
Request:
Response:
eth_call
Description: Call a read-only method of a smart contract.
Parameters:
transaction: Includesto(contract address) anddata(method signature and parameters).block: Block tag.
Request:
Response:
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 example ABI for WSCChain core contracts used to interact with the WSC token and other features.
2.1 WSC Token ABI
Contract Address:
Standard: ERC-20.
Core Methods:
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 faults or malicious behavior from 1/3 of validators (up to 7 core validators).
Penalty Mechanism: If no blocks are produced for 100 consecutive blocks, 5% of staked WSC will be deducted.
3.3 Rewards
Block Reward: Receives all GAS income per block, dynamically adjusted.
Delegation Reward Distribution: Rewards are split between validators and delegators at a 70:30 ratio.
6. Error Codes
The following are common errors and their remedies:
Error Code
Description
Remedy
-32000
Insufficient funds
Check the account balance and obtain more WSC tokens.
-32603
Out of gas
Increase the transaction's gas limit.
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
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