<p>A transaction is confirmed by including it in a block. This means that you have to mine a block which includes the transaction. You can do this using the <code>generate</code> command.</p>

CC BY-SA 4.0
2018-08-27T13:31:49.353Z
could you give me an example?
Ben
CC BY-SA 4.0
2018-08-27T13:35:55.003Z
`cash-cli -regtest generate 6` will create 6 blocks with the block reward going to your wallet.
Ava Chow
CC BY-SA 4.0
2019-09-19T03:42:34.660Z
I create and send raw transaction then use `generatetoaddress` to mine blocks to get confirmations but the sent transactions stays unconfirmed. Any idea why?
Fontaine
CC BY-SA 4.0
2019-12-10T06:14:43.400Z
@Fontaine did you ever find out what your problem was? I have the same, currently.
schlingel
CC BY-SA 4.0
2020-10-21T20:57:14.610Z
Any news on this? I'm facing the same situation.
Daniel Portugal
CC BY-SA 4.0
2018-08-27T13:26:04.143Z
2018-08-27T13:26:04.143Z
Ava Chow
<p>I'm running <code>bitcoind</code> along with Bitcore-node and I was having the same problem. I sent 250 transactions to myself, but the balance I got from BWC/BWS was:</p>
<pre><code>{
  &quot;totalAmount&quot;: 166250000000,
  &quot;lockedAmount&quot;: 0,
  &quot;totalConfirmedAmount&quot;: 0,
  &quot;lockedConfirmedAmount&quot;: 0,
  &quot;availableAmount&quot;: 166250000000,
  &quot;availableConfirmedAmount&quot;: 0,
  &quot;byAddress&quot;: [
    {
      &quot;address&quot;: &quot;mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb&quot;,
      &quot;path&quot;: &quot;m/0/0&quot;,
      &quot;amount&quot;: 166250000000
    }
  ]
}
</code></pre>
<p>Apparently, <code>bitcoind</code> will hold a cache in memory and it takes some time (or more actions) to release it, passing its contents to the database.</p>
<p>When you close the process (say, with CTRL+C or CMD+C), you'll see a message like this:</p>
<pre><code>2020-10-22T12:23:57Z FlushStateToDisk: write coins cache to disk (250 coins, 34kB) started 
2020-10-22T12:23:57Z FlushStateToDisk: write coins cache to disk (250 coins, 34kB) completed (0.05s)
</code></pre>
<p>Then, Bitcore-node will sync and save everything in MongoDb. So, if you close the
<code>bitcoind</code> process and then restart, your transactions should become confirmed.</p>
<p>Here's exactly what I did:</p>
<ol>
<li><p>Start <code>bitcoind</code> in regtest mode:<br />
<code>bitcoind -printtoconsole -regtest -fallbackfee=0.00001</code></p>
</li>
<li><p>Start Bitcore-node. I assume you have it configured to point to your regtest node.<br />
<code>npm run node</code></p>
</li>
<li><p>Generate 250 transactions to myself:<br />
<code>bitcoin-cli -regtest generatetoaddress 250 &quot;mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb&quot;</code></p>
</li>
<li><p>Wait for Bitcore to sync with <code>bitcoind</code>.</p>
</li>
<li><p>Close <code>bitcoind</code> with CTRL+C (or CMD+C).</p>
</li>
<li><p>Close Bitcore-node with CTRL+C (or CMD+C).</p>
</li>
<li><p>Restart <code>bitcoind</code> and Bitcore-node.</p>
</li>
<li><p>Boom. Using BWC and BWS to fetch the wallet's balance I now receive this:</p>
</li>
</ol>
<pre><code>{
 &quot;totalAmount&quot;:166250000000,
 &quot;lockedAmount&quot;:0,
 &quot;totalConfirmedAmount&quot;:166250000000,
 &quot;lockedConfirmedAmount&quot;:0,
 &quot;availableAmount&quot;:166250000000,
 &quot;availableConfirmedAmount&quot;:166250000000,
 &quot;byAddress&quot;:[
  {
   &quot;address&quot;:&quot;mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb&quot;,
   &quot;path&quot;:&quot;m/0/0&quot;,
   &quot;amount&quot;:166250000000
  }
 ]
}
</code></pre>

CC BY-SA 4.0
2020-10-22T12:51:11.720Z
2020-10-22T12:51:11.720Z
Daniel Portugal
<p>I'm testing some wallet features on regtest. Here's the sequence so far:</p>

<pre><code>cash-cli -regtest generate 101
cash-cli -regtest getbalance
500.00000000

cash-cli -regtest getnewaddress newAddress1
yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX

cash-cli -regtest  sendtoaddress getrawtransaction 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 1
//...
{
      "value": 2.00000000,
      "valueSat": 200000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c3bc1c481a15343ceb27d45d950c8770b7a0be1c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c3bc1c481a15343ceb27d45d950c8770b7a0be1c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX"
        ]
      }
    }, 
