How to use BitCoin private keys (a primer) I am learning about BitCoin private keys and trying to figure out what the best way to use them are. I get their purpose and that they need a strong password, etc. But what I don't understand in particular is how they relate to transactions and wallets.

I just ran bitcoin-cli importprivkey &lt;key&gt; (which has been running for like 5 minutes, who knows how long this will take, and I am brand new). I am actually not sure what the point is for adding the key to the wallet. Does it somehow relate to transactions? Why do I need to add a private key to my wallet? Can/should I add more than one to a wallet? Or, oh! I think I remember, the wallet key is just for storing your private keys. But why don't I just store it myself in a different way? What advantage does having it stored in a wallet offer?

Then the second part of the question is, what key I should be signing my transactions with, and how. Can I say "wallet, give me a key by name" or something?

Final part of the question is, how many keys I should have. Should I just have 1 key for everything? 2 just to switch it up every now and then? 10 or 100 or 1000? A new key for every transaction? I don't know, what is the ideal here? Is it best to use some keys for one thing, and others for another?
But what I don't understand in particular is how they relate to transactions and wallets.


This requires a long answer. Here's a nice intro which should answer this.


  I am actually not sure what the point is for adding the key to the wallet. Does it somehow relate to transactions? Why do I need to add a private key to my wallet? 


If you read the above intro to cryptography in Bitcoin, this question is almost fully answered. You need a private key because that's the secret half you use to sign transactions. Otherwise  people could spend your Bitcoins.


  Can/should I add more than one to a wallet? Or, oh! I think I remember, the wallet key is just for storing your private keys. But why don't I just store it myself in a different way? What advantage does having it stored in a wallet offer?


Yes you should create many. In fact, one private key for each transaction is ideal. You can store these keys anywhere you want, but a wallet program will do many nice things for you. The wallet keeps track of how much Bitcoin you have, it gives you an easy way to sign TX's and send them to the network, it groups all your received transactions and allows you to combine their amounts to form new transactions and so on. A profesionally developed wallet will also normally employ good security practices. But nothing's stopping you from rolling your own key store.


  Then the second part of the question is, what key I should be signing my transactions with, and how. Can I say "wallet, give me a key by name" or something?


Bitcoin Core and other wallets offer a database management system to manage your keys for you. Yes you can usually give them mnemonic names or start typing a prefix and the wallet software suggests the rest. You should sign your TX's with a key you've never used before. That's the general rule.


  Final part of the question is, how many keys I should have.


One key per transaction. Never reuse keys.