FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcoin-php/src/Bitcoin.php at 1.0 · Bit-Wasp/bitcoin-php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Bit-Wasp
/
bitcoin-php
Public
Notifications
You must be signed in to change notification settings
Fork
446
Star
1.1k
Code
Issues
67
Pull requests
19
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcoin-php
/
src
/
Bitcoin.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
129 lines (111 loc) · 2.71 KB
Breadcrumbs
bitcoin-php
/
src
/
Bitcoin.php
Copy path
File metadata and controls
129 lines (111 loc) · 2.71 KB
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
namespace
BitWasp
\
Bitcoin
;
use
BitWasp
\
Bitcoin
\
Chain
\
Params
;
use
BitWasp
\
Bitcoin
\
Chain
\
ParamsInterface
;
use
BitWasp
\
Bitcoin
\
Crypto
\
EcAdapter
\
Adapter
\
EcAdapterInterface
;
use
BitWasp
\
Bitcoin
\
Crypto
\
EcAdapter
\
EcAdapterFactory
;
use
BitWasp
\
Bitcoin
\
Math
\
Math
;
use
BitWasp
\
Bitcoin
\
Network
\
NetworkFactory
;
use
BitWasp
\
Bitcoin
\
Network
\
NetworkInterface
;
use
Mdanter
\
Ecc
\
EccFactory
;
use
Mdanter
\
Ecc
\
Primitives
\
GeneratorPoint
;
class
Bitcoin
{
/**
* @var NetworkInterface
*/
private
static
$
network
;
/**
* @var EcAdapterInterface
*/
private
static
$
adapter
;
/**
* @var ParamsInterface
*/
private
static
$
params
;
/**
* @return Math
*/
public
static
function
getMath
()
{
return
new
Math
();
}
/**
* Load the generator to be used throughout
*/
public
static
function
getGenerator
()
{
return
EccFactory::
getSecgCurves
(
self
::
getMath
())->
generator256k1
();
}
/**
* @param Math $math
* @param GeneratorPoint $generator
* @return EcAdapterInterface
*/
public
static
function
getEcAdapter
(
Math
$
math
=
null
,
GeneratorPoint
$
generator
=
null
)
{
if
(
null
===
self
::
$
adapter
) {
self
::
$
adapter
= EcAdapterFactory::
getAdapter
(
(
$
math
?:
self
::
getMath
()),
(
$
generator
?:
self
::
getGenerator
())
);
}
return
self
::
$
adapter
;
}
/**
* @param ParamsInterface $params
*/
public
static
function
setParams
(
ParamsInterface
$
params
)
{
self
::
$
params
=
$
params
;
}
/**
* @return ParamsInterface
*/
public
static
function
getParams
()
{
if
(
null
===
self
::
$
params
) {
self
::
$
params
=
self
::
getDefaultParams
();
}
return
self
::
$
params
;
}
/**
* @param Math|null $math
* @return ParamsInterface
*/
public
static
function
getDefaultParams
(
Math
$
math
=
null
)
{
return
new
Params
(
$
math
?:
self
::
getMath
());
}
/**
* @param EcAdapterInterface $adapter
*/
public
static
function
setAdapter
(
EcAdapterInterface
$
adapter
)
{
self
::
$
adapter
=
$
adapter
;
}
/**
* @param NetworkInterface $network
*/
public
static
function
setNetwork
(
NetworkInterface
$
network
)
{
self
::
$
network
=
$
network
;
}
/**
* @return NetworkInterface
*/
public
static
function
getNetwork
()
{
if
(
null
===
self
::
$
network
) {
self
::
$
network
=
self
::
getDefaultNetwork
();
}
return
self
::
$
network
;
}
/**
* @return NetworkInterface
*/
public
static
function
getDefaultNetwork
()
{
return
NetworkFactory::
bitcoin
();
}
}
Back
|
FazBrowse Home
|
New Git URL