Graphene::App
-
namespace app
-
Typedefs
Functions
-
static uint32_t validate_get_lp_history_params(const application &_app, const optional<uint32_t> &olimit)
-
void load_configuration_options(const fc::path &data_dir, const bpo::options_description &cfg_options, bpo::variables_map &options)
-
void load_configuration_options(const fc::path &data_dir, const boost::program_options::options_description &cfg_options, boost::program_options::variables_map &options)
-
std::string uint128_amount_to_string(const fc::uint128_t &amount, const uint8_t precision)
-
std::string price_to_string(const graphene::protocol::price &_price, const uint8_t base_precision, const uint8_t quote_precision)
-
std::string price_to_string(const graphene::protocol::price &_price, const graphene::chain::asset_object &_base, const graphene::chain::asset_object &_quote)
-
std::string price_diff_percent_string(const graphene::protocol::price &old_price, const graphene::protocol::price &new_price)
-
static fc::uint128_t to_capped_128(const uint256_t &t)
-
class abstract_plugin
- #include <plugin.hpp>
Subclassed by graphene::app::plugin
Public Functions
-
virtual std::string plugin_name() const = 0
Get the name of the plugin.
-
virtual std::string plugin_description() const = 0
Get the description of the plugin.
-
inline application &app() const
Get a reference of the application bound to the plugin.
-
virtual void plugin_initialize(const boost::program_options::variables_map &options) = 0
Perform early startup routines and register plugin indexes, callbacks, etc.
Plugins MUST supply a method initialize() which will be called early in the application startup. This method should contain early setup code such as initializing variables, adding indexes to the database, registering callback methods from the database, adding APIs, etc., as well as applying any options in the
optionsmapThis method is called BEFORE the database is open, therefore any routines which require any chain state MUST NOT be called by this method. These routines should be performed in startup() instead.
- Parameters:
options – The options passed to the application, via configuration files or command line
-
virtual void plugin_startup() = 0
Begin normal runtime operations.
Plugins MUST supply a method startup() which will be called at the end of application startup. This method should contain code which schedules any tasks, or requires chain state.
-
virtual void plugin_shutdown() = 0
Cleanly shut down the plugin.
This is called to request a clean shutdown (e.g. due to SIGINT or SIGTERM).
-
virtual void plugin_set_program_options(boost::program_options::options_description &command_line_options, boost::program_options::options_description &config_file_options) = 0
Fill in command line parameters used by the plugin.
This method populates its arguments with any command-line and configuration file options the plugin supports. If a plugin does not need these options, it may simply provide an empty implementation of this method.
- Parameters:
command_line_options – All options this plugin supports taking on the command-line
config_file_options – All options this plugin supports storing in a configuration file
-
virtual std::string plugin_name() const = 0
-
struct api_access
- #include <api_access.hpp>
-
struct api_access_info
- #include <api_access.hpp>
-
class application
- #include <application.hpp>
Public Members
-
boost::signals2::signal<void()> syncing_finished
Emitted when syncing finishes (is_finished_syncing will return true)
-
boost::signals2::signal<void()> syncing_finished
-
class application_options
- #include <application.hpp>
-
class asset_api
- #include <api.hpp>
The asset_api class allows query of info about asset holders.
Public Functions
-
vector<account_asset_balance> get_asset_holders(const std::string &asset_symbol_or_id, uint32_t start, uint32_t limit) const
Get asset holders for a specific asset.
- Parameters:
asset_symbol_or_id – The specific asset symbol or ID
start – The start index
limit – Maximum number of accounts to retrieve, must not exceed the configured value of api_limit_get_asset_holders
- Returns:
A list of asset holders for the specified asset
-
int64_t get_asset_holders_count(const std::string &asset_symbol_or_id) const
Get asset holders count for a specific asset.
- Parameters:
asset_symbol_or_id – The specific asset symbol or id
- Returns:
Holders count for the specified asset
-
vector<asset_holders> get_all_asset_holders() const
Get all asset holders.
- Returns:
A list of all asset holders
-
struct account_asset_balance
- #include <api.hpp>
-
struct asset_holders
- #include <api.hpp>
-
vector<account_asset_balance> get_asset_holders(const std::string &asset_symbol_or_id, uint32_t start, uint32_t limit) const
-
class block_api
- #include <api.hpp>
Block api.
Public Functions
-
vector<optional<signed_block>> get_blocks(uint32_t block_num_from, uint32_t block_num_to) const
Get signed blocks.
- Parameters:
block_num_from – The lowest block number
block_num_to – The highest block number
- Returns:
A list of signed blocks from block_num_from till block_num_to
-
vector<optional<signed_block>> get_blocks(uint32_t block_num_from, uint32_t block_num_to) const
-
class crypto_api
- #include <api.hpp>
The crypto_api class allows computations related to blinded transfers.
Public Functions
-
fc::ecc::commitment_type blind(const fc::ecc::blind_factor_type &blind, uint64_t value) const
Generates a pedersen commitment: *commit = blind * G + value * G2. The commitment is 33 bytes, the blinding factor is 32 bytes. For more information about pederson commitment check url https://en.wikipedia.org/wiki/Commitment_scheme.
- Parameters:
blind – Sha-256 blind factor type
value – Positive 64-bit integer value
- Returns:
A 33-byte pedersen commitment: *commit = blind * G + value * G2
-
fc::ecc::blind_factor_type blind_sum(const std::vector<blind_factor_type> &blinds_in, uint32_t non_neg) const
Get sha-256 blind factor type.
- Parameters:
blinds_in – List of sha-256 blind factor types
non_neg – 32-bit integer value
- Returns:
A blind factor type
-
bool verify_sum(const std::vector<commitment_type> &commits_in, const std::vector<commitment_type> &neg_commits_in, int64_t excess) const
Verifies that commits + neg_commits + excess == 0.
- Parameters:
commits_in – List of 33-byte pedersen commitments
neg_commits_in – List of 33-byte pedersen commitments
excess – Sum of two list of 33-byte pedersen commitments where sums the first set and subtracts the second
- Returns:
Boolean - true in event of commits + neg_commits + excess == 0, otherwise false
-
verify_range_result verify_range(const fc::ecc::commitment_type &commit, const std::vector<char> &proof) const
Verifies range proof for 33-byte pedersen commitment.
- Parameters:
commit – 33-byte pedersen commitment
proof – List of characters
- Returns:
A structure with success, min and max values
-
std::vector<char> range_proof_sign(uint64_t min_value, const commitment_type &commit, const blind_factor_type &commit_blind, const blind_factor_type &nonce, int8_t base10_exp, uint8_t min_bits, uint64_t actual_value) const
Proves with respect to min_value the range for pedersen commitment which has the provided blinding factor and value.
- Parameters:
min_value – Positive 64-bit integer value
commit – 33-byte pedersen commitment
commit_blind – Sha-256 blind factor type for the correct digits
nonce – Sha-256 blind factor type for our non-forged signatures
base10_exp – Exponents base 10 in range [-1 ; 18] inclusively
min_bits – 8-bit positive integer, must be in range [0 ; 64] inclusively
actual_value – 64-bit positive integer, must be greater or equal min_value
- Returns:
A list of characters as proof in proof
-
verify_range_proof_rewind_result verify_range_proof_rewind(const blind_factor_type &nonce, const fc::ecc::commitment_type &commit, const std::vector<char> &proof) const
Verifies range proof rewind for 33-byte pedersen commitment.
- Parameters:
nonce – Sha-256 blind refactor type
commit – 33-byte pedersen commitment
proof – List of characters
- Returns:
A structure with success, min, max, value_out, blind_out and message_out values
-
fc::ecc::range_proof_info range_get_info(const std::vector<char> &proof) const
Gets “range proof” info. The cli_wallet includes functionality for sending blind transfers in which the values of the input and outputs amounts are “blinded.” In the case where a transaction produces two or more outputs, (e.g. an amount to the intended recipient plus “change” back to the sender), a “range proof” must be supplied to prove that none of the outputs commit to a negative value.
- Parameters:
proof – List of proof’s characters
- Returns:
A range proof info structure with exponent, mantissa, min and max values
-
struct verify_range_proof_rewind_result
- #include <api.hpp>
-
struct verify_range_result
- #include <api.hpp>
-
fc::ecc::commitment_type blind(const fc::ecc::blind_factor_type &blind, uint64_t value) const
-
class custom_operations_api
- #include <api.hpp>
The custom_operations_api class exposes access to standard custom objects parsed by the custom_operations_plugin.
Public Functions
-
vector<account_storage_object> get_storage_info(const optional<std::string> &account_name_or_id = optional<std::string>(), const optional<std::string> &catalog = optional<std::string>(), const optional<std::string> &key = optional<std::string>(), const optional<uint32_t> &limit = optional<uint32_t>(), const optional<account_storage_id_type> &start_id = optional<account_storage_id_type>()) const
Get stored objects.
Note
By passing null to various optional parameters, or omitting where applicable, this API can be used to query stored objects by a) account, catalog and key, or b) account and catalog, or c) account, or d) catalog and key, or e) catalog, or f) unconditionally. Queries with keys without a catalog are not allowed.
If
account_name_or_idis specified but cannot be tied to an account, an error will be returned.limitcan be omitted or be null, if so the configured value of api_limit_get_storage_info will be used.start_idcan be omitted or be null, if so the API will return the “first page” of objects.One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – The account name or ID to get info from. Optional.
catalog – The catalog to get info from. Each account can store data in multiple catalogs. Optional.
key – The key to get info from. Each catalog can contain multiple keys. Optional.
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_storage_info. Optional.
start_id – Start ID of stored object, fetch objects whose IDs are greater than or equal to this ID
- Returns:
The stored objects found, sorted by their ID
-
vector<account_storage_object> get_storage_info(const optional<std::string> &account_name_or_id = optional<std::string>(), const optional<std::string> &catalog = optional<std::string>(), const optional<std::string> &key = optional<std::string>(), const optional<uint32_t> &limit = optional<uint32_t>(), const optional<account_storage_id_type> &start_id = optional<account_storage_id_type>()) const
-
class database_api
- #include <database_api.hpp>
The database_api class implements the RPC API for the chain database.
This API exposes accessors on the database which query state tracked by a blockchain validating node. This API is read-only; all modifications to the database must be performed via transactions. Transactions are broadcast via the network_broadcast_api.
Unnamed Group
-
vector<samet_fund_object> list_samet_funds(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<samet_fund_id_type> &start_id = optional<samet_fund_id_type>()) const
Get a list of SameT Funds.
SameT Funds
Note
limitcan be omitted or be null, if so the configured value of api_limit_get_samet_funds will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_samet_funds
start_id – Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The SameT Funds
-
vector<samet_fund_object> get_samet_funds_by_owner(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<samet_fund_id_type> &start_id = optional<samet_fund_id_type>()) const
Get a list of SameT Funds by the name or ID of the owner account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_samet_funds will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the owner account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_samet_funds
start_id – Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The SameT Funds
-
vector<samet_fund_object> get_samet_funds_by_asset(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<samet_fund_id_type> &start_id = optional<samet_fund_id_type>()) const
Get a list of SameT Funds by the symbol or ID of the asset type.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_samet_funds will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol or ID of the asset type
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_samet_funds
start_id – Start SameT Fund id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The SameT Funds
Unnamed Group
-
vector<credit_offer_object> list_credit_offers(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_offer_id_type> &start_id = optional<credit_offer_id_type>()) const
Get a list of credit offers.
Credit offers and credit deals
Note
limitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit offer id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit offers
-
vector<credit_offer_object> get_credit_offers_by_owner(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_offer_id_type> &start_id = optional<credit_offer_id_type>()) const
Get a list of credit offers by the name or ID of the owner account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the owner account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit offer id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit offers
-
vector<credit_offer_object> get_credit_offers_by_asset(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_offer_id_type> &start_id = optional<credit_offer_id_type>()) const
Get a list of credit offers by the symbol or ID of the asset type.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol or ID of the asset type
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit offer id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit offers
-
vector<credit_deal_object> list_credit_deals(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals.
Note
limitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
-
vector<credit_deal_object> get_credit_deals_by_offer_id(const credit_offer_id_type &offer_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals by the ID of a credit offer.
Note
If
offer_idcannot be tied to a credit offer, an empty list will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
offer_id – ID of the credit offer
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
-
vector<credit_deal_object> get_credit_deals_by_offer_owner(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals by the name or ID of a credit offer owner account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the credit offer owner account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
-
vector<credit_deal_object> get_credit_deals_by_borrower(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals by the name or ID of a borrower account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the borrower account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
-
vector<credit_deal_object> get_credit_deals_by_debt_asset(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals by the symbol or ID of the debt asset type.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol or ID of the debt asset type
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
-
vector<credit_deal_object> get_credit_deals_by_collateral_asset(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<credit_deal_id_type> &start_id = optional<credit_deal_id_type>()) const
Get a list of credit deals by the symbol or ID of the collateral asset type.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_credit_offers will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of dataOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol or ID of the collateral asset type
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_credit_offers
start_id – Start credit deal id, fetch items whose IDs are greater than or equal to this ID
- Returns:
The credit deals
Public Functions
-
fc::variants get_objects(const vector<object_id_type> &ids, optional<bool> subscribe = optional<bool>()) const
Get the objects corresponding to the provided IDs.
If any of the provided IDs does not map to an object, a null variant is returned in its position.
Note
operation_history_object (1.11.x) and account_history_object (2.9.x) can not be subscribed.
- Parameters:
ids – IDs of the objects to retrieve
subscribe – true to subscribe to the queried objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
The objects retrieved, in the order they are mentioned in ids
-
void set_subscribe_callback(std::function<void(const variant&)> cb, bool notify_remove_create)
Register a callback handle which then can be used to subscribe to object database changes.
Note: auto-subscription is enabled by default and can be disabled with set_auto_subscription API.
- Parameters:
cb – The callback handle to register
notify_remove_create – Whether subscribe to universal object creation and removal events. If this is set to true, the API server will notify all newly created objects and ID of all newly removed objects to the client, no matter whether client subscribed to the objects. By default, API servers don’t allow subscribing to universal events, which can be changed on server startup.
-
void set_auto_subscription(bool enable)
Set auto-subscription behavior of follow-up API queries.
Impacts behavior of these APIs:
get_accounts
get_assets
get_objects
lookup_accounts
get_full_accounts
get_htlc
get_liquidity_pools
get_liquidity_pools_by_share_asset
Note: auto-subscription is enabled by default
See also
- Parameters:
enable – whether follow-up API queries will automatically subscribe to queried objects
-
void set_pending_transaction_callback(std::function<void(const variant &signed_transaction_object)> cb)
Register a callback handle which will get notified when a transaction is pushed to database.
Note: a transaction can be pushed to database and be popped from database several times while processing, before and after included in a block. Everytime when a push is done, the client will be notified.
- Parameters:
cb – The callback handle to register
-
void set_block_applied_callback(std::function<void(const variant &block_id)> cb)
Register a callback handle which will get notified when a block is pushed to database.
- Parameters:
cb – The callback handle to register
-
void cancel_all_subscriptions()
Stop receiving any notifications.
This unsubscribes from all subscribed markets and objects.
-
optional<maybe_signed_block_header> get_block_header(uint32_t block_num, const optional<bool> &with_witness_signature = optional<bool>()) const
Retrieve a block header.
- Parameters:
block_num – Height of the block whose header should be returned
with_witness_signature – Whether to return witness signature. Optional. If omitted or is false, will not return witness signature.
- Returns:
header of the referenced block, or null if no matching block was found
-
map<uint32_t, optional<maybe_signed_block_header>> get_block_header_batch(const vector<uint32_t> &block_nums, const optional<bool> &with_witness_signatures = optional<bool>()) const
Retrieve multiple block headers by block numbers.
- Parameters:
block_nums – vector containing heights of the blocks whose headers should be returned
with_witness_signatures – Whether to return witness signatures. Optional. If omitted or is false, will not return witness signatures.
- Returns:
array of headers of the referenced blocks, or null if no matching block was found
-
optional<signed_block> get_block(uint32_t block_num) const
Retrieve a full, signed block.
- Parameters:
block_num – Height of the block to be returned
- Returns:
the referenced block, or null if no matching block was found
-
processed_transaction get_transaction(uint32_t block_num, uint32_t trx_in_block) const
used to fetch an individual transaction.
- Parameters:
block_num – height of the block to fetch
trx_in_block – the index (sequence number) of the transaction in the block, starts from 0
- Returns:
the transaction at the given position
-
optional<signed_transaction> get_recent_transaction_by_id(const transaction_id_type &txid) const
If the transaction has not expired, this method will return the transaction for the given ID or it will return NULL if it is not known. Just because it is not known does not mean it wasn’t included in the blockchain.
- Parameters:
txid – hash of the transaction
- Returns:
the corresponding transaction if found, or null if not found
-
chain_property_object get_chain_properties() const
Retrieve the graphene::chain::chain_property_object associated with the chain.
-
global_property_object get_global_properties() const
Retrieve the current graphene::chain::global_property_object.
-
fc::variant_object get_config() const
Retrieve compile-time constants.
-
chain_id_type get_chain_id() const
Get the chain ID.
-
dynamic_global_property_object get_dynamic_global_properties() const
Retrieve the current graphene::chain::dynamic_global_property_object.
-
object_id_type get_next_object_id(uint8_t space_id, uint8_t type_id, bool with_pending_transactions) const
Get the next object ID in an object space.
- Parameters:
space_id – The space ID
type_id – The type ID
with_pending_transactions – Whether to include pending transactions
- Throws:
fc::exception – If the object space does not exist, or
with_pending_transactionsis false but the api_helper_indexes plugin is not enabled- Returns:
The next object ID to be assigned
-
vector<flat_set<account_id_type>> get_key_references(vector<public_key_type> keys) const
Get all accounts that refer to the specified public keys in their owner authority, active authorities or memo key.
- Parameters:
keys – a list of public keys to query, the quantity should not be greater than the configured value of api_limit_get_key_references
- Returns:
ID of all accounts that refer to the specified keys
-
bool is_public_key_registered(string public_key) const
Determine whether a textual representation of a public key (in Base-58 format) is currently linked to any registered (i.e. non-stealth) account on the blockchain
- Parameters:
public_key – Public key
- Returns:
Whether a public key is known
-
account_id_type get_account_id_from_string(const std::string &name_or_id) const
Get account object from a name or ID.
- Parameters:
name_or_id – name or ID of the account
- Returns:
Account ID
-
vector<optional<account_object>> get_accounts(const vector<std::string> &account_names_or_ids, optional<bool> subscribe = optional<bool>()) const
Get a list of accounts by names or IDs.
This function has semantics identical to get_objects
- Parameters:
account_names_or_ids – names or IDs of the accounts to retrieve
subscribe – true to subscribe to the queried account objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
The accounts corresponding to the provided names or IDs
-
map<string, full_account, std::less<>> get_full_accounts(const vector<string> &names_or_ids, const optional<bool> &subscribe = optional<bool>()) const
Fetch objects relevant to the specified accounts and optionally subscribe to updates.
This function fetches relevant objects for the given accounts, and subscribes to updates to the given accounts. If any of the strings in
names_or_idscannot be tied to an account, that input will be ignored. Other accounts will be retrieved and subscribed.Note
The maximum number of accounts allowed to subscribe per connection is configured by the api_limit_get_full_accounts_subscribe option. Exceeded subscriptions will be ignored.
Note
For each object type, the maximum number of objects to return is configured by the api_limit_get_full_accounts_lists option. Exceeded objects need to be queried with other APIs.
- Parameters:
names_or_ids – Each item must be the name or ID of an account to retrieve, the quantity should not be greater than the configured value of api_limit_get_full_accounts
subscribe – true to subscribe to the queried full account objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
Map of string from
names_or_idsto the corresponding account
-
vector<account_statistics_object> get_top_voters(uint32_t limit) const
Returns vector of voting power sorted by reverse vp_active.
- Parameters:
limit – Maximum number of accounts to retrieve, must not exceed the configured value of api_limit_get_top_voters
- Returns:
Desc Sorted voting power vector
-
optional<account_object> get_account_by_name(string name) const
Get info of an account by name.
- Parameters:
name – Name of the account to retrieve
- Returns:
The account holding the provided name
-
vector<account_id_type> get_account_references(const std::string account_name_or_id) const
Get all accounts that refer to the specified account in their owner or active authorities.
- Parameters:
account_name_or_id – Account name or ID to query
- Returns:
all accounts that refer to the specified account in their owner or active authorities
-
vector<optional<account_object>> lookup_account_names(const vector<string> &account_names) const
Get a list of accounts by name.
This function has semantics identical to get_objects, but doesn’t subscribe.
- Parameters:
account_names – Names of the accounts to retrieve
- Returns:
The accounts holding the provided names
-
map<string, account_id_type, std::less<>> lookup_accounts(const string &lower_bound_name, uint32_t limit, const optional<bool> &subscribe = optional<bool>()) const
Get names and IDs for registered accounts.
Note
In addition to the common auto-subscription rules, this API will subscribe to the returned account only if
limitis 1.- Parameters:
lower_bound_name – Lower bound of the first name to return
limit – Maximum number of results to return, must not exceed the configured value of api_limit_lookup_accounts
subscribe – true to subscribe to the queried account objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
Map of account names to corresponding IDs
-
vector<asset> get_account_balances(const std::string &account_name_or_id, const flat_set<asset_id_type> &assets) const
Get an account’s balances in various assets.
- Parameters:
account_name_or_id – name or ID of the account to get balances for
assets – IDs of the assets to get balances of; if empty, get all assets account has a balance in
- Returns:
Balances of the account
-
vector<asset> get_named_account_balances(const std::string &name, const flat_set<asset_id_type> &assets) const
Semantically equivalent to get_account_balances.
-
vector<balance_object> get_balance_objects(const vector<address> &addrs) const
Return all unclaimed balance objects for a list of addresses.
- Parameters:
addrs – a list of addresses
- Returns:
all unclaimed balance objects for the addresses
-
vector<asset> get_vested_balances(const vector<balance_id_type> &objs) const
Calculate how much assets in the given balance objects are able to be claimed at current head block time.
- Parameters:
objs – a list of balance object IDs
- Returns:
a list indicating how much asset in each balance object is available to be claimed
-
vector<vesting_balance_object> get_vesting_balances(const std::string account_name_or_id) const
Return all vesting balance objects owned by an account.
- Parameters:
account_name_or_id – name or ID of an account
- Returns:
all vesting balance objects owned by the account
-
uint64_t get_account_count() const
Get the total number of accounts registered with the blockchain.
-
asset_id_type get_asset_id_from_string(const std::string &symbol_or_id) const
Get asset ID from an asset symbol or ID.
- Parameters:
symbol_or_id – symbol name or ID of the asset
- Returns:
asset ID
-
vector<optional<extended_asset_object>> get_assets(const vector<std::string> &asset_symbols_or_ids, optional<bool> subscribe = optional<bool>()) const
Get a list of assets by symbol names or IDs.
This function has semantics identical to get_objects
- Parameters:
asset_symbols_or_ids – symbol names or IDs of the assets to retrieve
subscribe – true to subscribe to the queried asset objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
The assets corresponding to the provided symbol names or IDs
-
vector<extended_asset_object> list_assets(const string &lower_bound_symbol, uint32_t limit) const
Get assets alphabetically by symbol name.
- Parameters:
lower_bound_symbol – Lower bound of symbol names to retrieve
limit – Maximum number of assets to fetch, must not exceed the configured value of api_limit_get_assets
- Returns:
The assets found
-
vector<optional<extended_asset_object>> lookup_asset_symbols(const vector<string> &symbols_or_ids) const
Get a list of assets by symbol names or IDs.
This function has semantics identical to get_objects, but doesn’t subscribe
- Parameters:
symbols_or_ids – symbol names or IDs of the assets to retrieve
- Returns:
The assets corresponding to the provided symbols or IDs
-
uint64_t get_asset_count() const
Get assets count.
- Returns:
The assets count
-
vector<extended_asset_object> get_assets_by_issuer(const std::string &issuer_name_or_id, asset_id_type start, uint32_t limit) const
Get assets issued (owned) by a given account.
- Parameters:
issuer_name_or_id – Account name or ID to get objects from
start – Asset objects(1.3.X) before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of assets to retrieve, must not exceed the configured value of api_limit_get_assets
- Returns:
The assets issued (owned) by the account
-
vector<limit_order_object> get_limit_orders(std::string a, std::string b, uint32_t limit) const
Get limit orders in a given market.
- Parameters:
a – symbol or ID of asset being sold
b – symbol or ID of asset being purchased
limit – Maximum number of orders to retrieve, must not exceed the configured value of api_limit_get_limit_orders
- Returns:
The limit orders, ordered from least price to greatest
-
vector<limit_order_object> get_limit_orders_by_account(const string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<limit_order_id_type> &start_id = optional<limit_order_id_type>())
Fetch open limit orders in all markets relevant to the specified account, ordered by ID.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_limit_orders_by_account will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of ordersOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – The name or ID of an account to retrieve
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_limit_orders_by_account
start_id – Start order id, fetch orders whose IDs are greater than or equal to this order
- Returns:
List of limit orders of the specified account
-
vector<limit_order_object> get_account_limit_orders(const string &account_name_or_id, const string &base, const string "e, uint32_t limit = application_options::get_default().api_limit_get_account_limit_orders, optional<limit_order_id_type> ostart_id = optional<limit_order_id_type>(), optional<price> ostart_price = optional<price>())
Fetch all orders relevant to the specified account and specified market, result orders are sorted descendingly by price.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedostart_idandostart_pricecan be empty, if so the api will return the “first page” of orders; ifostart_idis specified, its price will be used to do page query preferentially, otherwise theostart_pricewill be used;ostart_idandostart_pricemay be used cooperatively in case of the order specified byostart_idwas just canceled accidentally, in such case, the result orders’ price may lower or equal toostart_price, but orders’ id greater thanostart_id
- Parameters:
account_name_or_id – The name or ID of an account to retrieve
base – Base asset
quote – Quote asset
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_account_limit_orders
ostart_id – Start order id, fetch orders which price lower than this order, or price equal to this order but order ID greater than this order
ostart_price – Fetch orders with price lower than or equal to this price
- Returns:
List of orders from
account_name_or_idto the corresponding account
-
vector<call_order_object> get_call_orders(const std::string &a, uint32_t limit) const
Get call orders (aka margin positions) for a given asset.
- Parameters:
a – symbol name or ID of the debt asset
limit – Maximum number of orders to retrieve, must not exceed the configured value of api_limit_get_call_orders
- Returns:
The call orders, ordered from earliest to be called to latest
-
vector<call_order_object> get_call_orders_by_account(const std::string &account_name_or_id, asset_id_type start, uint32_t limit) const
Get call orders (aka margin positions) of a given account.
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – Asset objects(1.3.X) before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of orders to retrieve, must not exceed the configured value of api_limit_get_call_orders
- Returns:
The call orders of the account
-
vector<force_settlement_object> get_settle_orders(const std::string &a, uint32_t limit) const
Get forced settlement orders in a given asset.
- Parameters:
a – Symbol or ID of asset being settled
limit – Maximum number of orders to retrieve, must not exceed the configured value of api_limit_get_settle_orders
- Returns:
The settle orders, ordered from earliest settlement date to latest
-
vector<force_settlement_object> get_settle_orders_by_account(const std::string &account_name_or_id, force_settlement_id_type start, uint32_t limit) const
Get forced settlement orders of a given account.
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – Force settlement objects(1.4.X) before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of orders to retrieve, must not exceed the configured value of api_limit_get_settle_orders
- Returns:
The settle orders, ordered from earliest settlement date to latest
- Returns:
The settle orders of the account
-
vector<collateral_bid_object> get_collateral_bids(const std::string &a, uint32_t limit, uint32_t start) const
Get collateral_bid_objects for a given asset.
- Parameters:
a – Symbol or ID of asset
limit – Maximum number of objects to retrieve, must not exceed the configured value of api_limit_get_collateral_bids
start – skip that many results
- Returns:
The settle orders, ordered from earliest settlement date to latest
-
vector<call_order_object> get_margin_positions(const std::string &account_name_or_id) const
Get open margin positions of a given account.
Similar to get_call_orders_by_account, but only the first page will be returned, the page size is the configured value of api_limit_get_call_orders.
- Parameters:
account_name_or_id – name or ID of an account
- Returns:
open margin positions of the account
-
void subscribe_to_market(std::function<void(const variant&)> callback, const std::string &a, const std::string &b)
Request notification when the active orders in the market between two assets changes.
Callback will be passed a variant containing a vector<pair<operation, operation_result>>. The vector will contain, in order, the operations which changed the market, and their results.
- Parameters:
callback – Callback method which is called when the market changes
a – symbol name or ID of the first asset
b – symbol name or ID of the second asset
-
void unsubscribe_from_market(const std::string &a, const std::string &b)
Unsubscribe from updates to a given market.
- Parameters:
a – symbol name or ID of the first asset
b – symbol name or ID of the second asset
-
market_ticker get_ticker(const string &base, const string "e) const
Returns the ticker for the market assetA:assetB.
- Parameters:
base – symbol name or ID of the base asset
quote – symbol name or ID of the quote asset
- Returns:
The market ticker for the past 24 hours.
-
market_volume get_24_volume(const string &base, const string "e) const
Returns the 24 hour volume for the market assetA:assetB.
- Parameters:
base – symbol name or ID of the base asset
quote – symbol name or ID of the quote asset
- Returns:
The market volume over the past 24 hours
-
order_book get_order_book(const string &base, const string "e, uint32_t limit = application_options::get_default().api_limit_get_order_book) const
Returns the order book for the market base:quote.
- Parameters:
base – symbol name or ID of the base asset
quote – symbol name or ID of the quote asset
limit – depth of the order book to retrieve, for bids and asks each, capped at the configured value of api_limit_get_order_book and api_limit_get_limit_orders
- Returns:
Order book of the market
-
vector<market_ticker> get_top_markets(uint32_t limit) const
Returns vector of tickers sorted by reverse base_volume.
Note
this API is experimental and subject to change in next releases
- Parameters:
limit – Max number of results, must not exceed the configured value of api_limit_get_top_markets
- Returns:
Desc Sorted ticker vector
-
vector<market_trade> get_trade_history(const string &base, const string "e, fc::time_point_sec start, fc::time_point_sec stop, uint32_t limit = application_options::get_default().api_limit_get_trade_history) const
Get market transactions occurred in the market base:quote, ordered by time, most recent first.
Note
The time must be UTC, timezone offsets are not supported. The range is [stop, start]. In case when there are more transactions than
limitoccurred in the same second, this API only returns the most recent records, the rest records can be retrieved with the get_trade_history_by_sequence API.- Parameters:
base – symbol or ID of the base asset
quote – symbol or ID of the quote asset
start – Start time as a UNIX timestamp, the latest transactions to retrieve
stop – Stop time as a UNIX timestamp, the earliest transactions to retrieve
limit – Maximum quantity of transactions to retrieve, capped at the configured value of api_limit_get_trade_history
- Returns:
Transactions in the market
-
vector<market_trade> get_trade_history_by_sequence(const string &base, const string "e, int64_t start, fc::time_point_sec stop, uint32_t limit = application_options::get_default().api_limit_get_trade_history_by_sequence) const
Get market transactions occurred in the market base:quote, ordered by time, most recent first.
Note
The time must be UTC, timezone offsets are not supported. The range is [stop, start].
- Parameters:
base – symbol or ID of the base asset
quote – symbol or ID of the quote asset
start – Start sequence as an Integer, the latest transaction to retrieve
stop – Stop time as a UNIX timestamp, the earliest transactions to retrieve
limit – Maximum quantity of transactions to retrieve, capped at the configured value of api_limit_get_trade_history_by_sequence
- Returns:
Transactions in the market
-
vector<extended_liquidity_pool_object> list_liquidity_pools(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<liquidity_pool_id_type> &start_id = optional<liquidity_pool_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools.
Note
limitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start liquidity pool id, fetch pools whose IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<extended_liquidity_pool_object> get_liquidity_pools_by_asset_a(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<liquidity_pool_id_type> &start_id = optional<liquidity_pool_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by the symbol or ID of the first asset in the pool.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol name or ID of the asset
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start liquidity pool id, fetch pools whose IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<extended_liquidity_pool_object> get_liquidity_pools_by_asset_b(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<liquidity_pool_id_type> &start_id = optional<liquidity_pool_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by the symbol or ID of the second asset in the pool.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol name or ID of the asset
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start liquidity pool id, fetch pools whose IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<extended_liquidity_pool_object> get_liquidity_pools_by_one_asset(const std::string &asset_symbol_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<liquidity_pool_id_type> &start_id = optional<liquidity_pool_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by the symbol or ID of one asset in the pool.
Note
If
asset_symbol_or_idcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id – symbol name or ID of the asset
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start liquidity pool id, fetch pools whose IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<extended_liquidity_pool_object> get_liquidity_pools_by_both_assets(const std::string &asset_symbol_or_id_a, const std::string &asset_symbol_or_id_b, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<liquidity_pool_id_type> &start_id = optional<liquidity_pool_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by the symbols or IDs of the two assets in the pool.
Note
If
asset_symbol_or_id_aorasset_symbol_or_id_bcannot be tied to an asset, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
asset_symbol_or_id_a – symbol name or ID of one asset
asset_symbol_or_id_b – symbol name or ID of the other asset
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start liquidity pool id, fetch pools whose IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<optional<extended_liquidity_pool_object>> get_liquidity_pools(const vector<liquidity_pool_id_type> &ids, const optional<bool> &subscribe = optional<bool>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by their IDs.
Note
if an ID in the list can not be found, the corresponding data in the returned list is null.
- Parameters:
ids – IDs of the liquidity pools, the quantity should not be greater than the configured value of api_limit_get_liquidity_pools
subscribe – true to subscribe to the queried objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
Get a list of liquidity pools by their share asset symbols or IDs.
Note
if an asset in the list can not be found or is not a share asset of any liquidity pool, the corresponding data in the returned list is null.
- Parameters:
asset_symbols_or_ids – symbol names or IDs of the share assets, the quantity should not be greater than the configured value of api_limit_get_liquidity_pools
subscribe – true to subscribe to the queried objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
with_statistics – Whether to return statistics
- Returns:
The liquidity pools that the assets are for
-
vector<extended_liquidity_pool_object> get_liquidity_pools_by_owner(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<asset_id_type> &start_id = optional<asset_id_type>(), const optional<bool> &with_statistics = false) const
Get a list of liquidity pools by the name or ID of the owner account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_liquidity_pools will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of poolsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the owner account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_liquidity_pools
start_id – Start share asset id, fetch pools whose share asset IDs are greater than or equal to this ID
with_statistics – Whether to return statistics
- Returns:
The liquidity pools
-
vector<optional<witness_object>> get_witnesses(const vector<witness_id_type> &witness_ids) const
Get a list of witnesses by ID.
This function has semantics identical to get_objects, but doesn’t subscribe
- Parameters:
witness_ids – IDs of the witnesses to retrieve
- Returns:
The witnesses corresponding to the provided IDs
-
fc::optional<witness_object> get_witness_by_account(const std::string &account_name_or_id) const
Get the witness owned by a given account.
- Parameters:
account_name_or_id – The name or ID of the account whose witness should be retrieved
- Returns:
The witness object, or null if the account does not have a witness
-
map<string, witness_id_type, std::less<>> lookup_witness_accounts(const string &lower_bound_name, uint32_t limit) const
Get names and IDs for registered witnesses.
- Parameters:
lower_bound_name – Lower bound of the first name to return
limit – Maximum number of results to return, must not exceed the configured value of api_limit_lookup_witness_accounts
- Returns:
Map of witness names to corresponding IDs
-
uint64_t get_witness_count() const
Get the total number of witnesses registered with the blockchain.
-
vector<optional<committee_member_object>> get_committee_members(const vector<committee_member_id_type> &committee_member_ids) const
Get a list of committee_members by ID.
This function has semantics identical to get_objects, but doesn’t subscribe
- Parameters:
committee_member_ids – IDs of the committee_members to retrieve
- Returns:
The committee_members corresponding to the provided IDs
-
fc::optional<committee_member_object> get_committee_member_by_account(const string &account_name_or_id) const
Get the committee_member owned by a given account.
- Parameters:
account_name_or_id – The name or ID of the account whose committee_member should be retrieved
- Returns:
The committee_member object, or null if the account does not have a committee_member
-
map<string, committee_member_id_type, std::less<>> lookup_committee_member_accounts(const string &lower_bound_name, uint32_t limit) const
Get names and IDs for registered committee_members.
- Parameters:
lower_bound_name – Lower bound of the first name to return
limit – Maximum number of results to return, must not exceed the configured value of api_limit_lookup_committee_member_accounts
- Returns:
Map of committee_member names to corresponding IDs
-
uint64_t get_committee_count() const
Get the total number of committee registered with the blockchain.
-
vector<worker_object> get_all_workers(const optional<bool> &is_expired = optional<bool>()) const
Get workers.
- Parameters:
is_expired – null for all workers, true for expired workers only, false for non-expired workers only
- Returns:
A list of worker objects
-
vector<worker_object> get_workers_by_account(const std::string &account_name_or_id) const
Get the workers owned by a given account.
- Parameters:
account_name_or_id – The name or ID of the account whose worker should be retrieved
- Returns:
A list of worker objects owned by the account
-
uint64_t get_worker_count() const
Get the total number of workers registered with the blockchain.
-
vector<variant> lookup_vote_ids(const vector<vote_id_type> &votes) const
Given a set of votes, return the objects they are voting for.
This will be a mixture of committee_member_objects, witness_objects, and worker_objects
The results will be in the same order as the votes. Null will be returned for any vote IDs that are not found.
- Parameters:
votes – a list of vote IDs, the quantity should not be greater than the configured value of api_limit_lookup_vote_ids
- Returns:
the referenced objects
-
std::string get_transaction_hex(const signed_transaction &trx) const
Get a hexdump of the serialized binary form of a transaction.
- Parameters:
trx – a transaction to get hexdump from
- Returns:
the hexdump of the transaction
-
std::string get_transaction_hex_without_sig(const transaction &trx) const
Get a hexdump of the serialized binary form of a signatures-stripped transaction.
- Parameters:
trx – a transaction to get hexdump from
- Returns:
the hexdump of the transaction without the signatures
-
set<public_key_type> get_required_signatures(const signed_transaction &trx, const flat_set<public_key_type> &available_keys) const
This API will take a partially signed transaction and a set of public keys that the owner has the ability to sign for and return the minimal subset of public keys that should add signatures to the transaction.
- Parameters:
trx – the transaction to be signed
available_keys – a set of public keys
- Returns:
a subset of
available_keysthat could sign for the given transaction
-
set<public_key_type> get_potential_signatures(const signed_transaction &trx) const
This method will return the set of all public keys that could possibly sign for a given transaction. This call can be used by wallets to filter their set of public keys to just the relevant subset prior to calling get_required_signatures to get the minimum subset.
- Parameters:
trx – the transaction to be signed
- Returns:
a set of public keys that could possibly sign for the given transaction
-
set<address> get_potential_address_signatures(const signed_transaction &trx) const
This method will return the set of all addresses that could possibly sign for a given transaction.
- Parameters:
trx – the transaction to be signed
- Returns:
a set of addresses that could possibly sign for the given transaction
-
bool verify_authority(const signed_transaction &trx) const
Check whether a transaction has all of the required signatures
- Parameters:
trx – a transaction to be verified
- Returns:
true if the
trxhas all of the required signatures, otherwise throws an exception
-
bool verify_account_authority(const string &account_name_or_id, const flat_set<public_key_type> &signers) const
Verify that the public keys have enough authority to approve an operation for this account.
- Parameters:
account_name_or_id – name or ID of an account to check
signers – the public keys
- Returns:
true if the passed in keys have enough authority to approve an operation for this account
-
processed_transaction validate_transaction(const signed_transaction &trx) const
Validates a transaction against the current state without broadcasting it on the network.
- Parameters:
trx – a transaction to be validated
- Returns:
a processed_transaction object if the transaction passes the validation, otherwise an exception will be thrown
-
vector<fc::variant> get_required_fees(const vector<operation> &ops, const std::string &asset_symbol_or_id) const
For each operation calculate the required fee in the specified asset type.
- Parameters:
ops – a list of operations to be query for required fees
asset_symbol_or_id – symbol name or ID of an asset that to be used to pay the fees
- Returns:
a list of objects which indicates required fees of each operation
-
vector<proposal_object> get_proposed_transactions(const std::string account_name_or_id) const
return a set of proposed transactions (aka proposals) that the specified account can add approval to or remove approval from
- Parameters:
account_name_or_id – The name or ID of an account
- Returns:
a set of proposed transactions that the specified account can act on
-
vector<blinded_balance_object> get_blinded_balances(const flat_set<commitment_type> &commitments) const
return the set of blinded balance objects by commitment ID
- Parameters:
commitments – a set of commitments to query for
- Returns:
the set of blinded balance objects by commitment ID
-
vector<withdraw_permission_object> get_withdraw_permissions_by_giver(const std::string account_name_or_id, withdraw_permission_id_type start, uint32_t limit) const
Get non expired withdraw permission objects for a giver(ex:recurring customer)
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – Withdraw permission objects(1.12.X) before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of objects to retrieve, must not exceed the configured value of api_limit_get_withdraw_permissions_by_giver
- Returns:
Withdraw permission objects for the account
-
vector<withdraw_permission_object> get_withdraw_permissions_by_recipient(const std::string account_name_or_id, withdraw_permission_id_type start, uint32_t limit) const
Get non expired withdraw permission objects for a recipient(ex:service provider)
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – Withdraw permission objects(1.12.X) before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of objects to retrieve, must not exceed the configured value of api_limit_get_withdraw_permissions_by_recipient
- Returns:
Withdraw permission objects for the account
-
optional<htlc_object> get_htlc(htlc_id_type id, optional<bool> subscribe = optional<bool>()) const
Get HTLC object.
- Parameters:
id – HTLC contract id
subscribe – true to subscribe to the queried HTLC objects, false to not subscribe, null to subscribe or not subscribe according to current auto-subscription setting (see set_auto_subscription)
- Returns:
HTLC object for the id
-
vector<htlc_object> get_htlc_by_from(const std::string account_name_or_id, htlc_id_type start, uint32_t limit) const
Get non expired HTLC objects using the sender account.
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – htlc objects before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of objects to retrieve, must not exceed the configured value of api_limit_get_htlc_by
- Returns:
HTLC objects for the account
-
vector<htlc_object> get_htlc_by_to(const std::string account_name_or_id, htlc_id_type start, uint32_t limit) const
Get non expired HTLC objects using the receiver account.
- Parameters:
account_name_or_id – Account name or ID to get objects from
start – htlc objects before this ID will be skipped in results. Pagination purposes.
limit – Maximum number of objects to retrieve, must not exceed the configured value of api_limit_get_htlc_by
- Returns:
HTLC objects for the account
-
vector<htlc_object> list_htlcs(const htlc_id_type start, uint32_t limit) const
Get all HTLCs.
- Parameters:
start – Lower bound of htlc id to start getting results
limit – Maximum number of htlc objects to fetch, must not exceed the configured value of api_limit_list_htlcs
- Returns:
The htlc object list
-
vector<ticket_object> list_tickets(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<ticket_id_type> &start_id = optional<ticket_id_type>()) const
Get a list of tickets.
Note
limitcan be omitted or be null, if so the configured value of api_limit_get_tickets will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of ticketsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_tickets
start_id – Start ticket id, fetch tickets whose IDs are greater than or equal to this ID
- Returns:
The tickets
-
vector<ticket_object> get_tickets_by_account(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<ticket_id_type> &start_id = optional<ticket_id_type>()) const
Get a list of tickets by the name or ID of the owner account.
Note
If
account_name_or_idcannot be tied to an account, an error will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_tickets will be usedstart_idcan be omitted or be null, if so the api will return the “first page” of ticketsOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – name or ID of the owner account
limit – The limitation of items each query can fetch, not greater than the configured value of api_limit_get_tickets
start_id – Start ticket id, fetch tickets whose IDs are greater than or equal to this ID
- Returns:
The tickets
-
vector<samet_fund_object> list_samet_funds(const optional<uint32_t> &limit = optional<uint32_t>(), const optional<samet_fund_id_type> &start_id = optional<samet_fund_id_type>()) const
-
class database_api_helper
- #include <database_api_helper.hxx>
Subclassed by graphene::app::database_api_impl
-
class database_api_impl : public std::enable_shared_from_this<database_api_impl>, public graphene::app::database_api_helper
- #include <database_api_impl.hxx>
Public Functions
-
vector<flat_set<account_id_type>> get_key_references(vector<public_key_type> key) const
- Returns:
all accounts that referr to the key or account id in their owner or active authorities.
-
void on_objects_new(const vector<object_id_type> &ids, const flat_set<account_id_type> &impacted_accounts)
called every time a block is applied to report the objects that were changed
-
void on_applied_block()
note: this method cannot yield because it is called in the middle of apply a block.
-
vector<flat_set<account_id_type>> get_key_references(vector<public_key_type> key) const
-
struct dummy_api
- #include <api.hpp>
A dummy API class that does nothing, used when access to database_api is not allowed.
-
struct extended_asset_object : public graphene::chain::asset_object
- #include <api_objects.hpp>
-
struct extended_liquidity_pool_object : public graphene::chain::liquidity_pool_object
- #include <api_objects.hpp>
-
struct full_account
- #include <api_objects.hpp>
-
struct get_required_fees_helper
Container method for mutually recursive functions used to implement get_required_fees() with potentially nested proposals.
-
class history_api
- #include <api.hpp>
The history_api class implements the RPC API for account history.
This API contains methods to access account histories
Public Functions
-
vector<operation_history_object> get_account_history(const std::string &account_name_or_id, operation_history_id_type stop = operation_history_id_type(), uint32_t limit = application_options::get_default().api_limit_get_account_history, operation_history_id_type start = operation_history_id_type()) const
Get the history of operations related to the specified account.
- Parameters:
account_name_or_id – The account name or ID whose history should be queried
stop – ID of the earliest operation to retrieve
limit – Maximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history
start – ID of the most recent operation to retrieve
- Returns:
A list of operations related to the specified account, ordered from most recent to oldest.
-
vector<operation_history_object> get_account_history_by_time(const std::string &account_name_or_id, const optional<uint32_t> &limit = optional<uint32_t>(), const optional<fc::time_point_sec> &start = optional<fc::time_point_sec>()) const
Get the history of operations related to the specified account no later than the specified time.
Note
If
account_name_or_idcannot be tied to an account, an empty list will be returnedlimitcan be omitted or be null, if so the configured value of api_limit_get_account_history will be usedstartcan be omitted or be null, if so the api will return the “first page” of the historyOne or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
account_name_or_id – The account name or ID whose history should be queried
limit – Maximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history
start – the time point to start looping back through history
- Returns:
A list of operations related to the specified account, ordered from most recent to oldest.
-
history_operation_detail get_account_history_by_operations(const std::string &account_name_or_id, const flat_set<uint16_t> &operation_types, uint32_t start, uint32_t limit) const
Get the history of operations related to the specified account filtering by operation types.
- Parameters:
account_name_or_id – The account name or ID whose history should be queried
operation_types – The IDs of the operation we want to get operations in the account ( 0 = transfer , 1 = limit order create, …)
start – the sequence number where to start looping back through the history
limit – the max number of entries to return (from start number), must not exceed the configured value of api_limit_get_account_history_by_operations
- Returns:
-
vector<operation_history_object> get_account_history_operations(const std::string &account_name_or_id, int64_t operation_type, operation_history_id_type start = operation_history_id_type(), operation_history_id_type stop = operation_history_id_type(), uint32_t limit = application_options::get_default().api_limit_get_account_history_operations) const
Get the history of operations related to the specified account filtering by operation type.
- Parameters:
account_name_or_id – The account name or ID whose history should be queried
operation_type – The type of the operation we want to get operations in the account ( 0 = transfer , 1 = limit order create, …)
stop – ID of the earliest operation to retrieve
limit – Maximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history_operations
start – ID of the most recent operation to retrieve
- Returns:
A list of operations related to the specified account, ordered from most recent to oldest.
-
vector<operation_history_object> get_relative_account_history(const std::string &account_name_or_id, uint64_t stop = 0, uint32_t limit = application_options::get_default().api_limit_get_relative_account_history, uint64_t start = 0) const
Get the history of operations related to the specified account referenced by an event numbering specific to the account. The current number of operations for the account can be found in the account statistics (or use 0 for start).
- Parameters:
account_name_or_id – The account name or ID whose history should be queried
stop – Sequence number of earliest operation. 0 is default and will query ‘limit’ number of operations.
limit – Maximum number of operations to retrieve, must not exceed the configured value of api_limit_get_relative_account_history
start – Sequence number of the most recent operation to retrieve. 0 is default, which will start querying from the most recent operation.
- Returns:
A list of operations related to the specified account, ordered from most recent to oldest.
-
vector<operation_history_object> get_block_operation_history(uint32_t block_num, const optional<uint16_t> &trx_in_block = {}) const
Get all operations within a block or a transaction, including virtual operations.
Note
the data is fetched from the account_history plugin, so results may be incomplete due to the partial-operations option configured in the API node. To get complete data, it is recommended to query from ElasticSearch where the data is maintained by the elastic_search plugin.
- Parameters:
block_num – the number (height) of the block to fetch
trx_in_block – the sequence of a transaction in the block, starts from 0, optional. If specified, will return only operations of that transaction. If omitted, will return all operations in the specified block.
- Returns:
a list of operation_history objects ordered by ID
-
vector<operation_history_object> get_block_operations_by_time(const optional<fc::time_point_sec> &start = optional<fc::time_point_sec>()) const
Get all operations, including virtual operations, within the most recent block (no later than the specified time) containing at least one operation.
Note
the data is fetched from the account_history plugin, so results may be incomplete or incorrect due to the partial-operations option configured in the API node. To get complete data, it is recommended to query from ElasticSearch where the data is maintained by the elastic_search plugin.
- Parameters:
start – time point, optional, if omitted, the data of the latest block containing at least one operation will be returned
- Returns:
a list of operation_history objects ordered by ID in descending order
-
vector<order_history_object> get_fill_order_history(const std::string &a, const std::string &b, uint32_t limit) const
Get details of order executions occurred most recently in a trading pair.
- Parameters:
a – Asset symbol or ID in a trading pair
b – The other asset symbol or ID in the trading pair
limit – Maximum records to return
- Returns:
a list of order_history objects, in “most recent first” order
-
vector<bucket_object> get_market_history(const std::string &a, const std::string &b, uint32_t bucket_seconds, const fc::time_point_sec &start, const fc::time_point_sec &end) const
Get OHLCV data of a trading pair in a time range.
- Parameters:
a – Asset symbol or ID in a trading pair
b – The other asset symbol or ID in the trading pair
bucket_seconds – Length of each time bucket in seconds. Note: it need to be within result of get_market_history_buckets() API, otherwise no data will be returned
start – The start of a time range, E.G. “2018-01-01T00:00:00”
end – The end of the time range
- Returns:
A list of OHLCV data, in “least recent first” order. If there are more records in the specified time range than the configured value of api_limit_get_market_history, only the first records will be returned.
-
flat_set<uint32_t> get_market_history_buckets() const
Get OHLCV time bucket lengths supported (configured) by this API server.
- Returns:
A list of time bucket lengths in seconds. E.G. if the result contains a number “300”, it means this API server supports OHLCV data aggregated in 5-minute buckets.
-
vector<liquidity_pool_history_object> get_liquidity_pool_history(liquidity_pool_id_type pool_id, const optional<fc::time_point_sec> &start = optional<fc::time_point_sec>(), const optional<fc::time_point_sec> &stop = optional<fc::time_point_sec>(), const optional<uint32_t> &limit = optional<uint32_t>(), const optional<int64_t> &operation_type = optional<int64_t>()) const
Get history of a liquidity pool.
Note
The time must be UTC. The range is (stop, start].
In case when there are more operations than
limitoccurred in the same second, this API only returns the most recent records, the rest records can be retrieved with the get_liquidity_pool_history_by_sequence API.List of operation type code: 59-creation, 60-deletion, 61-deposit, 62-withdrawal, 63-exchange.
One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
pool_id – ID of the liquidity pool to query
start – A UNIX timestamp. Optional. If specified, only the operations occurred not later than this time will be returned.
stop – A UNIX timestamp. Optional. If specified, only the operations occurred later than this time will be returned.
limit – Maximum quantity of operations in the history to retrieve. Optional. If not specified, the configured value of api_limit_get_liquidity_pool_history will be used. If specified, it must not exceed the configured value of api_limit_get_liquidity_pool_history.
operation_type – Optional. If specified, only the operations whose type is the specified type will be returned. Otherwise all operations will be returned.
- Returns:
operation history of the liquidity pool, ordered by time, most recent first.
-
vector<liquidity_pool_history_object> get_liquidity_pool_history_by_sequence(liquidity_pool_id_type pool_id, const optional<uint64_t> &start = optional<uint64_t>(), const optional<fc::time_point_sec> &stop = optional<fc::time_point_sec>(), const optional<uint32_t> &limit = optional<uint32_t>(), const optional<int64_t> &operation_type = optional<int64_t>()) const
Get history of a liquidity pool.
Note
The time must be UTC. The range is (stop, start].
List of operation type code: 59-creation, 60-deletion, 61-deposit, 62-withdrawal, 63-exchange.
One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).
- Parameters:
pool_id – ID of the liquidity pool to query
start – An Integer. Optional. If specified, only the operations whose sequences are not greater than this will be returned.
stop – A UNIX timestamp. Optional. If specified, only operations occurred later than this time will be returned.
limit – Maximum quantity of operations in the history to retrieve. Optional. If not specified, the configured value of api_limit_get_liquidity_pool_history will be used. If specified, it must not exceed the configured value of api_limit_get_liquidity_pool_history.
operation_type – Optional. If specified, only the operations whose type is the specified type will be returned. Otherwise all operations will be returned.
- Returns:
operation history of the liquidity pool, ordered by time, most recent first.
-
struct history_operation_detail
- #include <api.hpp>
-
vector<operation_history_object> get_account_history(const std::string &account_name_or_id, operation_history_id_type stop = operation_history_id_type(), uint32_t limit = application_options::get_default().api_limit_get_account_history, operation_history_id_type start = operation_history_id_type()) const
-
class login_api
- #include <api.hpp>
The login_api class implements the bottom layer of the RPC API.
All other APIs must be requested from this API.
Public Functions
-
variant login(const optional<string> &user, const optional<string> &password)
Authenticate to the RPC server, or retrieve the API set ID of the login API set.
Note
Provide both
userandpasswordto authenticate, or provide none of them (or null without quotes) to retrieve the API set ID of the login API set.Note
This is called automatically for authentication when a HTTP or WebSocket connection is established, assuming credentials are provided with HTTP Basic authentication headers.
Note
When trying to authenticate again, even if failed to log in, already allocated API set IDs are still accessible.
- Parameters:
user – Username to login with, optional
password – Password to login with, optional
- Returns:
true if to authenticate and logged in successfully, false if to authenticate and failed to log in, or the API set ID if to retrieve it
-
bool logout()
Log out.
Note
Already allocated API set IDs are still accessible after calling this.
- Returns:
false
-
string get_info() const
Retrive the node info string configured by the node operator.
-
application_options get_config() const
Retrieve configured application options.
Note
It requires the user to be logged in and have access to at least one API set other than login_api.
-
flat_set<string> get_available_api_sets() const
Retrieve a list of API sets that the user has access to.
-
fc::api<network_broadcast_api> network_broadcast()
Retrieve the network broadcast API set.
-
fc::api<database_api> database()
Retrieve the database API set.
-
fc::api<history_api> history()
Retrieve the history API set.
-
fc::api<network_node_api> network_node()
Retrieve the network node API set.
-
fc::api<crypto_api> crypto()
Retrieve the cryptography API set.
-
fc::api<orders_api> orders()
Retrieve the orders API set.
-
fc::api<graphene::debug_witness::debug_api> debug()
Retrieve the debug API set.
-
fc::api<custom_operations_api> custom_operations()
Retrieve the custom operations API set.
-
bool is_database_api_allowed() const
Check whether database_api is allowed, not reflected.
- Returns:
true if database_api is allowed, false otherwise
-
variant login(const optional<string> &user, const optional<string> &password)
-
struct market_ticker
- #include <api_objects.hpp>
-
struct market_trade
- #include <api_objects.hpp>
-
struct market_volume
- #include <api_objects.hpp>
-
struct maybe_signed_block_header : public graphene::protocol::block_header
- #include <api_objects.hpp>
-
struct more_data
- #include <api_objects.hpp>
-
class network_broadcast_api : public std::enable_shared_from_this<network_broadcast_api>
- #include <api.hpp>
The network_broadcast_api class allows broadcasting of transactions.
Public Functions
-
void broadcast_transaction(const precomputable_transaction &trx)
Broadcast a transaction to the network.
The transaction will be checked for validity in the local database prior to broadcasting. If it fails to apply locally, an error will be thrown and the transaction will not be broadcast.
- Parameters:
trx – The transaction to broadcast
-
void broadcast_transaction_with_callback(confirmation_callback cb, const precomputable_transaction &trx)
This version of broadcast transaction registers a callback method that will be called when the transaction is included into a block. The callback method includes the transaction id, block number, and transaction number in the block.
- Parameters:
cb – the callback method
trx – the transaction
-
fc::variant broadcast_transaction_synchronous(const precomputable_transaction &trx)
This version of broadcast transaction waits until the transaction is included into a block, then the transaction id, block number, and transaction number in the block will be returned.
- Parameters:
trx – the transaction
- Returns:
info about the block including the transaction
-
void broadcast_block(const signed_block &block)
Broadcast a signed block to the network.
- Parameters:
block – The signed block to broadcast
-
void on_applied_block(const signed_block &b)
Not reflected, thus not accessible to API clients.
This function is registered to receive the applied_block signal from the chain database when a block is received. It then dispatches callbacks to clients who have requested to be notified when a particular txid is included in a block.
-
struct transaction_confirmation
- #include <api.hpp>
-
void broadcast_transaction(const precomputable_transaction &trx)
-
class network_node_api
- #include <api.hpp>
The network_node_api class allows maintenance of p2p connections.
Public Functions
-
fc::variant_object get_info() const
Return general network information, such as p2p port.
-
void add_node(const fc::ip::endpoint &ep)
add_node Connect to a new peer
- Parameters:
ep – The IP/Port of the peer to connect to
-
std::vector<net::peer_status> get_connected_peers() const
Get status of all current connections to peers.
-
fc::variant_object get_advanced_node_parameters() const
Get advanced node parameters, such as desired and max number of connections.
-
void set_advanced_node_parameters(const fc::variant_object ¶ms)
Set advanced node parameters, such as desired and max number of connections.
- Parameters:
params – a JSON object containing the name/value pairs for the parameters to set
-
std::vector<net::potential_peer_record> get_potential_peers() const
Return list of potential peers.
-
fc::variant_object get_info() const
-
struct order
- #include <api_objects.hpp>
-
struct order_book
- #include <api_objects.hpp>
-
class orders_api
- #include <api.hpp>
the orders_api class exposes access to data processed with grouped orders plugin.
Public Functions
-
flat_set<uint16_t> get_tracked_groups() const
Get tracked groups configured by the server.
- Returns:
A list of numbers which indicate configured groups, of those, 1 means 0.01% diff on price.
-
vector<limit_order_group> get_grouped_limit_orders(const std::string &base_asset, const std::string "e_asset, uint16_t group, const optional<price> &start, uint32_t limit) const
Get grouped limit orders in given market.
- Parameters:
base_asset – symbol or ID of asset being sold
quote_asset – symbol or ID of asset being purchased
group – Maximum price diff within each order group, have to be one of configured values
start – Optional price to indicate the first order group to retrieve
limit – Maximum number of order groups to retrieve, must not exceed the configured value of api_limit_get_grouped_limit_orders
- Returns:
The grouped limit orders, ordered from best offered price to worst
-
struct limit_order_group
- #include <api.hpp>
summary data of a group of limit orders
-
flat_set<uint16_t> get_tracked_groups() const
-
class plugin : public graphene::app::abstract_plugin
- #include <plugin.hpp>
Provides basic default implementations of abstract_plugin functions.
Subclassed by graphene::account_history::account_history_plugin, graphene::api_helper_indexes::api_helper_indexes, graphene::custom_operations::custom_operations_plugin, graphene::debug_witness_plugin::debug_witness_plugin, graphene::delayed_node::delayed_node_plugin, graphene::elasticsearch::elasticsearch_plugin, graphene::es_objects::es_objects_plugin, graphene::grouped_orders::grouped_orders_plugin, graphene::market_history::market_history_plugin, graphene::snapshot_plugin::snapshot_plugin, graphene::template_plugin::template_plugin, graphene::witness_plugin::witness_plugin
Public Functions
-
virtual std::string plugin_name() const override
Get the name of the plugin.
-
virtual std::string plugin_description() const override
Get the description of the plugin.
-
virtual void plugin_initialize(const boost::program_options::variables_map &options) override
Perform early startup routines and register plugin indexes, callbacks, etc.
Plugins MUST supply a method initialize() which will be called early in the application startup. This method should contain early setup code such as initializing variables, adding indexes to the database, registering callback methods from the database, adding APIs, etc., as well as applying any options in the
optionsmapThis method is called BEFORE the database is open, therefore any routines which require any chain state MUST NOT be called by this method. These routines should be performed in startup() instead.
- Parameters:
options – The options passed to the application, via configuration files or command line
-
virtual void plugin_startup() override
Begin normal runtime operations.
Plugins MUST supply a method startup() which will be called at the end of application startup. This method should contain code which schedules any tasks, or requires chain state.
-
virtual void plugin_shutdown() override
Cleanly shut down the plugin.
This is called to request a clean shutdown (e.g. due to SIGINT or SIGTERM).
-
virtual void plugin_set_program_options(boost::program_options::options_description &command_line_options, boost::program_options::options_description &config_file_options) override
Fill in command line parameters used by the plugin.
This method populates its arguments with any command-line and configuration file options the plugin supports. If a plugin does not need these options, it may simply provide an empty implementation of this method.
- Parameters:
command_line_options – All options this plugin supports taking on the command-line
config_file_options – All options this plugin supports storing in a configuration file
-
virtual std::string plugin_name() const override
-
namespace detail
Functions
-
graphene::chain::genesis_state_type create_example_genesis()
-
class application_impl : public graphene::net::node_delegate, public std::enable_shared_from_this<application_impl>
- #include <application_impl.hxx>
Public Functions
-
virtual bool has_item(const net::item_id &id) override
If delegate has the item, the network has no need to fetch it.
-
bool handle_block(const graphene::net::block_message &blk_msg, bool sync_mode, std::vector<graphene::net::message_hash_type> &contained_transaction_msg_ids) override
allows the application to validate an item prior to broadcasting to peers.
- Parameters:
blk_msg – the message which contains the block
sync_mode – true if the message was fetched through the sync process, false during normal operation
contained_transaction_msg_ids – container for the transactions to write back into
- Throws:
exception – if error validating the item, otherwise the item is safe to broadcast on.
- Returns:
true if this message caused the blockchain to switch forks, false if it did not
-
virtual void handle_transaction(const graphene::net::trx_message &transaction_message) override
Called when a new transaction comes in from the network.
- Throws:
exception – if error validating the item, otherwise the item is safe to broadcast on.
-
virtual void handle_message(const graphene::net::message &message_to_process) override
Called when a new message comes in from the network other than a block or a transaction. Currently there are no other possible messages, so this should never be called.
- Throws:
exception – if error validating the item, otherwise the item is safe to broadcast on.
-
std::vector<graphene::net::item_hash_t> get_block_ids(const std::vector<graphene::net::item_hash_t> &blockchain_synopsis, uint32_t &remaining_item_count, uint32_t limit) override
Assuming all data elements are ordered in some way, this method should return up to limit ids that occur after the last ID in synopsis that we recognize.
On return, remaining_item_count will be set to the number of items in our blockchain after the last item returned in the result, or 0 if the result contains the last item in the blockchain
-
virtual graphene::net::message get_item(const graphene::net::item_id &id) override
Given the hash of the requested data, fetch the body.
-
virtual std::vector<graphene::net::item_hash_t> get_blockchain_synopsis(const graphene::net::item_hash_t &reference_point, uint32_t number_of_blocks_after_reference_point) override
Returns a synopsis of the blockchain used for syncing. This consists of a list of block hashes at intervals exponentially increasing towards the genesis block. When syncing to a peer, the peer uses this data to determine if we’re on the same fork as they are, and if not, what blocks they need to send us to get us on their fork.
In the over-simplified case, this is a straighforward synopsis of our current preferred blockchain; when we first connect up to a peer, this is what we will be sending. It looks like this: If the blockchain is empty, it will return the empty list. If the blockchain has one block, it will return a list containing just that block. If it contains more than one block: the first element in the list will be the hash of the highest numbered block that we cannot undo the second element will be the hash of an item at the half way point in the undoable segment of the blockchain the third will be ~3/4 of the way through the undoable segment of the block chain the fourth will be at ~7/8… &c. the last item in the list will be the hash of the most recent block on our preferred chain so if the blockchain had 26 blocks labeled a - z, the synopsis would be: a n u x z the idea being that by sending a small (<30) number of block ids, we can summarize a huge blockchain. The block ids are more dense near the end of the chain where because we are more likely to be almost in sync when we first connect, and forks are likely to be short. If the peer we’re syncing with in our example is on a fork that started at block ‘v’, then they will reply to our synopsis with a list of all blocks starting from block ‘u’, the last block they know that we had in common.
In the real code, there are several complications.
First, as an optimization, we don’t usually send a synopsis of the entire blockchain, we send a synopsis of only the segment of the blockchain that we have undo data for. If their fork doesn’t build off of something in our undo history, we would be unable to switch, so there’s no reason to fetch the blocks.
Second, when a peer replies to our initial synopsis and gives us a list of the blocks they think we are missing, they only send a chunk of a few thousand blocks at once. After we get those block ids, we need to request more blocks by sending another synopsis (we can’t just say “send me
the next 2000 ids” because they may have switched forks themselves and they don’t track what they’ve sent us). For faster performance, we want to get a fairly long list of block ids first, then start downloading the blocks. The peer doesn’t handle these follow-up block id requests any different from the initial request; it treats the synopsis we send as our blockchain and bases its response entirely off that. So to get the response we want (the next chunk of block ids following the last one they sent us, or, failing that, the shortest fork off of the last list of block ids they sent), we need to construct a synopsis as if our blockchain was made up of:
the blocks in our block chain up to the fork point (if there is a fork) or the head block (if no fork)
the blocks we’ve already pushed from their fork (if there’s a fork)
the block ids they’ve previously sent us Segment 3 is handled in the p2p code, it just tells us the number of blocks it has (in number_of_blocks_after_reference_point) so we can leave space in the synopsis for them. We’re responsible for constructing the synopsis of Segments 1 and 2 from our active blockchain and fork database. The reference_point parameter is the last block from that peer that has been successfully pushed to the blockchain, so that tells us whether the peer is on a fork or on the main chain.
-
virtual void sync_status(uint32_t item_type, uint32_t item_count) override
Call this after the call to handle_message succeeds.
- Parameters:
item_type – the type of the item we’re synchronizing, will be the same as item passed to the sync_from() call
item_count – the number of items known to the node that haven’t been sent to handle_item() yet. After
item_countmore calls to handle_item(), the node will be in sync
-
virtual void connection_count_changed(uint32_t c) override
Call any time the number of connected peers changes.
-
virtual fc::time_point_sec get_block_time(const graphene::net::item_hash_t &block_id) override
Returns the time a block was produced (if block_id = 0, returns genesis time). If we don’t know about the block, returns time_point_sec::min()
Add an available plugin.
-
void enable_plugin(const string &name)
Enables a plugin.
-
bool is_plugin_enabled(const string &name) const
Returns whether a plugin is enabled.
-
virtual bool has_item(const net::item_id &id) override
-
class deduplicator
-
graphene::chain::genesis_state_type create_example_genesis()
-
namespace impl
-
static uint32_t validate_get_lp_history_params(const application &_app, const optional<uint32_t> &olimit)