Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
|
Public Member Functions | |
toHex () | |
getPublicHex (bool $with0x=true) | |
getPublicBin () | |
toAddress () | |
toBin () | |
sign (Hash $hash) | |
Static Public Member Functions | |
static | fromHex (#[SensitiveParameter] string $keyHex) |
static | fromBin (string $bin) |
static | generate () |
Protected Member Functions | |
__construct (#[SensitiveParameter] private string $keyHex) | |
Key is a representation for raw Ethereum private key. It contains essential utilities for its usage and is used in EthBinder as raw private key.
|
protected |
string | $keyHex | Hexadecimal string of the private key. |
|
static |
Initializes from binary of the key.
string | $bin | Binary string of the key. |
|
static |
Initializes from a hexadecimal string.
string | $keyHex | Hexadecimal string of the private key. |
|
static |
Generates new random key using openssl for random bytes. Triggers E_USER_WARNING if weak entropy was used.
M8B\EtherBinder\Crypto\Key::getPublicBin | ( | ) |
Returns binary blob of public key associated with this private key
InvalidHexException |
M8B\EtherBinder\Crypto\Key::getPublicHex | ( | bool | $with0x = true | ) |
Returns hex-encoded public key associated with this private key. Does not contain initial "04" prefix.
bool | $with0x |
M8B\EtherBinder\Crypto\Key::sign | ( | Hash | $hash | ) |
Signs arbitrary hash using the private key.
Hash | $hash | Hash to be signed. |
M8B\EtherBinder\Crypto\Key::toAddress | ( | ) |
Generates an Ethereum Address based on the key. Internally caches the address to avoid wasting time on hashing.
EthBinderLogicException |
M8B\EtherBinder\Crypto\Key::toBin | ( | ) |
Returns the binary of the key.
M8B\EtherBinder\Crypto\Key::toHex | ( | ) |
Returns the hexadecimal representation of the key, prefixed with '0x'.