//...

dash-cli -regtest gettxout 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 0 false
//returns nothing as the transaction is not confirmed. Returns result if we change flag to true
</code></pre>

<p>How do I set transaction as confirmed in regtest mode so that <code>dash-cli -regtest &lt;txid&gt; &lt;outid&gt; false</code> would return the transaction output as a valid one? </p>

<client><bitcoin-cli><regtest><dash><transaction-id>
Confirm transaction in regtest mode
Ben
# Confirm transaction in regtest mode

(Asked by: username_0 on 2018-08-27)

I'm testing some wallet features on regtest. Here's the sequence so far:

```
cash-cli -regtest generate 101
cash-cli -regtest getbalance
500.00000000

cash-cli -regtest getnewaddress newAddress1
yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX

cash-cli -regtest  sendtoaddress getrawtransaction 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 1
//...
{
      "value": 2.00000000,
      "valueSat": 200000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c3bc1c481a15343ceb27d45d950c8770b7a0be1c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c3bc1c481a15343ceb27d45d950c8770b7a0be1c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "yeAPxkjsNk5RZnAyfHM6cjCtKM7oRUvhzX"
        ]
      }
    }, 
//...

dash-cli -regtest gettxout 148b8ced78037cb8fe3b32b8814dbf6736c144448671a86da548bbdb5670750a 0 false
//returns nothing as the transaction is not confirmed. Returns result if we change flag to true

```

How do I set transaction as confirmed in regtest mode so that `dash-cli -regtest <txid> <outid> false` would return the transaction output as a valid one?

**Tags:** client, bitcoin-cli, regtest, dash, transaction-id


---

## 2 answers

### Answer by username_1 on 2018-08-27. Score: 1 | Accepted answer

A transaction is confirmed by including it in a block. This means that you have to mine a block which includes the transaction. You can do this using the `generate` command.

> **Comments:**
> **username_0**: could you give me an example?  
> **username_1**: `cash-cli -regtest generate 6` will create 6 blocks with the block reward going to your wallet.  
> **username_2**: I create and send raw transaction then use `generatetoaddress` to mine blocks to get confirmations but the sent transactions stays unconfirmed. Any idea why?  
> **username_3**: @username_2 did you ever find out what your problem was? I have the same, currently.  
> **username_4**: Any news on this? I'm facing the same situation.  

---

### Answer by username_4 on 2020-10-22. Score: 0

I'm running `bitcoind` along with Bitcore-node and I was having the same problem. I sent 250 transactions to myself, but the balance I got from BWC/BWS was:

```
{
  "totalAmount": 166250000000,
  "lockedAmount": 0,
  "totalConfirmedAmount": 0,
  "lockedConfirmedAmount": 0,
  "availableAmount": 166250000000,
  "availableConfirmedAmount": 0,
  "byAddress": [
    {
      "address": "mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb",
      "path": "m/0/0",
      "amount": 166250000000
    }
  ]
}

```

Apparently, `bitcoind` will hold a cache in memory and it takes some time (or more actions) to release it, passing its contents to the database.

When you close the process (say, with CTRL+C or CMD+C), you'll see a message like this:

```
2020-10-22T12:23:57Z FlushStateToDisk: write coins cache to disk (250 coins, 34kB) started 
2020-10-22T12:23:57Z FlushStateToDisk: write coins cache to disk (250 coins, 34kB) completed (0.05s)

```

Then, Bitcore-node will sync and save everything in MongoDb. So, if you close the
`bitcoind` process and then restart, your transactions should become confirmed.

Here's exactly what I did:

1. Start `bitcoind` in regtest mode:  
   `bitcoind -printtoconsole -regtest -fallbackfee=0.00001`
2. Start Bitcore-node. I assume you have it configured to point to your regtest node.  
   `npm run node`
3. Generate 250 transactions to myself:  
   `bitcoin-cli -regtest generatetoaddress 250 "mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb"`
4. Wait for Bitcore to sync with `bitcoind`.
5. Close `bitcoind` with CTRL+C (or CMD+C).
6. Close Bitcore-node with CTRL+C (or CMD+C).
7. Restart `bitcoind` and Bitcore-node.
8. Boom. Using BWC and BWS to fetch the wallet's balance I now receive this:

```
{
 "totalAmount":166250000000,
 "lockedAmount":0,
 "totalConfirmedAmount":166250000000,
 "lockedConfirmedAmount":0,
 "availableAmount":166250000000,
 "availableConfirmedAmount":166250000000,
 "byAddress":[
  {
   "address":"mvaTRJ63NJrZ3qaZW1AbfVzMsei5HCiupb",
   "path":"m/0/0",
   "amount":166250000000
  }
 ]
}

```


---

