bitcoin core – How does bitcoind choose its data directory?

Sorry, noob question I'm new to everything about Linux. I managed to configure the Bitcoin core very well on my Raspberry Pi 4 and I have an external hard drive that I want to use as a data directory for the 250 GB or more of blocks (this is not is not my main storage from which I boot).

The problem is that I have absolutely no idea how the bitcoind program decides its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which on the hard drive. How can I tell him where to store the data? Also, where should I put the bitcoin.conf file because it never seems to find it. I have most of the blockchain preinstalled on my hard drive from my Windows PC and therefore I would ideally use this same directory, but if that is not possible, that’s fine , I want it at least on my hard drive. I have followed several guides and nothing has worked for me so far. I appreciate your time for all the answers!

c # – ASP.NET Core website architecture with mobile app

I plan to develop a large-scale website that will have mobile apps in the future (both for Android and iPhone). I haven't done a lot of web development (I'm still in school, but I'm going to graduate soon), but I'm planning to use ASP.NET (MVC or Razor pages and side Blazor customer). However, I do not know what is the best industry approach to the architecture of this application. Here are the options I am considering:

  • Use own architecture to implement the entire application
  • Develop a main ASP.NET REST API
  • Website and mobile apps will access and modify REST API data

However, I am not very sure if this approach could evolve, and especially if it is the best way to do it. Although I know my questions are very broad to ask, could you please share your experience on how I could achieve my goals? More precisely:

  • What is the most appropriate architecture used in the real world that I should use?
  • There are many approaches for developing mobile applications (native java and swift, many Javascript frameworks, xamarin vs native xamarin forms, etc.). Would you like to suggest, based on your experience, which approach is right for me? Suppose I have no experience but that I am willing and able to learn any technology.
  • Any other suggestion (for example, web resources, books, and blog posts) is welcome. Suppose I am willing (and I have the illusion that I am capable) to learn any technology in due course.

bitcoin core – Python Pycoin pycoin.encoding.EncodingError: bad character 123 in the string

I am working on a project using the blockchain in which one of its dependencies is Pycoin. I have to pass the PrivateKey from my Bitcoin testnet wallet for the transaction but this gives an error as below:

File "/Users/abdul/PycharmProjects/BCT/venv/lib/python3.6/site-packages/pycoin/encoding.py", line 79, in to_long
    raise EncodingError("bad character %s in string %s" % (c, s))
pycoin.encoding.EncodingError: bad character 123 in string b'{"iv":"b226hTeeOF3l5qflGzHbaw==","v":1,"iter":10000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"vqA3WtB/5N0=","ct":"PRIVATE_KEY"}'

I exported my private key from the BitPay wallet on mac os and added that it was in JSON format. What can be wrong here?

Bitcoin core – Segwit with Multisig

I was analyzing a Bitcoin transaction that works with both Segwit and non-Segwit for multisig scripts.
Here is the transaction: https://www.blockchain.com/en/btc/tx/80975cddebaa93aa21a6477c0d050685d6820fa1068a2731db0f39b535cbd369

Note that on indexes 0, 1 and 2, we have the unlock script in the scriptsig file and on index 3, it uses the witness program. No problem so far.

What bothers me is why when I get the redemption script from indexes 0, 1 and 2 and run ripemd60, sha256, create a checksum and encode base58 , it generates the public address as we can see on the blockchain.com screen. But when I do the same thing using the redemption script found in the witness section, it gives me a completely different address, why is this happening?

Also, what is the scriptSig on index 3? How is it generated?

Example:

Redeem script from index 0:

522102194e1b5671daff4edc82ce01589e7179a874f63d6e5157fa0def116acd2c3a522103a043861e123bc67ddcfcd887b167e7ff9d00702d1466524157cf3b28c7aca71b2102a49a62a9470a31ee51824f0ee859b0534a4f555c0e2d7a9d9915d6986bfc200453ae

The address generated from index 0 using my script:

3JUJgXbB1WpDEJprE8wP8vEXtba36dAYbk

It is the same as the transaction.

Use the index 3 script (Segwit):

5221021e6617e06bb90f621c3800e8c37ab081a445ae5527f6c5f68a022e7133f9b5fe2103bea1a8ce6369435bb74ff1584a136a7efeebfe4bc320b4d59113c92acd869f38210280631b27700baf7d472483fadfe1c4a7340a458f28bf6bae5d3234312d684c6553ae

The address generated from index 3 using my script:

36aKiVksQRLKwByBYVz3KwquFcvHZkwroP

Address of the transaction retrieved from blockchain.com

3CYkk3x1XUvdXCdHtRFdjMjp17PuJ8eR8z

Bitcoin core – how to use bitcoid "walletnotify" for single transactions only

