Bitcoin does not work like the Euro, the Dollar or the British Pound, it is a virtual cryptocurrency. Bitcoin is a virtual currency unit that does not depend on any authority or financial institution. No centralized organization therefore regulates cryptocurrency.And concretely?In the world of computers, the idea of ??the safe is not that of a heavy object that is difficult to transport even if we had managed to access it:1) It’s a file instead of an object, that is, it’s a sequence of 1’s and 0’s.2) This file is public, in the sense that everyone has access to it and the owner is aware of it.The idea is to encrypt this file, that is to say to make it incomprehensible to those who do not have the private key, which will help to decipher it.As you may have already understood, these two operations correspond to the two actions of the safe:1) Encrypt (then send) corresponds to file a file2) Decrypt is to recover a file.
This system is called asymmetric cryptography, because the private key and the public key do not play the same role (in the sense that one is public and the other is private). However, it is also possible to encrypt a message with the private key and decrypt it with the public key. The advantage of doing this is not in the privacy of the message (anyone can read it, since the public key is public), but in the guarantee that it brings that the message was indeed written by Alice . Private KeyA private key is a random string of 256 bits (which can be represented in several forms, in hexadecimal for example it is composed of 64 characters from 0 to 9 and from A to F).
Generally it is represented in its base58 form, ie composed of 51 characters and always starting with the number 5.Here is a private key as it is usually represented (base58):5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEuEZZRcgSqbThe private key is stored in your bitcoin wallet and unless you make the effort to get it and export it is usually invisible to the user. When you transfer bitcoins, the network will ask you to prove that you have the right to do so and for that, it will ask you to generate a signature that only the holder of the private key is able to do. From your private key, your wallet software will generate this signature and present it, along with the transfer order, to the network.Public KeyThe public key (not to be confused with a Bitcoin address) is a 256-bit string, calculated from the private key using the Secp256k1 curve.
Thanks to the mathematical relation between the private key and the public key, it is possible to check a signature created with the private key. While it is easy and quick to calculate the public key when you have the private key, the opposite is impossible with the current computer.When your wallet completes a transaction, it includes the public key in each signature. The network nodes can then use this public key to verify the signature.Bitcoin AddressA bitcoin address is a SHA-256 hash of a RIPEMD-160 hash encoded in base58check of a public key.
A hash is a mathematical function to create a digest of a data in a constant but irreversible format. If you have a public key and you calculate the RIPEMD-160 hash of this value, you will always get the same 160 characters in the same order. However if you have the 160 characters you will not be able to find the public key.
This is why when we only have a bitcoin address it is impossible to find the public key, but if we have the public key it is very easy to calculate the bitcoin address.When you receive bitcoins for the first time with an address, the RIPEMD-160 hash of that address is encoded in the transaction (and permanently stored in the blockchain). Nobody has access to private or public keys other than you. Once you spend a bitcoin, the public key is passed to validate the transaction and is also permanently stored in the blockchain.
After that, everyone can have access to the public key and the bitcoin address, but the private key remains it always secret.How is all this used in Bitcoin?When you create a Bitcoin account, for example when you use for the first time one of the many Bitcoin wallet software (such as the Bitcoin, Electrum, Mycelium, Blockchain.info client), the software starts by creating a private / key pair. public key.Your private key has control of your funds, so it’s about as confidential as your credit card and code, and even worse: it would take a few milliseconds for someone well organized to steal all of your funds once that key in his hands (while blue cards usually have a cap). So never, never, never give your private key to a site, or you send it by mail, or even leave it unencrypted on a computer connected to the Internet.Your address is obtained as a hash of your public key, which calculates itself from your private key.
It is your Bitcoin address, or more exactly a Bitcoin address (you can have as many as you want), the one that people will use to send you bitcoins.When you make a transaction, you must sign the funds that you use, which are in fact nothing other than the “exits” of previous transactions that were sent to you. This ensures that no one but you can spend your money.How to secure my Bitcoin account?One of the best known ways to store its Bitcoins safe from theft is “cold storage” .The idea is to place a single copy of your private key in a safe place, for example on a paper that you put in a safe (physical, this time), or on a computer that never connects to the Internet. As this requires dedicating a complete computer and is not immune to a hard drive failure, people generally choose paperAbout which there will be an elaborate write up in the coming days.Stay tuned!