<p>Your question contains many misconceptions.</p>

<p>Yes, it is perfectly fine and safe to generate private keys and their corresponding addresses completely offline and not connected to the internet. In fact, people recommend that you do this because it is safer than doing it online.</p>

<p>There is no central database (Bitcoin is decentralized) where you must register a private key and address. That is not how Bitcoin works, and there is no need to do this. You don't have to send your address or private key to someone else or register it with the blockchain. In fact, if your private key is sent to someone else, then that person can steal all of your Bitcoin.</p>

<p>If some site or software must be online to generate keys and it is sending the keys to the site owner, then DON'T USE THAT SITE. The owner is trying to scam you and steal your private keys, which means they can steal all of your Bitcoin.</p>

<p>Private keys can be safely generated offline because of mathematics. A private key is really just a very large number. The cryptography that Bitcoin uses defines a private key to be any integer between 0 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141, that's a lot of private keys. Any integer in that range is a valid private key. So Bitcoin Core and other key generation software will just generate a random number that is within that range. Because the range is so large, and because (in theory) good random number generators are being used, the probability that a private keys that you generate were also generated by someone else is so small that it is, for all intents and purposes, 0.</p>

<p>So any software where you can import that private key will recognize it as being valid and correct so long as the private key is within that range. From there, the public key can be computed, and from that, addresses.</p>

<p>You don't need to be online and register any addresses you create either. That is because the blockchain does not actually use addresses. It does not need to be able to find your address either. On a low level, the blockchain uses transaction outputs. When you create a transaction, it spends transaction outputs from other transactions, and creates new transaction outputs. These outputs are composed of two parts - the amount, and a spending condition.</p>

<p>Addresses are just a human readable way to represent the spending condition. When you send Bitcoin to an address, what you are actually doing is telling your wallet software what the spending condition for one of the outputs should be, so it will create a transaction with an output with the appropriate value and spending condition.</p>

<p>With most addresses (the kind that are associated to a private key), the address contains the hash of a public key. That private key for that public key is held by the person who gave you that address. When that person spends the Bitcoin you sent them, they consume the output you sent them and provide the public key and a digital signature. So the spending condition is that the spender must provide the public key whose hash matches the hash specified in the output, and a valid digital signature created using the private key corresponding to that public key.</p>

<p>So, addresses are not really identifiers or accounts that the blockchain needs to lookup, rather they are just a human readable way to specify the spending conditions for outputs. Thus there is no need to register addresses with anything. Furthermore, the blockchain doesn't even care what the spending conditions are. They could be completely invalid. The spending conditions are really just a blob of data and they are not checked in any way when a transaction is created. The spending conditions are only checked when the output is spent.</p>

CC BY-SA 4.0
2019-08-24T17:00:23.570Z
thank you very very very much for the answer, when i said to cash the money out, i meant that when its time to cash out for example i will integrate the Address and Private key to blockchain.com for example and spend from it, to make sure i dont make any syntax fault while trying to do it from the bitcoin-cli and lose my coins, for example like the guy who owned 9,000 BTC and spend 1 BTC, and forgot to put an address for the rest 8,999 BTC and he lost this huge amount.
BTC involver
CC BY-SA 4.0
2019-08-24T18:04:37.807Z
now in my head
after having the bitcoincore wallet
1- encrypt wallet
2- create addresses
3- take the private key of the addresses
4- dumpwallet
5- backup wallet
destory the disk and remain only with the created addresses and the private keys of it. is that all what i'll need in the future to make sure i'll access the address and control the funds of it correctly from any wallets out of bitcoincore? based on the previous reply that starts with thank you very very very much.
BTC involver
CC BY-SA 4.0
2019-08-24T18:42:17.313Z
Yes, you only need the private keys. You don't even need the addresses as they are derived directly from the private keys, but you should hold onto those anyways. All you need are the private keys to be able to spend the funds in the future.
Ava Chow
CC BY-SA 4.0
2019-08-24T20:10:31.143Z
thank you very much again for replying. And also thank you for fixing my English in the main topic i'll work hard to improve it, i wish you a happy day.
BTC involver
CC BY-SA 4.0
2019-08-24T16:30:35.110Z
2019-08-24T16:30:35.110Z
Ava Chow
<p>Following up from my <a href="https://bitcoin.stackexchange.com/questions/89911/bitcoind-and-bitcoin-cli-and-bitcoin-qt/89914">previous question</a>, I still have some questions left.</p>

<p>Does it really work if I turn off the internet before doing <code>getnewaddress</code>? Will it really give me something real and can get the private key while the  offline? </p>

<p>Because for example, bitaddress provides a fake address and private key key if I use it offline when it fails to send the private key to the website owner's database. </p>

<p>Do you think that Bitcoin Core will work offline ? If so will the info be real 100% and valid, or may find out i got fuc**d up after trying to use the address in years to get the btc i sent to it?</p>

<p>As i wish to keep it offline even before the first use, or better to create the <code>getnewaddress</code> and its private key while connected to the internet? Also if it is fine to do generate the address offline, how the blockchain will locate it when i send funds to it while it never been online before?</p>

