Daemon JSON RPC API

Daemon JSON RPC API

To start Daemon JSON RPC API server you should specify a port on which server binds (additionally to standard daemon's arguments). You can choose any free port. To do that execute the following command from the command line:
1
./Qwertycoind --rpc-bind-port=8197
Copied!
If you want Daemon to be accessed from other computer not only yours you should also use a --rpc-bind-ip 0.0.0.0 command. To do that execute the following command from the command line:
1
./Qwertycoind --rpc-bind-ip=0.0.0.0 --rpc-bind-port=8197
Copied!
Having done that you're ready to operate with the daemon through the following API URLs (e.g., your IP address is 126.0.1.100):
1
http://126.0.1.100:8197/json_rpc
2
http://localhost:8197/json_rpc
Copied!

Available commands

getblockcount - returns current chain height

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
}
14
},
15
"required" : ["jsonrpc", "method"]
16
}
Copied!
Return value schema:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"result" : {
8
"type" : "object",
9
"properties" : {
10
"count" : {
11
"type" : "integer",
12
"minimum": 0,
13
"description": ""
14
},
15
"status" : {
16
"type" : "string"
17
}
18
},
19
"required": ["count", "status"]
20
}
21
},
22
"required": ["result"]
23
}
Copied!

getblockhash - Returns block hash by its height

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
},
14
"height" : {
15
"type" : "integer"
16
}
17
},
18
"required" : ["jsonrpc", "method", "height"]
19
}
Copied!
Return value schema:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"result" : {
8
"type" : "string",
9
"description": ""
10
}
11
},
12
"required": ["result"]
13
}
Copied!

getblocktemplate - Returns blocktemplate with an empty β€œhole” for nonce

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
},
14
"reserve_size" : {
15
"type" : "integer"
16
},
17
"wallet_address" : {
18
"type" : "string"
19
}
20
},
21
"required" : ["jsonrpc", "method", "reserve_size", "wallet_address"]
22
}
Copied!
Return value schema
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"result" : {
8
"difficulty" : {
9
"type" : "integer"
10
},
11
"height" : {
12
"type" :"integer"
13
},
14
"reserved_offset" : {
15
"type" : "integer"
16
},
17
"blocktemplate_blob" : {
18
"type" : "string"
19
},
20
"status" : {
21
"type" : "string"
22
}
23
},
24
"required": ["difficulty", "height", "reserved_offset", "blocktemplate_blob", "status"]
25
}
26
"required": ["result"]
27
}
Copied!

submitblock - Submits mined block

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
},
14
"block" : {
15
"type" : "string"
16
}
17
},
18
"required" : ["jsonrpc", "method", "block"]
19
}
Copied!
Return value schema:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"result" : {
8
"status" : {
9
"type" : "string",
10
"description": ""
11
},
12
"required": ["status"]
13
}
14
},
15
"required": ["result"]
16
}
Copied!

getlastblockheader - Returns last block header

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
}
14
},
15
"required" : ["jsonrpc", "method"]
16
}
Copied!
Return value schema:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"result" : {
8
"type" : "object",
9
"properties" : {
10
"block_header : {
11
"type" : "object",
12
"properties" : {
13
"major_version" : {
14
"type" : "integer",
15
"description" : ""
16
},
17
"minor_version" : {
18
"type" : "integer",
19
"description" : ""
20
},
21
"timestamp" : {
22
"type" : "integer",
23
"description" : "UNIX timestamp"
24
},
25
"prev_hash" : {
26
"type" : "string",
27
"description" : "previous block's hash"
28
},
29
"nonce" : {
30
"type" : "integer",
31
"description" : ""
32
},
33
"orphan_status" : {
34
"type" : "boolean",
35
"description" : "True if the block was marked as orphaned"
36
},
37
"height" : {
38
"type" : "integer",
39
"description" : ""
40
},
41
"depth" : {
42
"type" : "integer",
43
"description" : "last_block_height - this_block_height"
44
},
45
"hash" : {
46
"type" : "string",
47
"description" : ""
48
},
49
"difficulty" : {
50
"type" : "integer",
51
"description" : ""
52
},
53
"reward" : {
54
"type" : "integer",
55
"description" : "Reward for the block in atomic units"
56
}
57
},
58
"required": [
59
"major_version",
60
"minor_version",
61
"timestamp",
62
"prev_hash",
63
"nonce",
64
"orphan_status",
65
"height",
66
"depth",
67
"hash",
68
"difficulty",
69
"reward"
70
]
71
},
72
"status" : {
73
"type" : "string"
74
}
75
},
76
"required": ["block_header", "status"]
77
}
78
},
79
"required": ["result"]
80
}
Copied!

