how does bitcoin core generate addresses and where can they be found in the data directory?
1 Answer
Bitcoin addresses can be created anywhere with any programming language. they're just like the result of 1 + 1 = 2.
if you are looking for the function they're using for getting a new address here you go: https://github.com/bitcoin/bitcoin/blob/4ad3b3c72c73d61e0a0cab541dca20acf651320d/src/wallet/rpcwallet.cpp#L135
When you make RPC call 'getnewaddress' that function will be called, and addresses keys are already generated (keypool
) and saved into wallet.dat
file.