<p>Also how can I import the address later on any other service? How does it know that the private key I wrote is the real private key of the address? Isn't it strange if there's no big database online for the addresses and private keys?</p>

<bitcoin-core><bitcoind><bitcoin-cli>
bitcoincore additional questions
BTC involver
# bitcoincore additional questions

(Asked by: username_0 on 2019-08-24)

Following up from my [previous question](https://bitcoin.stackexchange.com/questions/89911/bitcoind-and-bitcoin-cli-and-bitcoin-qt/89914), I still have some questions left.

Does it really work if I turn off the internet before doing `getnewaddress`? Will it really give me something real and can get the private key while the offline?

Because for example, bitaddress provides a fake address and private key key if I use it offline when it fails to send the private key to the website owner's database.

Do you think that Bitcoin Core will work offline ? If so will the info be real 100% and valid, or may find out i got fuc\*\*d up after trying to use the address in years to get the btc i sent to it?

As i wish to keep it offline even before the first use, or better to create the `getnewaddress` and its private key while connected to the internet? Also if it is fine to do generate the address offline, how the blockchain will locate it when i send funds to it while it never been online before?

Also how can I import the address later on any other service? How does it know that the private key I wrote is the real private key of the address? Isn't it strange if there's no big database online for the addresses and private keys?

**Tags:** bitcoin-core, bitcoind, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2019-08-24. Score: 2 | Accepted answer

Your question contains many misconceptions.

Yes, it is perfectly fine and safe to generate private keys and their corresponding addresses completely offline and not connected to the internet. In fact, people recommend that you do this because it is safer than doing it online.

There is no central database (Bitcoin is decentralized) where you must register a private key and address. That is not how Bitcoin works, and there is no need to do this. You don't have to send your address or private key to someone else or register it with the blockchain. In fact, if your private key is sent to someone else, then that person can steal all of your Bitcoin.

If some site or software must be online to generate keys and it is sending the keys to the site owner, then DON'T USE THAT SITE. The owner is trying to scam you and steal your private keys, which means they can steal all of your Bitcoin.

Private keys can be safely generated offline because of mathematics. A private key is really just a very large number. The cryptography that Bitcoin uses defines a private key to be any integer between 0 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141, that's a lot of private keys. Any integer in that range is a valid private key. So Bitcoin Core and other key generation software will just generate a random number that is within that range. Because the range is so large, and because (in theory) good random number generators are being used, the probability that a private keys that you generate were also generated by someone else is so small that it is, for all intents and purposes, 0.

So any software where you can import that private key will recognize it as being valid and correct so long as the private key is within that range. From there, the public key can be computed, and from that, addresses.

You don't need to be online and register any addresses you create either. That is because the blockchain does not actually use addresses. It does not need to be able to find your address either. On a low level, the blockchain uses transaction outputs. When you create a transaction, it spends transaction outputs from other transactions, and creates new transaction outputs. These outputs are composed of two parts - the amount, and a spending condition.

Addresses are just a human readable way to represent the spending condition. When you send Bitcoin to an address, what you are actually doing is telling your wallet software what the spending condition for one of the outputs should be, so it will create a transaction with an output with the appropriate value and spending condition.

With most addresses (the kind that are associated to a private key), the address contains the hash of a public key. That private key for that public key is held by the person who gave you that address. When that person spends the Bitcoin you sent them, they consume the output you sent them and provide the public key and a digital signature. So the spending condition is that the spender must provide the public key whose hash matches the hash specified in the output, and a valid digital signature created using the private key corresponding to that public key.

So, addresses are not really identifiers or accounts that the blockchain needs to lookup, rather they are just a human readable way to specify the spending conditions for outputs. Thus there is no need to register addresses with anything. Furthermore, the blockchain doesn't even care what the spending conditions are. They could be completely invalid. The spending conditions are really just a blob of data and they are not checked in any way when a transaction is created. The spending conditions are only checked when the output is spent.

> **Comments:**
> **username_0**: thank you very very very much for the answer, when i said to cash the money out, i meant that when its time to cash out for example i will integrate the Address and Private key to blockchain.com for example and spend from it, to make sure i dont make any syntax fault while trying to do it from the bitcoin-cli and lose my coins, for example like the guy who owned 9,000 BTC and spend 1 BTC, and forgot to put an address for the rest 8,999 BTC and he lost this huge amount.  
> **username_0**: now in my head after having the bitcoincore wallet 1- encrypt wallet 2- create addresses 3- take the private key of the addresses 4- dumpwallet 5- backup wallet destory the disk and remain only with the created addresses and the private keys of it. is that all what i'll need in the future to make sure i'll access the address and control the funds of it correctly from any wallets out of bitcoincore? based on the previous reply that starts with thank you very very very much.  
> **username_1**: Yes, you only need the private keys. You don't even need the addresses as they are derived directly from the private keys, but you should hold onto those anyways. All you need are the private keys to be able to spend the funds in the future.  
> **username_0**: thank you very much again for replying. And also thank you for fixing my English in the main topic i'll work hard to improve it, i wish you a happy day.  

---

