Skip to content

Commit

Permalink
Merge pull request #45 from xelis-project/dev
Browse files Browse the repository at this point in the history
v1.9.4 Mainnet
  • Loading branch information
Slixe committed Apr 28, 2024
2 parents 02c0d8c + c362d08 commit 3724018
Show file tree
Hide file tree
Showing 35 changed files with 1,100 additions and 604 deletions.
81 changes: 61 additions & 20 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,17 @@ No parameters
```

#### Get Block Template
Retrieve the block template for PoW work
Retrieve the block template (Block Header) for PoW work.

Block Header can be serialized/deserialized using following order on byte array:
- 1 byte for version
- 8 bytes for height (u64) big endian format
- 8 bytes for timestamp (u64) big endian format
- 8 bytes for nonce (u64) big endian format
- 1 byte for tips count
- 32 bytes per hash (count of elements is based on previous byte)
- 32 bytes for extra nonce (this space is free and can be used to spread more the work or write anything)
- 32 bytes for miner public key

##### Method `get_block_template`

Expand All @@ -435,15 +445,32 @@ Retrieve the block template for PoW work
}
```

##### Response
```json
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"difficulty": "15000",
"height": 45,
"template": "00000000000000002d0000018f1cbd697000000000000000000eded85557e887b45989a727b6786e1bd250de65042d9381822fa73d01d2c4ff01d3a0154853dbb01dc28c9102e9d94bea355b8ee0d82c3e078ac80841445e86520000d67ad13934337b85c34985491c437386c95de0d97017131088724cfbedebdc55",
"topoheight": 44
}
}
```

#### Submit Block
Submit a block header in hexadecimal format to the daemon.

**NOTE**: Parameter `miner_work` is optional has it is also supported to be directly applied on `block_template`.

##### Method `submit_block`

##### Parameters
| Name | Type | Required | Note |
|:--------------:|:------:|:--------:|:-------------------:|
| block_template | String | Required | Block in hex format |
| Name | Type | Required | Note |
|:--------------:|:------:|:--------:|:------------------------:|
| block_template | String | Required | Block in hex format |
| miner_work | String | Optional | Miner work in hex format |

##### Request
```json
Expand All @@ -452,7 +479,7 @@ Submit a block header in hexadecimal format to the daemon.
"id": 0,
"method": "submit_block",
"params": {
"block_template": "0000000000000be0000000000000000000000186c0d2dac5000000000003e33798b264214181b57720a6e6cdf87cd9bcd80391dde6780223f87176aff03b45080100000040453896c70b2be2d7088860f179a9e9fc3d03941170d6bf8c2dc6d3e60000d549622a55c88b5c14c263ec0db5f5ffae249c7288f68b0c1333cb105df89450"
"block_template": "00000000000000002d0000018f1cbd697000000000000000000eded85557e887b45989a727b6786e1bd250de65042d9381822fa73d01d2c4ff01d3a0154853dbb01dc28c9102e9d94bea355b8ee0d82c3e078ac80841445e86520000d67ad13934337b85c34985491c437386c95de0d97017131088724cfbedebdc55"
}
}
```
Expand All @@ -466,19 +493,6 @@ Submit a block header in hexadecimal format to the daemon.
}
```

##### Response
```json
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"difficulty": "92606820000",
"height": 21863,
"template": "0000000000000055670000018e8715a7e30000000000000000c0e5e874714934c447db03757ac0666bbb1712f61da2c9d9aa548741240ccac10100000000098c66fcb4a8d5c1eeb5acdde7a31e9bc912120c61e41826328e6dee0000d67ad13934337b85c34985491c437386c95de0d97017131088724cfbedebdc55"
}
}
```

#### Get Block At Topo Height
Retrieve a block at a specific topo height

Expand Down Expand Up @@ -6221,7 +6235,7 @@ When no topoheight is set, it rescan until topoheight 0.
"method": "rescan",
"id": 1,
"params": {
"topoheight": 1337
"until_topoheight": 1337
}
}
```
Expand Down Expand Up @@ -7847,7 +7861,7 @@ Parameter value can be anything (object, value, array...)
```json
{
"jsonrpc": "2.0",
"method": "estimate_fees",
"method": "sign_data",
"id": 1,
"params": {
"hello": "world"
Expand Down Expand Up @@ -7901,4 +7915,31 @@ Returned fees are in atomic units.
"jsonrpc": "2.0",
"result": 25000
}
```


#### Is Online
Determine if the wallet is connected to a node or not (offline / online mode).

##### Method `is_online`

##### Parameters
No parameter

##### Request
```json
{
"jsonrpc": "2.0",
"method": "is_online",
"id": 1
}
```

##### Response
```json
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}
```
59 changes: 18 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Pruning system is also available to reduce the size of the blockchain by removin

We also aims to enabled Smart Contracts support in the future.

We provide differents built-in network:
- Mainnet: Not released yet
We provide different built-in networks:
- Mainnet: Released April 20, 2024.
- Testnet: Running
- Devnet: this network is used for local development purpose where you want to create your own local chain. It has no peers

Expand Down
8 changes: 3 additions & 5 deletions build_all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

# support: ARM64, x86_64 linux, Windows x86_64
targets=("aarch64-unknown-linux-gnu" "x86_64-unknown-linux-musl" "x86_64-unknown-linux-gnu" "x86_64-pc-windows-gnu")
# support: ARM64, ARMv7, x86_64 linux, Windows x86_64
targets=("aarch64-unknown-linux-gnu" "armv7-unknown-linux-gnueabihf" "x86_64-unknown-linux-musl" "x86_64-unknown-linux-gnu" "x86_64-pc-windows-gnu")
binaries=("xelis_daemon" "xelis_miner" "xelis_wallet")
extra_files=("README.md" "API.md")

Expand All @@ -19,9 +19,7 @@ sudo systemctl start docker
# compile all binaries for all targets
echo "Compiling binaries for all targets"
for target in "${targets[@]}"; do
for binary in "${binaries[@]}"; do
cross build --profile release-with-lto --bin $binary --target $target
done
cross build --target $target --profile release-with-lto
done

echo "Deleting build folder"
Expand Down
6 changes: 3 additions & 3 deletions xelis_common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xelis_common"
version = "1.9.3"
version = "1.9.4"
edition = "2021"
authors = ["Slixe <slixeprivate@gmail.com>"]
build = "build.rs"
Expand Down Expand Up @@ -28,7 +28,7 @@ log = "0.4"
fern = { version = "0.6", features = ["colored", "date-based"] }
chrono = "0.4.35"
tokio = { version = "1.36", features = ["macros", "signal", "time", "sync"], optional = true }
reqwest = { version = "0.11.25", default-features = false, features = ["json", "rustls"], optional = true }
reqwest = { version = "0.11.25", default-features = false, features = ["json"], optional = true }
clap = { version = "4.5.2", features = ["derive"], optional = true }
crossterm = "0.27.0"
indexmap = { version = "2.2.5", features = ["serde"] }
Expand All @@ -42,7 +42,7 @@ regex = "1"
# Query system
serde_regex = "1.1.0"
# WebSocket clients using tokio
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-native-roots"] }
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
# Used for U256
primitive-types = { version = "0.12.2", features = ["serde"] }

Expand Down

0 comments on commit 3724018

Please sign in to comment.