Skip to content

Commit

Permalink
Merge branch 'master' into stan/31-ika-signature-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sczembor authored Dec 16, 2024
2 parents 7026e27 + db7c976 commit afd9643
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
67 changes: 67 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Run btcd simnet mode

## Install btcd and btcwallet

Follow the instruction in [btcd README.md](https://github.com/btcsuite/btcd?tab=readme-ov-file#installation)
and [btcwallet README](https://github.com/btcsuite/btcwallet?tab=readme-ov-file#installation-and-updating) to install btcd and btcwallet

## Run btcd with simnet mode

### Bootstrap the wallet and btc node

First you need to start the btcd in simnet mode

```bash
btcd --simnet --rpcuser=user --rpcpass=password
```

Create btc wallet. Please remember the password.

```bash
btcwallet --simnet --create
```

Connect you wallet to btcd simmode. The password and user here must be the btcd password/user pair.
Open a new terminal and run:

```bash
btcwallet --simnet -u=user -P=password
```

Create a new address. We will use it as the `--miningaddr` parameter - an address that receives btc when mining a new block.
Open a new terminal and run:

```bash
btcctl --simnet --wallet --rpcuser=user --rpcpass=password getnewaddress
```

Copy the address created by the command above. Shutdown the btcd service and run:

```bash
btcd --simnet --rpcuser=user --rpcpass=password --miningaddr=<address>
```

Right now, everytime we mine a new block, the minner address should receive some bitcoin.
We can use this for testing and development.

## Generate a new block

Generate 100 blocks

```bash
btcctl --simnet --wallet --rpcuser=user --rpcpass=password generate 100
```

## Check information

Blockchain information

```bash
btcctl --simnet --wallet --rpcuser=user --rpcpass=password getblockchaininfo
```

Miner balance

```bash
btcctl --simnet --wallet --rpcuser=user --rpcpass=password getbalance
```
32 changes: 32 additions & 0 deletions docs/Bitcoin_mock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Flow

The following diagram illustrates the flow of a transaction through the relayer and the database. This is one `Relayer`, but it interacts with three different networks (`Native`, `Ika` and `Bitcoin`)

```mermaid
flowchart TB
subgraph subGraph0["Relayer (Native network)"]
direction TB
B["Indexes transaction"]
A["User submits transaction"]
end
subgraph subGraph1["Relayer (Ika network)"]
E["Ika signs transaction"]
D["Sends to Ika for signing"]
end
subgraph subGraph2["Relayer (Bitcoin network)"]
H["Broadcasts Bitcoin transaction"]
G["Constructs Bitcoin transaction"]
I["Checks for confirmations"]
end
A --> B
B -- Stores transaction (Pending) --> Database["Database"]
Database -- Reads pending transaction --> D
D --> E
E -- Stores signed transaction --> Database
Database -- Reads signed transaction --> G
G --> H
H --> I
I -- Updates status to Confirmed --> Database
Database@{ shape: db}
```

0 comments on commit afd9643

Please sign in to comment.