<p>You can check bitcoind version using : <code>bitcoind --version</code></p>
<p>I have not tried this code but you can execute binary with some arguments using any language:</p>
<pre><code>std::process::Command;

fn main() {
    let bitcoind = Command::new(&quot;bitcoind&quot;)
                      .arg(&quot;version&quot;)
                      .output().unwrap();
    println!(&quot;Version: {}&quot;, String::from_utf8_lossy(&amp;bitcoind.stdout));
}
</code></pre>
<p>If the version is printed correctly you can compare it with some strings.</p>

CC BY-SA 4.0
2022-03-14T18:32:04.077Z
2022-03-14T18:32:04.077Z
AnonHelp
<p>I'm trying to write a code in Rust to sanity check if the bitcoind version of the local machine is upto date with the version that we are currently using in our organisation (say v22.0.0). We have a global variable: org_bitcoind_version = v22.0.0 ;</p>
<p>What could be the code for the required sanity checker function?</p>

CC BY-SA 4.0
2022-03-14T11:50:25.013Z
This is a "good first issue" from revaultd that the OP is tackling in the context of Summer Of Bitcoin (github.com/revault/revaultd/issues/324). @Gourab i guess it goes without saying that contributors to this site are not supposed to write the code you would eventually contribute to an open source project.
Antoine Poinsot
CC BY-SA 4.0
2022-03-14T13:05:07.603Z
Personal opinion but writing some code and then getting stuck on why it doesn't do what you want it to is fine to ask about on StackExchange (can't guarantee an answer of course). But definitely agree with Antoine that just asking people to write it for you is not a reasonable StackExchange question.
Michael Folkson
<bitcoind><bitcoin-core-development>
Check bitcoind version at startup in Rust
Gourab Chakraborty
# Check bitcoind version at startup in Rust

(Asked by: username_0 on 2022-03-13)

I'm trying to write a code in Rust to sanity check if the bitcoind version of the local machine is upto date with the version that we are currently using in our organisation (say v22.0.0). We have a global variable: org\_bitcoind\_version = v22.0.0 ;

What could be the code for the required sanity checker function?

**Tags:** bitcoind, bitcoin-core-development

> **Comments:**
> **username_1**: This is a "good first issue" from revaultd that the OP is tackling in the context of Summer Of Bitcoin (github.com/revault/revaultd/issues/324). @username_0 i guess it goes without saying that contributors to this site are not supposed to write the code you would eventually contribute to an open source project.  
> **username_2**: Personal opinion but writing some code and then getting stuck on why it doesn't do what you want it to is fine to ask about on StackExchange (can't guarantee an answer of course). But definitely agree with username_1 that just asking people to write it for you is not a reasonable StackExchange question.  

---

## 1 answers

### Answer by username_3 on 2022-03-14. Score: 0

You can check bitcoind version using : `bitcoind --version`

I have not tried this code but you can execute binary with some arguments using any language:

```
std::process::Command;

fn main() {
    let bitcoind = Command::new("bitcoind")
                      .arg("version")
                      .output().unwrap();
    println!("Version: {}", String::from_utf8_lossy(&bitcoind.stdout));
}

```

If the version is printed correctly you can compare it with some strings.


---

