- Openclerk\Currencies\Cryptocurrency
- Cryptocurrency\Bitcoin
class Cryptocurrency \ Bitcoin
- All implemented interfaces:
- Currency, BlockCurrency, DifficultyCurrency, ConfirmableCurrency, BlockBalanceableCurrency, AddressableCurrency, ReceivedCurrency, HashableCurrency, BalanceableCurrency, CurrencyInformation
Represents the Bitcoin cryptocurrency.
This is the base interface; other interfaces will provide additional functionality as necessary. (from Currency)
- See:
-
BlockBalanceableCurrency
Method Summary
Name | Description |
---|---|
getAlgorithm() | Get the main algorithm used by this currency for hashing, as a code from HashAlgorithm#getCode. |
getBalance($address, Logger $logger) | Get the account balance of the given account. This method blocks until the balance has been obtained. |
getBalanceAtBlock($address, $block = null, Logger $logger) | Get the balance at the given block number. This allows us to cache the block number and not have to request it on every balance request. |
getBalanceURL($address) | |
getBalanceWithConfirmations($address, $confirmations, Logger $logger) | Get the balance at the given number of confirmations. If this is also a BlockBalanceableCurrency then we can emulate this through #getBalanceAtBlock(). |
getBlockCount(Logger $logger) | Get the most recent block count for this currency. This method blocks until the block count has been obtained. |
getCode() | Get the unique three-letter currency code for this currency, e.g. 'btc' or 'usd'. Must be lowercase. This is not visible to users. |
getCommunityLinks() | |
getDifficulty(Logger $logger) | Get the most recent difficulty for this currency. This method blocks until the balance has been obtained. |
getExplorerName() | |
getExplorerURL() | |
getName() | Get the English name of this currency, e.g. "Bitcoin" or "United States Dollar". |
getReceived($address, Logger $logger) | Get the received account balance of the given account. This method blocks until the balance has been obtained. |
getURL() | |
hasExplorer() | |
isValid($address) | Is this account identifier valid for this currency? |
Inherited Method Summary
Name | Description |
---|---|
getAbbr() | Get the currency code visible to users, which can be of any length and does not need to be unique (but should be). Often just the uppercase of #getCode. (from Cryptocurrency) |
getCurrency() | Get the Currency for this CurrencyInformation. (from Cryptocurrency) |
isCommodity() | (from Cryptocurrency) |
isCryptocurrency() | (from Cryptocurrency) |
isFiat() | (from Cryptocurrency) |
public function getAlgorithm()
Get the main algorithm used by this currency for hashing, as a code from HashAlgorithm#getCode.
HashableCurrencys which share the same hash algorithm can be considered similar and their hash rates can be manipulated together. (from getAlgorithm)
public function getBalance($address, Logger $logger)
Get the account balance of the given account. This method blocks until the balance has been obtained. (from getBalance)
- Parameters:
$logger
- a logger to log info/error messages to- Throws:
BalanceException if something happened and the balance could not be obtained.
public function getBalanceAtBlock($address, $block = null, Logger $logger)
Get the balance at the given block number. This allows us to cache the block number and not have to request it on every balance request. (from getBalanceAtBlock)
- Parameters:
$block
- the block number, ornull
to get the most recent balance- Defaults:
block
=null
- Throws:
BalanceException if something happened and the balance could not be obtained.
public function getBalanceURL($address)
- Returns:
a public URL for exploring the given account, ornull
if there is none
public function getBalanceWithConfirmations($address, $confirmations, Logger $logger)
Get the balance at the given number of confirmations. If this is also a BlockBalanceableCurrency then we can emulate this through #getBalanceAtBlock(). (from getBalanceWithConfirmations)
- Parameters:
$confirmations
- the number of confirmations to use- Throws:
BalanceException if something happened and the balance could not be obtained.
public function getBlockCount(Logger $logger)
Get the most recent block count for this currency. This method blocks until the block count has been obtained. (from getBlockCount)
- Parameters:
$logger
- a logger to log info/error messages to- Throws:
BlockException if something happened and the block count could not be obtained
public function getCode()
Get the unique three-letter currency code for this currency, e.g. 'btc' or 'usd'. Must be lowercase. This is not visible to users. (from getCode)
public function getCommunityLinks()
- Returns:
an array of (url => title) community links, or an empty array if there are none
public function getDifficulty(Logger $logger)
Get the most recent difficulty for this currency. This method blocks until the balance has been obtained. (from getDifficulty)
- Parameters:
$logger
- a logger to log info/error messages to- Throws:
DifficultyException if something happened and the block count could not be obtained
public function getExplorerName()
- Returns:
the name of the explorer, ornull
if there is none- See:
public function getExplorerURL()
- Returns:
a public URL for the explorer, ornull
if there is none- See:
public function getName()
Get the English name of this currency, e.g. "Bitcoin" or "United States Dollar". (from getName)
public function getReceived($address, Logger $logger)
Get the received account balance of the given account. This method blocks until the balance has been obtained. (from getReceived)
- Parameters:
$logger
- a logger to log info/error messages to- Throws:
BalanceException if something happened and the balance could not be obtained.
public function getURL()
- Returns:
a URL for more information about this currency, ornull
if there is none
public function hasExplorer()
- Returns:
true if this Currency has a public explorer that can be used to look at an individual account.
public function isValid($address)
Is this account identifier valid for this currency? (from isValid)
- Returns:
false if this account identifier is not valid