>Tutorials>How to sign a message with your bitcoin address?
How to sign a message with your bitcoin address?
One of the most basic features of Bitcoin (and also the most useful) is the ability to sign and verify a message using the public and private keys of the Bitcoin addresses, something that we will teach you how to use in the next article.
UOne of the most interesting functions of Bitcoin, and perhaps less known to those starting out in the crypto world, is its ability to sign a message with your bitcoin address, and even securely encrypt and verify the authenticity of messages. A process that is possible thanks to the fact that Bitcoin uses asymmetric cryptography.
For example, it is possible for a person to sign a message with their bitcoin address, to show the world that the creator of a certain text is the person who owns the private key of a specific Bitcoin address. And it is not something unique to Bitcoin, many other cryptocurrencies have this ability, since their cryptographic fundamentals of public key / private are the same. All without exposing sensitive information.
But how can we do that from this function? Well, you will discover that in this interesting article, where we will show you how to perform this procedure.
Utility of signing messages using your Bitcoin address
However What is the real utility of signing messages using your Bitcoin address? As we discussed at the beginning, performing this procedure allows you to make public certain information that can be verified by anyone without major problems and with total security.
There are a wide variety of use cases where this feature can be useful. Here are some of those use cases:
Verification of origin of funds. For example, if we have decided to make a purchase using bitcoins from an address, but they ask us to verify that that address and funds are ours, then signing a message with that address solves the problem.
Be able to make payments to a specific address safely. For example, they send us a message, and we need to know that the message has not been intercepted and modified (ex: changing the address for payment). To do this, the full text would be signed (where the address to pay also appears) and we will add the digital signature. Thus, the recipient could take the message, the address and the signature and verify that everything is correct.
As a preliminary to the configuration of multi-sig or multi-signature purses. If a group of people have decided to create a multisig wallet, a preliminary step could be to verify that we indeed have control of the address that corresponds to us and for this we can sign a message using that address.
Be able to prove that you are the owner of an address. This is something that was asked of Craig Wright, because he shouts to the 4 winds that he is Satoshi Nakamoto, but he is not able to demonstrate that he has control over the directions attributed to Satoshi Nakamoto. Simply signing a message with any of the addresses could prove it. One more reason why he is known as a scammer.
At this point, it is clear that it is quite a useful function and that it can be adapted to the needs of whoever is going to use it and, with a little creativity, find new and revolutionary scenarios.
Tools to sign and verify messages using your Bitcoin address
However What do we need to be able to use this function? Well, the truth is that any Bitcoin wallet with the function "Sign and Verify Messages" allows you to use this function. Among the wallets with this capacity we can mention:
Bitcoin Core, the official Bitcoin software allows you to make use of this function perfectly.
Electrum Wallet, is another famous wallet that allows you to use this function without major complications.
Open source code libraries, such as bitcoinjs, to create your own programs and ideas.
Signing and Verifying Information Using Bitcoin Core
To know how to handle this function we have chosen to use as an example Bitcoin Core, the official Bitcoin software. The reason for this is that this is the most complete and secure Bitcoin wallet that exists at the moment, and using this option with this wallet is quite simple.
The first thing you should do is download and install the Bitcoin Core wallet on your computer. To do this, we recommend you go to the official website and download the version of Bitcoin Core for your operating system. Once the installation is complete, then we can start using the Verify and Sign messages options.
Sign a message using Bitcoin Core
To sign a message using Bitcoin Core, the first thing you will have to do is run the main program, which will leave you with an interface like this.
At that point, before starting, the first thing you should do is make a slight configuration of the wallet. This is necessary because at the moment the message signature is only supported using the legacy address (those addresses that start with "1"), waiting for the activation of the BIP-322 to enable message signing using all addresses supported by Bitcoin.
In this sense, the first thing you should do is go to the menu "Configuration" and click on "Options".
Once there, you must click on "Open Configuration file" and, once the file is open, you must include the following line:
addresstype = legacy
Save the configuration and restart the program for the changes to take effect. What this change does is order Bitcoin Core to use legacy addresses by default to generate our addresses, so we can use the message signature using Bitcoin Core without problems.
Now, after making these changes and restarting Bitcoin Core, the next thing will be to generate a new address to be our message signature base. This address is the one that will allow you to use the function of signing a message. To generate this address, you must go to the option "To receive" and click on the button "Create new address for reception".
Be very careful about modifying values in the Bitcoin Core configuration file. In this case, our recommendation is valid and recognized by the Bitcoin community and developers, but there may be cases where malicious people can instruct you to gain access to your wallet without realizing it. Always be careful, research what you do before doing it.
So our address to use for signing the message is 18FgxNdGSemUZNybpdrgdr1rbdRFbuAwL9
Now, to sign a message, the first thing you should do is go to the menu "Archive" and select "Sign message", thus the following new window will be displayed before you.
At this point, you must take the address already generated and place it in the field where the address is requested. Once this is done, you must write the message to sign, in our case the message is:
This is a proof of message signature using a Bitcoin address, for Bit2Me Academy.
Once these two points are made, you should have something like this:
To finish the signing process, you just have to click the button "Sign message", the result is displayed as follows.
The result is a digital signature that is the following:
As you can see, the process is quite simple, and it does not hide any greater difficulty than doing the few steps correctly.
Verify a message using Bitcoin Core
To verify a message using Bitcoin Core, the process is quite similar. First, you must go to the menu "Archive" and select "Verify message", with which the following window will appear.
At this point, to perform the verification you must copy the Bitcoin address that the message is attributed, in this case we will use the address from the previous example, which is: 18FgxNdGSemUZNybpdrgdr1rbdRFbuAwL9.
The second step is, take the original message and copy it in the following area:
This is a proof of message signature using a Bitcoin address, for Bit2Me Academy.
And finally we place the encoded and signed message that is attributed that address, which in our case is:
By placing all these texts, we will have the following:
To finish, we just have to press the button "Verify message" and so we can verify the authenticity of the message and that it has certainly been issued by whoever controls that address.
Security of this system
Surely you wonder if this system is really safe and cannot be broken in some way. If that is one of your concerns, you might like to know that you have nothing to worry about: this function is secure, in fact it is highly secure.
This is possible thanks to the fact that Bitcoin uses the digital signature algorithm ECDSA to perform all these operations, and for the moment, said algorithm next to the curve secp256k1, is considered highly safe. In short, the security of both Bitcoin and this function is protected by very powerful cryptography that has not been broken at the moment. To give you an idea of its security, you should know that this process is based on a superior security than almost anyone that you use in your day to day in some processes with online banking, messaging, telephony, ...
On the other hand, and as you can see, it is a really simple process, in fact, if you know encryption and decryption systems for messages such as PGP (or GPG) you will realize that it works using the same basis of principles.
The objective of all this is to provide you with a tool to send and verify information safely and without any kind of intermediary for it. As always, Bitcoin has been targeting decentralization from its inception and features like these only attest to that effort.