I am completely new to bitcoin and by extension cryptocurrency, but I am slowly getting my head around certain things. My problem is I am currently doing an open book exam and I am free to use any resources available to me. One of the questions asked was "What is the address with the path m/0/2 for the following wallet: zpub6nQF4m3JT6hTkQ4o9Vc8LDMQx7nMkT5CsnPgVHnnrpF9JHeP6ioboEK2CXB34Xn6nzqcJnLPuMqQaKqBhwvZR7GJNvSeRUpDpCaVu3N3stz"? Is there a way to find this out or is this a trick question since from the hours of research I have done so far I have found that zpub and xpub keys are used to generate actual public addresses. Can you please point me in the right direction?
BIP 84 specifies how zpubs work. BIP 32 specifies how derivation paths work.
According to these BIPs, the zpub will be used as the master public key, and the CPK (Child Public Key) function should be applied to the zpub to yield the specific public key you desire.
BIP 84 specifies that zpubs are used to derive P2WPKH addresses, so the public key should be converted to a SegWit address (bc1...).
If you are familiar with Elixir, you can use this library, to which I've added bip32 support.
zpub = "zpub6nQF4m3JT6hTkQ4o9Vc8LDMQx7nMkT5CsnPgVHnnrpF9JHeP6ioboEK2CXB34Xn6nzqcJnLPuMqQaKqBhwvZR7GJNvSeRUpDpCaVu3N3stz"