using bitcoind "walletnotify", my curl command gets 3 hits generating 3 unique transaction hashes but the requirement is to execute only once for single transactions.
I heard about walletnotifynew: – "https://www.multichain.com/qa/9566/how-can-i-use-walletnotify-command-to-get-notification"
but it does not work.

My bitcon.config file

rpcuser=root
rpcpassword=root
testnet=1
test.rpcport=8332
rpcallowip=127.0.0.1
server=1
rpcbind=127.0.0.1
walletnotifynew=/home/scripts/transaction.sh %s
#walletnotify=curl -d "txid=$1" http://127.0.0.1:8888/api/v1/listen-transaction %s  

The database entry I was transferring with the same wallet was always three inbound, but there should only be one outbound entry

select * from transaction;
+-------+--------------+------------+-------------------------------------+-------------------------------------+---------+------------------------------------------------------------------+----------+--------+
| tx_id | amount       | made_on    | sent_from_address                   | sent_to_address                     | success | transaction_hash                                                 | tx_type  | userid |
+-------+--------------+------------+-------------------------------------+-------------------------------------+---------+------------------------------------------------------------------+----------+--------+
|    53 | 0.0000000000 | 2020-02-17 | NULL                                | 2NFgnEMcE4kvvCLXK6uiEgb3dZuVLGUK75v |       1 | 11acce71f3d10330e10d70f5ee974abe5d216ec188309b61d1f751a1615d439d | INCOMING |   NULL |
|    52 | 0.0000000000 | 2020-02-17 | NULL                                | 2NFgnEMcE4kvvCLXK6uiEgb3dZuVLGUK75v |       1 | bc3267ffcc44b8d526cbb1de19f653bc90aedda4dc4fc2fc9ab18a954e7347c1 | INCOMING |   NULL |
|    50 | 0.0001000000 | 2020-02-17 | 2N6MqukeqDftwXsVDBSBkDrnbvzaXoNwNhi | 2NFgnEMcE4kvvCLXK6uiEgb3dZuVLGUK75v |       1 | 9bb2ab339930a68f33ce3521bee46363cbd29a87c68b718c4ae415a3ba53b7b8 | OUTGOING |      1 |
|    51 | 0.0000000000 | 2020-02-17 | NULL                                | 2NFgnEMcE4kvvCLXK6uiEgb3dZuVLGUK75v |       1 | 2e0976cd310fe1d740227cec0ae615dae668d4efeea740e51b81cb1b89dd2a47 | INCOMING |   NULL |
+-------+--------------+------------+-------------------------------------+-------------------------------------+---------+------------------------------------------------------------------+----------+--------+


bitcoind – Is it possible to manage BCH transactions on the Bitcoin Core wallet?

I installed Bitcoin core on a server and it works well for BTC. I would like to know if I can use the same server and the same platform to support BCH also?
I know that the addresses generated in Bitcoin Core can also be used for BCH. But what if I can BCH transactions in this machine, how can i defer them from BTC those?

Thanks in advance for your answers.

Bitcoin core – Have the indexes generated by txindex = 1 persisted on the disk?

I am running bitcoind with the -txindex option.

$ bitcoind -txindex

it seems like it takes about a day to fully index the blockchain.
(I'm using a Raspberry Pi 4, 4 GB of Ram, with an external hard drive).

If I stop bitcoind and restart, will it reindex all transactions again or just load indexes from disk?

Bitcoin core – Does restoring wallet.dat require the same paths and configurations on the servers?

I have a main Bitcoin server (server 1) that works well. Now, I am testing the backup and restoration of his portfolio on a new server (Server 2).
Imagine that server 1 has these configurations:

blocksdir=/btc/blocks
datadir=/btc/data # wallet.dat file is here in  the wallets directory

Now I want to move the backup file (wallet.dat) to the new server whose default paths are like this:

~/.bitcoin/wallet.dat
~/.bitcoin/blocks
  1. Do i have to have the same paths on server 2 for The data and block as server 1? Or can I move the backup file to the default path of wallet.dat on server 2?
  2. Should I copy the download blockchain from server 1 and move them to server 2 as well?

Why are there equal send transactions for each reception on Bitcoin Core?

I ate a new main Bitcoin wallet and generated addresses using it. Then I tried to to receive some BTC at these addresses, then, discovered if I get BTC, there is equal to send transactions also on the same address.
All incoming BTCs are in my wallet and there is no problem so far. But I wonder what it is to send transactions? I pay them automatically!

This is an example:
https://www.blockchain.com/btc/address/3PiCVEFLHPiexXf15UB7nw9yBMZTWjP73C

Bitcoin core / Bitcoin cash

I have wanted to recover my Bitcoin Cash for many years. At the time, I was using Bitcoin Core and I saved my wallet. However, I can't find the wallet for the cash version of Bitcoin Core.

What's her name? Where is it found?

Thank you for your support!