getblockheaderbyhash - Returns last block header by given hash.

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
},
14
"hash" : {
15
"type" : "string"
16
}
17
},
18
"required" : ["jsonrpc", "method", "hash"]
19
}
Copied!
Return value schema:
See getlastblockheader above

getblockheaderbyheight - Returns block header by given block height.

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
},
14
"height" : {
15
"type" : "integer"
16
}
17
},
18
"required" : ["jsonrpc", "method", "height"]
19
}
Copied!
Return value schema:
See getlastblockheader above

getcurrencyId - Returns unique currency identifier

URL:
1
/json_rpc
Copied!
Input arguments:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"description": "Schema for transfer method in Qwertycoin wallet",
5
"type": "object",
6
​
7
"properties" : {
8
"jsonrpc" : {
9
"type" : "string"
10
},
11
"method" : {
12
"type" : "string"
13
}
14
},
15
"required" : ["jsonrpc", "method"]
16
}
Copied!
Return value schema:
1
{
2
"$schema": "http://json-schema.org/draft-04/schema#",
3
"title": "QWC JSON RPC API",
4
"type": "object",
5
​
6
"properties" : {
7
"currency_id_blob" : {
8
"type" : "string"
9
}
10
}
11
}
Copied!

Examples

getblockcount

Input:
1
{
2
"jsonrpc": "2.0",
3
"id": "test",
4
"method": "getblockcount",
5
"params": {}
6
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"count": 123456,
6
"status": "OK"
7
}
8
}
Copied!

getblockhash

Input:
1
{
2
"jsonrpc": "2.0",
3
"id": "test",
4
"method": "on_getblockhash",
5
"params": {
6
"height": 123456
7
}
8
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": "a7428..."
5
}
Copied!

getblocktemplate

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "getblocktemplate",
5
"params": {
6
"reserve_size": 200,
7
"wallet_address": "28j5g2Hbe1..."
8
}
9
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"blocktemplate_blob": "0100de...",
6
"difficulty": 65563,
7
"height": 123456,
8
"reserved_offset": 395,
9
"status": ""
10
}
11
}
Copied!

submitblock

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "submitblock",
5
"params": ["0100b...."]
6
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"status" : "OK"
6
}
7
}
Copied!

getlastblockheader

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "getlastblockheader"
5
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"block_header": {
6
"depth": 1,
7
"difficulty": 65198,
8
"hash": "9a8be83...",
9
"height": 123456,
10
"major_version": 1,
11
"minor_version": 0,
12
"nonce": 2358499061,
13
"orphan_status": false,
14
"prev_hash": "dde56b7e...",
15
"reward": 44090506423186,
16
"timestamp": 1356589561
17
},
18
"status": "OK"
19
}
20
}
Copied!

getblockheaderbyhash

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "getblockheaderbyhash",
5
"params": {
6
"hash" : "9a8be8..."
7
}
8
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"block_header": {
6
"depth": 1,
7
"difficulty": 65198,
8
"hash": "9a8be83...",
9
"height": 123456,
10
"major_version": 1,
11
"minor_version": 0,
12
"nonce": 2358499061,
13
"orphan_status": false,
14
"prev_hash": "dde56b7e...",
15
"reward": 44090506423186,
16
"timestamp": 1356589561
17
},
18
"status": "OK"
19
}
20
}
Copied!

getblockheaderbyheight

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "getblockheaderbyheight",
5
"params": {
6
"height" : 123456
7
}
8
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"block_header": {
6
"depth": 1,
7
"difficulty": 65198,
8
"hash": "9a8be83...",
9
"height": 123456,
10
"major_version": 1,
11
"minor_version": 0,
12
"nonce": 2358499061,
13
"orphan_status": false,
14
"prev_hash": "dde56b7e...",
15
"reward": 44090506423186,
16
"timestamp": 1356589561
17
},
18
"status": "OK"
19
}
20
}
Copied!

getcurrencyId

Input:
1
{
2
"jsonrpc": "2.0",
3
"id" : "test",
4
"method": "getcurrencyid"
5
}
Copied!
Output:
1
{
2
"id": "test",
3
"jsonrpc": "2.0",
4
"result": {
5
"currency_id_blob" : "31..."
6
}
7
}
Copied!
Last modified 1yr ago