FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcoin-php/examples/script.simple.php at main · ProtonMail/bitcoin-php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ProtonMail
/
bitcoin-php
Public
forked from
Bit-Wasp/bitcoin-php
Notifications
You must be signed in to change notification settings
Fork
23
Star
32
Code
Issues
3
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcoin-php
/
examples
/
script.simple.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (16 loc) · 852 Bytes
Breadcrumbs
bitcoin-php
/
examples
/
script.simple.php
Copy path
File metadata and controls
20 lines (16 loc) · 852 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
require_once
__DIR__
.
"
/../vendor/autoload.php
"
;
use
BitWasp
\
Bitcoin
\
Bitcoin
;
use
BitWasp
\
Bitcoin
\
Script
\
Interpreter
\
Checker
;
use
BitWasp
\
Bitcoin
\
Script
\
Interpreter
\
Interpreter
;
use
BitWasp
\
Bitcoin
\
Script
\
Opcodes
;
use
BitWasp
\
Bitcoin
\
Script
\
ScriptFactory
;
use
BitWasp
\
Bitcoin
\
Transaction
\
Transaction
;
$
ecAdapter
= Bitcoin::
getEcAdapter
();
$
scriptSig
= ScriptFactory::
create
()->
int
(
1
)->
int
(
1
)->
getScript
();
$
scriptPubKey
= ScriptFactory::
create
()->
opcode
(Opcodes::
OP_ADD
)->
int
(
2
)->
opcode
(Opcodes::
OP_EQUAL
)->
getScript
();
echo
"
Formed script:
"
.
$
scriptSig
->
getHex
() .
"
"
.
$
scriptPubKey
->
getHex
() .
"\n"
;
$
flags
=
0
;
$
interpreter
=
new
Interpreter
(
$
ecAdapter
);
$
result
=
$
interpreter
->
verify
(
$
scriptSig
,
$
scriptPubKey
,
$
flags
,
new
Checker
(
$
ecAdapter
,
new
Transaction
(),
0
,
0
));
echo
"
Script result:
"
. (
$
result
?
'
true
'
:
'
false
'
) .
"\n"
;
Back
|
FazBrowse Home
|
New Git URL