Skip to content

Commit

Permalink
Merge pull request #11 from xelis-project/dev
Browse files Browse the repository at this point in the history
Version 1.4.0
  • Loading branch information
Slixe authored May 20, 2023
2 parents 2cd3ff3 + bdb2ccf commit 010d8ce
Show file tree
Hide file tree
Showing 58 changed files with 3,616 additions and 1,176 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ dev/
.vscode/
wallets/
peerlist-*.json
build/
build/

# ignore all profiling files
flamegraph.svg
perf.data
perf.data.old
126 changes: 116 additions & 10 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ No parameters
"block_time_target": 15000,
"difficulty": 310532,
"height": 9,
"pruned_topoheight": null,
"mempool_size": 0,
"native_supply": 8773780,
"stableheight": 1,
Expand Down Expand Up @@ -223,14 +224,16 @@ Retrieve a block at a specific topo height
"000001aa69c15167a192de809eeed112f50ec91e513cfbf7b1674523583acbf9"
],
"topoheight": 23,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
}
}
```

NOTE: `total_fees` field is not `null` when TXs are fetched (`include_txs` is at `true`).

#### Get Blocks At Height
Retrieve all blocks at a specific height

Expand Down Expand Up @@ -276,13 +279,16 @@ Retrieve all blocks at a specific height
"000001aa69c15167a192de809eeed112f50ec91e513cfbf7b1674523583acbf9"
],
"topoheight": 23,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
}
]
}

NOTE: `total_fees` field is not `null` when TXs are fetched (`include_txs` is at `true`).

```

#### Get Block By Hash
Expand Down Expand Up @@ -329,14 +335,16 @@ Retrieve a block by its hash
"000001aa69c15167a192de809eeed112f50ec91e513cfbf7b1674523583acbf9"
],
"topoheight": 23,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
}
}
```

NOTE: `total_fees` field is not `null` when TXs are fetched (`include_txs` is at `true`).

#### Get Top Block
Retrieve the highest block based on the topological height

Expand Down Expand Up @@ -378,14 +386,16 @@ Retrieve the highest block based on the topological height
"000001aa69c15167a192de809eeed112f50ec91e513cfbf7b1674523583acbf9"
],
"topoheight": 23,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
}
}
```

NOTE: `total_fees` field is not `null` when TXs are fetched (`include_txs` is at `true`).

#### Get Nonce
Retrieve the nonce for address in request params.

Expand Down Expand Up @@ -872,10 +882,10 @@ Submit a block to the daemon
}
```

#### Get Blocks
#### Get Blocks Range By TopoHeight
Retrieve a specific range of blocks (up to 20 maximum) based on topoheight

##### Method `get_blocks`
##### Method `get_blocks_range_by_topoheight`

##### Parameters
| Name | Type | Required | Note |
Expand All @@ -888,7 +898,7 @@ Retrieve a specific range of blocks (up to 20 maximum) based on topoheight
{
"jsonrpc": "2.0",
"id": 1,
"method": "get_blocks",
"method": "get_blocks_range_by_topoheight",
"params": {
"start_topoheight": 0,
"end_topoheight": 2
Expand Down Expand Up @@ -916,7 +926,103 @@ Retrieve a specific range of blocks (up to 20 maximum) based on topoheight
"timestamp": 1678215431432,
"tips": [],
"topoheight": 0,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 99,
"txs_hashes": [],
"version": 0
},
{
"block_type": "Sync",
"cumulative_difficulty": 150001,
"difficulty": 150000,
"extra_nonce": "e9a96f6130943e4ce3cbd6d4999efa1ca28020be6119f3da77dbcc837731600e",
"hash": "000011152d66bfe7a2b1d2e18a09a94c1d1593ae8ddeafcfc8f1b8c2b03b7995",
"height": 1,
"miner": "xel1qqqd2jtz9f2u3z6uznpx8mqdkh6llt3yn3eg3a5tpsfn8jcsthufg5q08670u",
"nonce": 3837,
"reward": 877379,
"supply": 1754759,
"timestamp": 1678215668838,
"tips": [
"55a162b8e0e137bb6a8de9f4c4b214fb60bcd2df15ec32fdd8f06759b863f06e"
],
"topoheight": 1,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
},
{
"block_type": "Sync",
"cumulative_difficulty": 300001,
"difficulty": 150000,
"extra_nonce": "f7c22d4f517c384493fa271304b885d1f092ab969a87e901fe9245ad0ca4490d",
"hash": "0000631d920e582069e47149adc53dfe8bb009163c94715d33e81e71b7a8dca3",
"height": 2,
"miner": "xel1qqqd2jtz9f2u3z6uznpx8mqdkh6llt3yn3eg3a5tpsfn8jcsthufg5q08670u",
"nonce": 1113,
"reward": 877379,
"supply": 2632138,
"timestamp": 1678215668843,
"tips": [
"000011152d66bfe7a2b1d2e18a09a94c1d1593ae8ddeafcfc8f1b8c2b03b7995"
],
"topoheight": 2,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
}
]
}
```


#### Get Blocks Range By Height
Retrieve a specific range of blocks (up to 20 maximum) based on height

##### Method `get_blocks_range_by_height`

##### Parameters
| Name | Type | Required | Note |
|:------------:|:-------:|:--------:|:----------------------------------------:|
| start_height | Integer | Optional | If not set, will retrieve last 20 blocks |
| end_height | Integer | Optional | Must be under current height |

##### Request
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "get_blocks_range_by_height",
"params": {
"start_height": 0,
"end_height": 2
}
}
```

##### Response
```json
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"block_type": "Sync",
"cumulative_difficulty": 1,
"difficulty": 1,
"extra_nonce": "0000000000000000000000000000000000000000000000000000000000000000",
"hash": "55a162b8e0e137bb6a8de9f4c4b214fb60bcd2df15ec32fdd8f06759b863f06e",
"height": 0,
"miner": "xel1qqqxcfxdc8ywarcz3wx2leahnfn2pyp0ymvfm42waluq408j2x5680gtl9ky3",
"nonce": 0,
"reward": 877380,
"supply": 877380,
"timestamp": 1678215431432,
"tips": [],
"topoheight": 0,
"total_fees": null,
"total_size_in_bytes": 99,
"txs_hashes": [],
"version": 0
Expand All @@ -937,7 +1043,7 @@ Retrieve a specific range of blocks (up to 20 maximum) based on topoheight
"55a162b8e0e137bb6a8de9f4c4b214fb60bcd2df15ec32fdd8f06759b863f06e"
],
"topoheight": 1,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
Expand All @@ -958,7 +1064,7 @@ Retrieve a specific range of blocks (up to 20 maximum) based on topoheight
"000011152d66bfe7a2b1d2e18a09a94c1d1593ae8ddeafcfc8f1b8c2b03b7995"
],
"topoheight": 2,
"total_fees": 0,
"total_fees": null,
"total_size_in_bytes": 131,
"txs_hashes": [],
"version": 0
Expand Down
Loading

0 comments on commit 010d8ce

Please sign in to comment.