Currencies Module
Please note that the currencies module has been deprecated. It is now blockchains.js.
Currencies Functions & Variables
The Currencies Module features the following functions:
$.fn.blockstrap.currencies.check
(input)$.fn.blockstrap.currencies.key
(code)$.fn.blockstrap.currencies.keys
(secret, currency)$.fn.blockstrap.currencies.raw
(return_to, privkey, inputs, outputs, this_fee, amount_to_send)$.fn.blockstrap.currencies.send
(to_address, to_amount, from_address, keys, callback, currency)$.fn.blockstrap.currencies.validate
(address)$.fn.blockstrap.currencies.which
(address)
currencies.check
(input) - back to top
This function will return the first character a validated address
.
currencies.key
(code) - back to top
This function will return the BitcoinJS-Lib
formatted currency code if provided with the Blockstrap currency code
.
For example, btc
becomes bitcoin
and dogt
becomes dogecointestnet
.
currencies.keys
(secret, currency) - back to top
This function takes the secret
seed and currency
and returns an object containing the public and private keys generated from the secret
.
Please note that by default, Blockstrap DOES NOT store the private keys anywhere.
currencies.raw
(return_to, privkey, inputs, outputs, this_fee, amount_to_send) - back to top
This function returns a raw transaction Hex-string that can then be relayed.
It already requires you to have the inputs
and outputs
properly formed. The return_to
variable is the change address that should be used to send-back the left-over inputs. You need to set the amount_to_send
(as an integer) as well as the preferred mining fee by using this_fee
.
currencies.send
(to_address, to_amount, from_address, keys, callback, currency) - back to top
This function is used to construct a raw transaction and then relay it. Basic settings such as who to send the coins to with to_address
, or how much to send with to_amount
and currency
are clear enough. The from_address
will be used as the returning change address. The keys
should be a key object as returned by currencies.keys
, which contains both the public and private keys. Before proceeding, we first check locally to see if the account belongs to this user and it has the necessary balance required to perform the transaction. If it does, the public key is used in reference to an api.unspents
call, the results from which are then used to construct the necessary available inputs. We then call currencies.raw
and use the returned object as the required variable in an api.relay
call.
currencies.validate
(address) - back to top
This function returns a boolean and is used on conjunction with currencies.check
to validate an address
.
currencies.which
(address) - back to top
This function will return the currency code (or false) for a given address
.
However, please note that this IS NOT ACCURATE as it currently uses a very hacky method. Sorry about that.
- Related Articles
- Back to Modules
- Accounts
- API
- Buttons
- Contacts
- Blockchains
- Data
- Filters
- Forms
- Security
- Styles
- Templates
- Table of Contents