Bitcoin Forum
May 11, 2024, 04:36:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Verify a signed message in PHP. Without downloading anything  (Read 1762 times)
BitTalkyy (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 16, 2015, 02:40:38 PM
Last edit: October 19, 2015, 11:15:39 AM by BitTalkyy
 #1

First go to http://www.blockchain.info/ and create a wallet.
Copy down the identifier.
Download the lite version of JSON-RPC PHP Client. http://jsonrpcphp.org/?page=download&lang=en

Include it in your php file, you want to use it.
Write your connect script like this:
Quote
$bitcoin = new jsonRPCClient('http://user:password@rpc.blockchain.info/');

Next, create some variables:
Quote
$message = Your message; $address = Address; $signature = Signature
Create another variable that will have a value of true or false. This indicates the validity of the message.
Quote
$sig_valid = $bitcoin->verifymessage($address,$signature,$message)

Now check the state:
Quote
if($sig_valid) { //valid } else { //invalid }

So, for the lazy people, here's the full code:
Quote
<?php
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:password@rpc.blockchain.info/');

$address;
$message;
$signature;

$sig_valid = $bitcoin->verifymessage($address,$signature,$message);
if($sig_valid) {
     //valid
} else {
     //invalid
}

?>

You can do more things with this: https://blockchain.info/hu/api/json_rpc_api

Happy programming! I'll post more programming tutorials soon! Also, if you have an idea, PM me and we can team up on it.

Tips are appreciated: 1Tipo4u5vkaNDjPd5A4wxPxmR4bEp8Bdb
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715445405
Hero Member
*
Offline Offline

Posts: 1715445405

View Profile Personal Message (Offline)

Ignore
1715445405
Reply with quote  #2

1715445405
Report to moderator
1715445405
Hero Member
*
Offline Offline

Posts: 1715445405

View Profile Personal Message (Offline)

Ignore
1715445405
Reply with quote  #2

1715445405
Report to moderator
1715445405
Hero Member
*
Offline Offline

Posts: 1715445405

View Profile Personal Message (Offline)

Ignore
1715445405
Reply with quote  #2

1715445405
Report to moderator
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
October 16, 2015, 05:47:11 PM
 #2

Whats the benefit if you rely on an API anyway?

Im not really here, its just your imagination.
BitTalkyy (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 16, 2015, 06:29:22 PM
 #3

Whats the benefit if you rely on an API anyway?
You can save a lot of bandwidth and disk space. Also, it's much easier
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
October 16, 2015, 07:24:49 PM
 #4

Whats the benefit if you rely on an API anyway?
You can save a lot of bandwidth and disk space. Also, it's much easier

https://chainquery.com/bitcoin-api/verifymessage

Im not really here, its just your imagination.
silverleafy
Sr. Member
****
Offline Offline

Activity: 538
Merit: 250


View Profile
October 16, 2015, 07:28:06 PM
 #5

Why use the blockchain.info api? Blockchain.info has a terrible track record and their service isn't all that great. I would not use their api.

QUEDOS
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
October 16, 2015, 08:25:45 PM
 #6

Whats the benefit if you rely on an API anyway?

You reduce stress on disk space and you can cut back on bandwidth usage at the same time
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
October 16, 2015, 09:58:00 PM
 #7

Use this library and do it locally:

https://github.com/Bit-Wasp/bitcoin-php
BitTalkyy (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 17, 2015, 09:55:35 AM
 #8

Use this library and do it locally:

https://github.com/Bit-Wasp/bitcoin-php
That script requires some extensions, my version is pure PHP
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 18, 2015, 04:02:45 PM
 #9

Gotta love it here, it's become as toxic as a children playground! You all need to grow up.
A newb posts a how-to with good intentions to educate or help others. What's the response? BC.info sucks, why are you using API, you should do it with this library instead, you should host a full node on your server and do JSON RPC, etc. 
Who cares what you think about BC.info and their wallet service? He's not telling anyone to store coins there. Their API is a free service that is actually useful, but you all like to take the popular choice that BC.info sucks, no matter the usage or implementation.

It's easy to be a critic. Why you don't you create your own how to's or tutorials?

BitTalkyy (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 18, 2015, 05:22:25 PM
 #10

Gotta love it here, it's become as toxic as a children playground! You all need to grow up.
A newb posts a how-to with good intentions to educate or help others. What's the response? BC.info sucks, why are you using API, you should do it with this library instead, you should host a full node on your server and do JSON RPC, etc. 
Who cares what you think about BC.info and their wallet service? He's not telling anyone to store coins there. Their API is a free service that is actually useful, but you all like to take the popular choice that BC.info sucks, no matter the usage or implementation.

It's easy to be a critic. Why you don't you create your own how to's or tutorials?
I don't know if you're hating on me, but I didn't say to anyone to use that wallet. It's required to log onto the RPC Server
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 18, 2015, 05:29:36 PM
 #11

Gotta love it here, it's become as toxic as a children playground! You all need to grow up.
A newb posts a how-to with good intentions to educate or help others. What's the response? BC.info sucks, why are you using API, you should do it with this library instead, you should host a full node on your server and do JSON RPC, etc. 
Who cares what you think about BC.info and their wallet service? He's not telling anyone to store coins there. Their API is a free service that is actually useful, but you all like to take the popular choice that BC.info sucks, no matter the usage or implementation.

It's easy to be a critic. Why you don't you create your own how to's or tutorials?
I don't know if you're hating on me, but I didn't say to anyone to use that wallet. It's required to log onto the RPC Server

Not at all, I was hating on all the others that were bashing your tutorial. I sent you a tip.

BitTalkyy (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 18, 2015, 05:30:55 PM
 #12

Gotta love it here, it's become as toxic as a children playground! You all need to grow up.
A newb posts a how-to with good intentions to educate or help others. What's the response? BC.info sucks, why are you using API, you should do it with this library instead, you should host a full node on your server and do JSON RPC, etc. 
Who cares what you think about BC.info and their wallet service? He's not telling anyone to store coins there. Their API is a free service that is actually useful, but you all like to take the popular choice that BC.info sucks, no matter the usage or implementation.

It's easy to be a critic. Why you don't you create your own how to's or tutorials?
I don't know if you're hating on me, but I didn't say to anyone to use that wallet. It's required to log onto the RPC Server

Not at all, I was hating on all the others that were bashing your tutorial. I sent you a tip.
Oh, thank you then!
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 275


View Profile
October 21, 2015, 11:38:57 PM
 #13

Use this library and do it locally:

https://github.com/Bit-Wasp/bitcoin-php
That script requires some extensions, my version is pure PHP

Your script requires extensions too - JSON and cURL support are extensions.

Bitwasp Developer.
avatar_kiyoshi
Legendary
*
Offline Offline

Activity: 1106
Merit: 1000



View Profile
October 22, 2015, 05:42:01 AM
 #14

Nice tutorial, don't bashing a newbie guys, moreover he's not want to robbed your coin.
nice works!

Use this library and do it locally:

https://github.com/Bit-Wasp/bitcoin-php
That script requires some extensions, my version is pure PHP

Your script requires extensions too - JSON and cURL support are extensions.

Well this is right, op script is not pure php. but the script is simple I think, easy to understand.
lightenx
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
October 30, 2015, 09:23:15 PM
 #15

Nah, I think OP's script is good enough. Not perfect tho
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!