ckb-rich-node RPC base on ckb-rpc and ckb-indexer-rpc.
Both RPCs are JSON-RPC protocol, more information can refer to ckb-rich-node.
Keypering API is WebSockets API for communication between Keypering and dApp base on plaintext.
- Establish link
When connecting to the WebSockets service for the first time, the server will return 40/keypering
to identify keypering.
- Auth
- Request
{"type": "auth", "origin": "http://demo.ckb.dapp"}
- Response
{"type": "auth", "success": true, "message": "failure message", "token": "xxxxxxxxxxxxxxxxxxxx"}
- Locks
- Request
{"type": "locks", "token": "xxxxxxxxxxxxxxxxxxxx", "requestId": "xxxxxxxxxxxx"}
- Response
{"type": "locks", "requestId": "xxxxxxxxxxxx", "success": true, "message": "failure message", "data": {"locks": [{"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", "hash_type": "type""args": "0x8211f1b938a107cd53b6302cc752a6fc3965638d"}]}}
- Sign
- Request
config is optional, default {"index": 0, "length": -1}
identify full signature.
{"type": "sign", "token": "xxxxxxxxxxxxxxxxxxxx", "requestId": "xxxxxxxxxxxx", "data": {"target": "LOCK_HASH", "tx": TX_JSON, "config": {"index": 0, "length": -1}, "meta": "transaction metainfo"}}
- Response
{"type": "sign", "requestId": "xxxxxxxxxxxx", "success": true, "message": "failure message", "data": {"tx": TX_JSON_WITH_SIGNATURE}}
- Sign and Send
- Request
{"type": "sign_send", "token": "xxxxxxxxxxxxxxxxxxxx", "requestId": "xxxxxxxxxxxx", "data": {"target": "LOCK_HASH", "tx": TX_JSON, "config": {"index": 0, "length": -1}, "meta": "transaction metainfo"}}
- Response
{"type": "sign_send", "requestId": "xxxxxxxxxxxx", "success": true, "message": "failure message", "data": {"hash": "TX_HASH"}}