Skip to content

Commit

Permalink
readme: Remove RPC server info.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Sep 5, 2024
1 parent 535e942 commit 1eb9b6d
Showing 1 changed file with 6 additions and 45 deletions.
51 changes: 6 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# Bitcoin Mock Remote Procedure Call

Bitcoin-mock-rpc is a mock Bitcoin ledger with RPC interface but without a
wallet support. Meaning there are only checks for consensus details of an
operation. This library can be used to test Bitcoin applications, without
needing to set up Bitcoin and with a **sandboxed environment**, for each test.

Bitcoin-mock-rpc is built on
[bitcoincore-rpc's](https://github.com/rust-bitcoin/rust-bitcoincore-rpc)
`RpcApi` trait. Meaning no real servers are needed for Rust applications. There
is also an RPC server that can communicate with any application: No rust
dependencies!
`bitcoin-mock-rpc` is a mock Bitcoin ledger without a wallet support built on
`RpcApi` trait in
[bitcoincore-rpc](https://github.com/rust-bitcoin/rust-bitcoincore-rpc) library.
Meaning there are only checks for consensus details of an operation. This
library can be used to test Bitcoin applications, without needing to set up
Bitcoin and with a **sandboxed environment**, for each test.

This library is aimed to help the development of
[Clementine](https://github.com/chainwayxyz/clementine). Therefore, it's usage
Expand All @@ -33,41 +29,6 @@ than the real one, please check function comments in

## Usage

### RPC Server

RPC server can be spawned as long as there are available ports for them. Each
server will have an independent blockchain.

To run from CLI:

```bash
$ cargo run
Server started at 127.0.0.1:1024
# ^^^^^^^^^^^^^^
# Use this address in applications
$ cargo run -- --help # Prints usage information
```

To run in a Rust application:

```rust
#[test]
fn test() {
// Calling `spawn_rpc_server` in a different test while this test is running
// is OK and will spawn another blockchain. If parameters are the same
// however, they will operate on the same blockchain. Note: (None, None)
// will result to pick random values.
let address = bitcoin_mock_rpc::spawn_rpc_server(None, None).await.unwrap();

let rpc =
bitcoincore_rpc::Client::new(&address.to_string(), bitcoincore_rpc::Auth::None).unwrap();

// Use `bitcoincore_rpc` as is from now on. No code change is needed.
}
```

### `RpcApiWrapper` Trait For Rust Applications

`RpcApiWrapper` trait can be used to select between real and mock RPC:

```rust
Expand Down

0 comments on commit 1eb9b6d

Please sign in to comment.