I am trying to create bitcoin child addresses so that when money comes to them, this money is displayed on the main address. I seem to be able to create child addresses, but for some reason, when money comes to them, the balance of the main address does not change. I wanted to find out if there is an error in my code or if I misunderstood how child addresses work?
My code:
import bip32utils
from bitcoinlib.encoding import *
from bitcoinlib.wallets import *
from bitcoinlib.keys import *
from bitcoinlib.mnemonic import Mnemonic
from bitcoinlib.wallets import Wallet, wallet_delete
from data.config import SECRET_PHRASE_BTC
btc_seed = Mnemonic('english').to_seed(SECRET_PHRASE_BTC)
btc_root_key = bip32utils.BIP32Key.fromEntropy(btc_seed)
btc_root_address = btc_root_key.Address()
child_key = btc_root_key.ChildKey(0).ChildKey(0)
child_address = child_key.Address()
print(child_address)