Bitcoin Forum
May 02, 2024, 10:49:20 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to sign a message with php code  (Read 181 times)
itsmyfirstaccount (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 15, 2023, 11:05:30 PM
 #1

As following tips
1.when I want to sign a message, do I must have the private key?

2.any one can using just public key to sign a message?and pass verification?

3.is there any trusted site or tool for signing?

4.how to implement it by PHP?(code better)

Thanks a lot ,I pay $50 worth bitcoins for the best reply.
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
1714690160
Hero Member
*
Offline Offline

Posts: 1714690160

View Profile Personal Message (Offline)

Ignore
1714690160
Reply with quote  #2

1714690160
Report to moderator
Orpichukwu
Sr. Member
****
Online Online

Activity: 476
Merit: 306



View Profile
December 15, 2023, 11:09:21 PM
 #2

First, you don't need to pay anyone to get a quality reply.
 
Yes, without the private key or phrase that proves complete ownership of a wallet, you can't sign in to a message. You either need the private key to the wallet or the phrase.
 
Some bitcoin wallets have a sign-in message function built into them, so you don't need to use any third-party sites, which might end up compromising your wallet to sign in the message. Personally, I use Electrum and BlueWallet for my transactions and sign in with a few messages.

.
Duelbits
▄▄█▄▄░░▄▄█▄▄░░▄▄█▄▄
███░░░░███░░░░███
░░░░░░░░░░░░░
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░░░░███▄█░░░
░░██▌░░███░▀░░██▌
█░██░░███░░░██
█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀
.
REGIONAL
SPONSOR
███▀██▀███▀█▀▀▀▀██▀▀▀██
██░▀░██░█░███░▀██░███▄█
█▄███▄██▄████▄████▄▄▄██
██▀ ▀███▀▀░▀██▀▀▀██████
███▄███░▄▀██████▀█▀█▀▀█
████▀▀██▄▀█████▄█▀███▄█
███▄▄▄████████▄█▄▀█████
███▀▀▀████████████▄▀███
███▄░▄█▀▀▀██████▀▀▀▄███
███████▄██▄▌████▀▀█████
▀██▄█████▄█▄▄▄██▄████▀
▀▀██████████▄▄███▀▀
▀▀▀▀█▀▀▀▀
.
EUROPEAN
BETTING
PARTNER
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2955


Block halving is coming.


View Profile WWW
December 16, 2023, 12:00:27 AM
Last edit: December 16, 2023, 03:57:22 AM by BitMaxz
Merited by ABCbits (2)
 #3

As following tips
1.when I want to sign a message, do I must have the private key?
Without a private key you can't able to sign a message it is required when signing a message.

2.any one can using just public key to sign a message?and pass verification?
No, you can't sign a message with the public key, the private key is required because it proves that you own that wallet or that public key.


3.is there any trusted site or tool for signing?
I do not recommend any web tools to sign a message it's risky I recommend use Electrum Wallet instead.

4.how to implement it by PHP?(code better)

I don't have much knowledge in PHP but check this open source code below in PHP.

Edit:

Verify signed message in PHP
- https://github.com/Bit-Wasp/bitcoin-php/blob/master/examples/signedmessage.verify.php


Create sign message in PHP
- https://github.com/Bit-Wasp/bitcoin-php/blob/master/examples/signedmessage.create.php

You need to install the whole respiratory to make the PHP code above work.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
DifDrama
Jr. Member
*
Offline Offline

Activity: 33
Merit: 32


View Profile
December 16, 2023, 02:23:14 AM
 #4

BitMaxz has provided a great explanation. For question 4, one additional point to consider is an older GitHub page that might be helpful to you:
https://github.com/BitcoinPHP/BitcoinECDSA.php
itsmyfirstaccount (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 16, 2023, 01:01:56 PM
 #5

As following tips
1.when I want to sign a message, do I must have the private key?
Without a private key you can't able to sign a message it is required when signing a message.

2.any one can using just public key to sign a message?and pass verification?
No, you can't sign a message with the public key, the private key is required because it proves that you own that wallet or that public key.


3.is there any trusted site or tool for signing?
I do not recommend any web tools to sign a message it's risky I recommend use Electrum Wallet instead.

4.how to implement it by PHP?(code better)

I don't have much knowledge in PHP but check this open source code below in PHP.

Edit:

Verify signed message in PHP
- https://github.com/Bit-Wasp/bitcoin-php/blob/master/examples/signedmessage.verify.php


Create sign message in PHP
- https://github.com/Bit-Wasp/bitcoin-php/blob/master/examples/signedmessage.create.php

You need to install the whole respiratory to make the PHP code above work.


to read the whole project is a big task.

Is there any open source, simple project which just for implement the signing function. It must be open source, no one will trust this kind of software, even Electrum .if I want to sign a message with more than 100 bitcoins, I really can not trust any software even with big companies.  Do you think so?
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2955


Block halving is coming.


View Profile WWW
December 17, 2023, 02:11:43 PM
 #6

to read the whole project is a big task.

Is there any open-source, simple project which just for implement the signing function. It must be open source, no one will trust this kind of software, even Electrum .if I want to sign a message with more than 100 bitcoins, I really can not trust any software even with big companies.  Do you think so?

I couldn't find any simple PHP code that can sign/verify the message.
The open-sourced that I provided above is owned by fbueller who develop bit-wasp. He is no longer active since 2017.

If you can't trust that source why not run this offline?
Or do you want to run this on your website? If yes then you need to study his code to make sure the codes are safe.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
aleph1
Newbie
*
Offline Offline

Activity: 1
Merit: 23


View Profile
December 17, 2023, 11:01:44 PM
Merited by ltcltcltc (23)
 #7

1.Yes, you need the private key to sign a message. Signing a message involves using your private key to create a digital signature, which can then be verified using your public key.

2.No, anyone cannot sign a message using just a public key. Signing requires the use of the private key. Verification, however, can be done using the associated public key.

3.There are several trusted tools for signing messages, such as Electrum, Bitcoin Core, and online tools like https://tools.bitcoin.com/signature/.

4.To implement message signing in PHP, you can use libraries like phpseclib or bitwasp/bitcoin along with the necessary Bitcoin functions. Here's a basic example using phpseclib:


php
Edit


<?php
include('vendor/autoload.php'); // Include the necessary library

use phpseclib\Crypt\RSA;

// Your private key and message
$privateKey = 'YOUR_PRIVATE_KEY_HERE';
$message = 'Message to sign';

// Create an RSA instance
$rsa = new RSA();
$rsa->loadKey($privateKey); // Load your private key
$signature = $rsa->sign($message); // Sign the message
echo "Signature: $signature"; // Output the signature
?>

Remember to replace 'YOUR_PRIVATE_KEY_HERE' with your actual private key.

References:

Bitcoin Wiki: https://en.bitcoin.it/
phpseclib GitHub: https://github.com/phpseclib/phpseclib




ABCbits
Legendary
*
Offline Offline

Activity: 2870
Merit: 7452


Crypto Swap Exchange


View Profile
December 18, 2023, 09:49:50 AM
 #8

Is there any open source, simple project which just for implement the signing function. It must be open source, no one will trust this kind of software, even Electrum .if I want to sign a message with more than 100 bitcoins, I really can not trust any software even with big companies.  Do you think so?

I have difficulty to understand what you said. But Electrum is open source where the code is available on https://github.com/spesmilo/electrum. And i doubt you can find simple project since signing involve so many things including ECDSA implementation and checking whether you use valid private key.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!