### Manual Hive Nectar Installation from Repository Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Clones the hive-nectar repository from GitHub and installs dependencies using 'uv sync', useful for obtaining the latest development version. ```bash git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` -------------------------------- ### Set and Get Hive Nodes in Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Demonstrates how to update Hive nodes and retrieve them using the Nectar library in Python. Requires the 'nectar' library. It initializes NodeList, updates nodes, fetches Hive nodes, and creates a Hive instance. ```python from nectar import Hive from nectar.nodelist import NodeList nodelist = NodeList() nodelist.update_nodes() nodes = nodelist.get_hive_nodes() hive = Hive(node=nodes) print(hive.is_hive) ``` -------------------------------- ### Install Pip with Curl Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Downloads the pip installation script using curl and executes it to install or upgrade pip. ```bash curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py ``` -------------------------------- ### Install secp256k1prp for faster signing Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs the secp256k1prp package to potentially speed up signing operations in hive-nectar. ```bash pip3 install -U secp256k1prp ``` -------------------------------- ### Install Hive-Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs or updates the hive-nectar Python package using pip. ```bash pip3 install -U hive-nectar ``` -------------------------------- ### Install cryptography for faster signing Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs the cryptography package to accelerate signing and verification operations in hive-nectar. ```bash pip3 install -U cryptography ``` -------------------------------- ### Install System Dependencies for Debian/Ubuntu Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Installs essential build tools and libraries required for compiling Python extensions on Debian and Ubuntu systems. ```bash sudo apt-get install build-essential libssl-dev python-dev curl ``` -------------------------------- ### Run tests Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Executes the test suite for the hive-nectar library after installation. ```bash pytest ``` -------------------------------- ### Install development version from repository Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Clones the hive-nectar repository and installs the latest development version, including development dependencies. ```bash git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` -------------------------------- ### Install System Dependencies for Termux (Android) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Installs necessary compiler and development libraries for Python extensions on Termux environments for Android devices. ```bash pkg install clang openssl-dev python-dev ``` -------------------------------- ### Install Fedora/RHEL dependencies Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs necessary build tools and Python development headers on Fedora and RHEL-based systems for hive-nectar. ```bash sudo yum install gcc openssl-devel python-devel ``` -------------------------------- ### Install Cryptography with Pip Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Installs or upgrades the 'cryptography' package using pip, which can significantly speed up signing and verification operations. ```bash pip install -U cryptography ``` -------------------------------- ### Install Hive Nectar with Pip Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Installs the latest version of the hive-nectar package using pip. Includes alternative commands for different Python environments. ```bash pip install -U hive-nectar ``` ```bash pip3 install -U hive-nectar ``` ```bash python -m pip install hive-nectar ``` -------------------------------- ### Install Debian/Ubuntu dependencies Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs essential build and Python development packages on Debian/Ubuntu systems required for hive-nectar. ```bash sudo apt-get install build-essential libssl-dev python3-dev python3-pip python3-setuptools ``` -------------------------------- ### Install optional gmpy2 for performance Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs the python3-gmpy2 package on Debian/Ubuntu systems to potentially improve hive-nectar's performance. ```bash sudo apt-get install python3-gmpy2 ``` -------------------------------- ### Install LedgerBlue for Ledger Nano S signing Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs the ledgerblue package required for signing transactions using a Ledger Nano S hardware wallet. ```bash pip3 install ledgerblue ``` -------------------------------- ### Get Market Ticker using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Fetches the ticker information for a specified market pair (e.g., HBD:HIVE). Requires initializing the Market class with the market pair. ```python from nectar.market import Market market = Market("HBD:HIVE") print(market.ticker()) ``` -------------------------------- ### Install OpenSSL and Set Environment Variables for macOS Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Installs OpenSSL using Homebrew and sets CFLAGS and LDFLAGS environment variables to ensure proper linking during compilation on macOS. ```bash brew install openssl export CFLAGS = "-I$(brew --prefix openssl)/include $CFLAGS" export LDFLAGS = "-L$(brew --prefix openssl)/lib $LDFLAGS" ``` -------------------------------- ### Install Termux dependencies Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Installs required packages on Termux (Android) for compiling and running Python applications like hive-nectar. ```bash pkg install clang openssl python ``` -------------------------------- ### Get Trending Tags - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches trending tags on the platform, ordered by popularity. It uses the Query and Trending_tags classes, requiring a starting tag. ```python from nectar.discussions import Query, Trending_tags q = Query(limit=10, start_tag="hive") for h in Trending_tags(q): print(h) ``` -------------------------------- ### Set Shared Hive Instance and Create Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Demonstrates setting a shared Hive instance and creating an Account in Python without explicitly passing the instance. Requires the 'nectar' library. It creates a Hive instance, sets it as the shared instance, and then creates an Account. ```python from nectar import Hive from nectar.account import Account from nectar.instance import set_shared_blockchain_instance hive = Hive() set_shared_blockchain_instance(hive) account = Account("test") ``` -------------------------------- ### Add Example Script for Vote Percentage Calculation (Python) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/changelog.rst Provides an example script `examples/get_vote_pct_script.py` demonstrating how to compute both the downvote-to-zero percent and the upvote percent to achieve a target HBD value. ```python examples/get_vote_pct_script.py ``` -------------------------------- ### Sell Hive on Market using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Sells HIVE on the market at a specified price. Requires unlocking the wallet and initializing the Market class. ```python from nectar.market import Market from nectar import Hive hive.wallet.unlock("wallet-passphrase") market = Market("HBD:HIVE", blockchain_instance=hive) print(market.ticker()) market.hive.wallet.unlock("wallet-passphrase") print(market.sell(300, 100)) # sell 100 HIVE for 300 HIVE/HBD ``` -------------------------------- ### Initialize Hive and Account with Shared Instance Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Shows how to initialize a Hive object and an Account object, linking them through a shared blockchain instance in Python. Requires the 'nectar' library. It creates a Hive instance and then an Account associated with it. ```python from nectar import Hive from nectar.account import Account hive = Hive() account = Account("test", blockchain_instance=hive) ``` -------------------------------- ### Initialize Hive with Temporary Keys Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Shows how to initialize a Hive object with temporary private keys directly in Python. Requires the 'nectar' library. This bypasses the wallet for immediate use. ```python from nectar import Hive hive = Hive(keys=["xxxxxxxxx"]) account = Account("test", blockchain_instance=hive) account.transfer("", "", "", "") ``` -------------------------------- ### Initialize Hive and Transfer Funds Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst Demonstrates how to initialize the Hive connection, unlock the wallet with a passphrase, create an account instance, and perform a transfer of assets. This requires the nectar library to be installed and configured. ```python from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") account = Account("test", blockchain_instance=hive) account.transfer("", "", "", "") ``` -------------------------------- ### Get Blog Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the blog posts for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog(): print(h) ``` -------------------------------- ### Publish Post to Hive Blockchain using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Publishes a new post to the Hive blockchain with a title, body, author, and tags. Requires unlocking the wallet. ```python from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") hive.post("title", "body", author="test", tags=["a", "b", "c", "d", "e"], self_vote=True) ``` -------------------------------- ### Get Blog Entries Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves blog entries for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog_entries(): print(h) ``` -------------------------------- ### Create and Unlock Hive Wallet Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Illustrates the process of wiping an existing wallet and unlocking it with a passphrase in Python using the Nectar library. Requires the 'nectar' library. This is crucial before adding keys or performing wallet operations. ```python from nectar import Hive hive = Hive() hive.wallet.wipe(True) hive.wallet.unlock("wallet-passphrase") ``` -------------------------------- ### Get Config Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the configuration settings of the Hive blockchain. Requires a Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_config()) ``` -------------------------------- ### Get Witness Schedule - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the witness schedule for the blockchain. It uses the Hive class. ```python from nectar import Hive hv = Hive() print(hv.get_witness_schedule()) ``` -------------------------------- ### macOS OpenSSL setup for hive-nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Configures environment variables on macOS to include OpenSSL headers and libraries when building packages like hive-nectar. ```bash brew install openssl export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS" export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS" ``` -------------------------------- ### Get Ticker - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the current ticker information for the market. It uses the Market class. ```python from nectar.market import Market m = Market() print(m.ticker()) ``` -------------------------------- ### Update Hive Nodes via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Sets Hive blockchain nodes using the command-line tool. No specific dependencies beyond the tool itself. It configures the tool to use Hive nodes. ```bash hive-nectar updatenodes --hive ``` -------------------------------- ### Enable INFO Level Logging in Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Configures Python's logging module to capture and display messages with INFO level severity and above. ```python import logging log = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) ``` -------------------------------- ### Get Discussions by Blog Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions from a blog. Requires a Query object for filtering and a Discussions_by_blog object. ```python from nectar.discussions import Query, Discussions_by_blog q = Query(limit=10) for h in Discussions_by_blog(q): print(h) ``` -------------------------------- ### Get Conversion Requests Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves conversion requests for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_conversion_requests()) ``` -------------------------------- ### Get Account Bandwidth Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the bandwidth information for a given account. Requires an Account object. ```python from nectar.account import Account account = Account("test") account.get_account_bandwidth() ``` -------------------------------- ### Get Vesting Delegations - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves vesting delegations made by an account. It uses the Account class. ```python from nectar.account import Account acc = Account("gtg") for v in acc.get_vesting_delegations(): print(v) ``` -------------------------------- ### Get Blog Authors Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the authors of blog posts for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog_authors(): print(h) ``` -------------------------------- ### Transfer Funds Without Default Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Example of sending funds when a default account has been set, allowing the omission of the --account flag. ```bash hive-nectar transfer 100 Hive memo ``` -------------------------------- ### Get Volume (24h) - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the 24-hour trading volume from the market. It uses the Market class. ```python from nectar.market import Market m = Market() print(m.volume24h()) ``` -------------------------------- ### Upvote Post using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Upvotes a specific post on the Hive blockchain. Requires unlocking the wallet and initializing the Comment class with the post author and permlink. ```python from nectar.comment import Comment from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") comment = Comment("@gtg/ffdhu-gtg-witness-log", blockchain_instance=hive) comment.upvote(weight=10, voter="test") ``` -------------------------------- ### Get Witness by Account - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches witness information for a given account name. It uses the Witness class. ```python from nectar.witness import Witness w = Witness("gtg") print(w) ``` -------------------------------- ### Get Chain Properties Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the current properties of the Hive blockchain. Requires a Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_chain_properties()) ``` -------------------------------- ### Add Private Keys to Hive Wallet Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Shows how to add private keys to the Nectar wallet after unlocking it in Python. Requires the 'nectar' library and an unlocked wallet. Multiple keys can be added. ```python from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") hive.wallet.addPrivateKey("xxxxxxx") hive.wallet.addPrivateKey("xxxxxxx") ``` -------------------------------- ### Get Withdraw Routes - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the withdrawal routes configured for an account. It uses the Account class. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_withdraw_routes()) ``` -------------------------------- ### Send Hive Transfer Transaction using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Sends a transfer transaction on the Hive blockchain. Requires unlocking the wallet and creating an Account instance. ```python from nectar import Hive from nectar.account import Account hive = Hive() hive.wallet.unlock("wallet-passphrase") account = Account("test", blockchain_instance=hive) account.transfer("null", 1, "SBD", "test") ``` -------------------------------- ### Hive-Nectar Help and Options Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Displays the help message for the hive-nectar CLI, outlining all available options and commands. Includes options for specifying nodes, offline mode, broadcast control, and key management. ```bash ~ % hive-nectar --help Usage: hive-nectar [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]... Options: -n, --node TEXT URL for public Hive API (e.g. https://api.hive.blog) -o, --offline Prevent connecting to network -d, --no-broadcast Do not broadcast -p, --no-wallet Do not load the wallet -x, --unsigned Nothing will be signed -l, --create-link Creates hivesigner links from all broadcast operations -k, --keys TEXT JSON file that contains account keys, when set, the wallet cannot be used. -u, --use-ledger Uses the ledger device Nano S for signing. --path TEXT BIP32 path from which the keys are derived, when not set, default_path is used. -t, --token Uses a hivesigner token to broadcast (only broadcast operation with posting permission) -e, --expires INTEGER Delay in seconds until transactions are supposed to expire (defaults to 60) -v, --verbose INTEGER Verbosity --version Show the version and exit. --help Show this message and exit. Commands: about About hive-nectar addkey Add key to wallet When no [OPTION] is given,... addtoken Add key to wallet When no [OPTION] is given, a... allow Allow an account/key to interact with your... account... approvewitness Approve a witnesses balance Shows balance beneficiaries Set beneficaries broadcast broadcast a signed transaction buy Buy HIVE or HBD from the internal market... cancel Cancel order in the internal market changekeys Changes all keys for the specified account Keys... changerecovery Changes the recovery account with the owner key... changewalletpassphrase Change wallet password claimaccount Claim account for claimed account creation. ``` -------------------------------- ### Update Hive Nodes via CLI (Default) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Updates nodes for the Hive blockchain using the command-line tool. This command sets the default Hive nodes. ```bash hive-nectar updatenodes ``` -------------------------------- ### Get Account Reputations Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the reputation of accounts on the Hive blockchain. Requires a Blockchain object. ```python from nectar.blockchain import Blockchain b = Blockchain() for h in b.get_account_reputations(): print(h) ``` -------------------------------- ### Get Discussions by Author Before Date Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions by a specific author before a given date. Requires pagination and author parameters. ```python from nectar.discussions import Discussions_by_author_before_date for h in Discussions_by_author_before_date(limit=10, author="gtg"): print(h) ``` -------------------------------- ### Get Trade History - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the complete trade history from the market. It uses the Market class. ```python from nectar.market import Market m = Market() for t in m.trade_history(): print(t) ``` -------------------------------- ### Manage Hive Wallet: Create, Unlock, Add Key, Wipe Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst Provides a comprehensive example of Hive wallet management, including wiping an existing wallet, creating a new one with a passphrase, unlocking it, adding a private key, and then locking it again. ```python from nectar.hive import Hive hive = Hive() hive.wallet.wipe(True) hive.wallet.create("wallet-passphrase") hive.wallet.unlock("wallet-passphrase") hive.wallet.addPrivateKey("512345678") hive.wallet.lock() ``` -------------------------------- ### Get Account Votes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the votes cast by a specific account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_account_votes(): print(h) ``` -------------------------------- ### Access Post Details and Votes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Fetches and prints the active votes for a specific post on the Hive blockchain. Requires the 'nectar.comment' module. The post is identified by its author and permlink. ```python from nectar.comment import Comment comment = Comment("@gtg/ffdhu-gtg-witness-log") print(comment["active_votes"]) ``` -------------------------------- ### Setting Default API Node URLs via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Provides examples of using the `hive-nectar` command-line tool to set the default API node URLs, including setting a single node and resetting to default. ```bash hive-nectar set nodes https://api.hive.blog ``` ```bash hive-nectar -o set nodes "" ``` -------------------------------- ### Get Witness Count - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the total count of active witnesses. It uses the Witnesses class. ```python from nectar.witness import Witnesses w = Witnesses() print(w.witness_count) ``` -------------------------------- ### Get Discussions by Cashout Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions sorted by cashout time. Requires a Query object for filtering and a Discussions_by_cashout object. ```python from nectar.discussions import Query, Discussions_by_cashout q = Query(limit=10) for h in Discussions_by_cashout(q): print(h) ``` -------------------------------- ### Get Discussions by Promotion Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions that have been promoted using the Discussions_by_promoted class. It requires a Query object and often uses a tag for filtering. ```python from nectar.discussions import Query, Discussions_by_promoted q = Query(limit=10, tag="hive") for h in Discussions_by_promoted(q): print(h) ``` -------------------------------- ### Get Active Witnesses Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of active witnesses on the Hive blockchain. Requires a Witnesses object. ```python from nectar.witness import Witnesses w = Witnesses() w.printAsTable() ``` -------------------------------- ### Get Tags Used by Author - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of tags that an author has used. This function is part of the Account class. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_tags_used_by_author()) ``` -------------------------------- ### Access All Votes from an Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Retrieves all votes cast by a specific Hive account. Requires the 'nectar.vote' module. The account name is used to query the votes. ```python from nectar.vote import AccountVotes allVotes = AccountVotes("gtg") ``` -------------------------------- ### Get Witnesses by Vote - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a ranked list of witnesses based on their votes. It uses the WitnessesRankedByVote class. ```python from nectar.witness import WitnessesRankedByVote for w in WitnessesRankedByVote(): print(w) ``` -------------------------------- ### Get Discussions by Active Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions (posts) sorted by activity. Requires a Query object for filtering and a Discussions_by_active object. ```python from nectar.discussions import Query, Discussions_by_active q = Query(limit=10) for h in Discussions_by_active(q): print(h) ``` -------------------------------- ### Managing Master Password in Keyring Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Provides commands for setting and getting the wallet master password stored in the system's keyring using Python's keyring module. ```bash python -m keyring set nectar wallet ``` ```bash python -m keyring get nectar wallet ``` -------------------------------- ### Get Account Count Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the total number of accounts on the Hive blockchain. Requires a Blockchain object. ```python from nectar.blockchain import Blockchain b = Blockchain() b.get_account_count() ``` -------------------------------- ### Get Account History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the history of operations for a specific account. Requires an Account object and pagination parameters. ```python from nectar.account import Account acc = Account("thecrazygm") for h in acc.get_account_history(1,0): print(h) ``` -------------------------------- ### Enable CRITICAL Level Logging in Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Configures Python's logging module to display only messages with CRITICAL level severity, filtering out less severe logs. ```python import logging log = logging.getLogger(__name__) logging.basicConfig(level=logging.CRITICAL) ``` -------------------------------- ### Get Recovery Request - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the recovery request associated with an account. This function requires an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_recovery_request()) ``` -------------------------------- ### Get State - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the current state, specifically recent posts by path. It uses the RecentByPath class from nectar.discussions. ```python from nectar.comment import RecentByPath for p in RecentByPath(path="promoted"): print(p) ``` -------------------------------- ### Get Content Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a specific piece of content (post or comment) by its authorperm. Requires an Account object to fetch the post and then a Comment object. ```python from nectar.account import Account from nectar.comment import Comment acc = Account("gtg") post = acc.get_feed(0,1)[0] print(Comment(post["authorperm"])) ``` -------------------------------- ### Get Account Followers Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches a list of followers for a given Hive account using the Account class. Requires the account name. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_followers(): print(f) ``` -------------------------------- ### Access Witness Status using Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Checks if a specific Hive witness is currently active. Requires initializing the Witness class with the witness's username. ```python from nectar.witness import Witness witness = Witness("gtg") print(witness.is_active) ``` -------------------------------- ### Get Block Header Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the header of a specific block from the Hive blockchain by its number. Requires a BlockHeader object. ```python from nectar.block import BlockHeader print(BlockHeader(1)) ``` -------------------------------- ### Get Reward Funds - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches information about reward funds. This function utilizes the Hive class from the nectar library. ```python from nectar import Hive hv = Hive() print(hv.get_reward_funds()) ``` -------------------------------- ### Access a Single Vote Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Retrieves and prints the JSON representation of a specific vote from the Hive blockchain. Requires the 'nectar.vote' module. The vote is identified by a unique string. ```python from nectar.vote import Vote vote = Vote(u"@gtg/ffdhu-gtg-witness-log|gandalf") print(vote.json()) ``` -------------------------------- ### Get Transaction - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches transaction details using its ID. This function requires the Blockchain class and a transaction ID. ```python from nectar.blockchain import Blockchain b = Blockchain() print(b.get_transaction("6fde0190a97835ea6d9e651293e90c89911f933c")) ``` -------------------------------- ### Get Recent Trades - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of the most recent trades from the market. It utilizes the Market class from the nectar library. ```python from nectar.market import Market m = Market() for t in m.recent_trades(): print(t) ``` -------------------------------- ### Get Transaction Hex - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the hexadecimal representation of a transaction. It uses the Blockchain class and requires a transaction object. ```python from nectar.blockchain import Blockchain b = Blockchain() block = b.get_current_block() trx = block.json()["transactions"][0] print(b.get_transaction_hex(trx)) ``` -------------------------------- ### Get Comment Discussions by Payout Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions (posts) sorted by payout. Requires a Query object for filtering and a Comment_discussions_by_payout object. ```python from nectar.discussions import Query, Comment_discussions_by_payout q = Query(limit=10) for h in Comment_discussions_by_payout(q): print(h) ``` -------------------------------- ### Get Market History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches historical market data for Hive using the Market class. This includes trade data over time. ```python from nectar.market import Market m = Market() for t in m.market_history(): print(t) ``` -------------------------------- ### Get Discussions by Children Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions sorted by the number of children (replies). Requires a Query object for filtering and a Discussions_by_children object. ```python from nectar.discussions import Query, Discussions_by_children q = Query(limit=10) ``` -------------------------------- ### Get Savings Withdrawals (To) - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves savings withdrawals made to an account. It uses the Account class and specifies the direction as 'to'. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_savings_withdrawals(direction="to")) ``` -------------------------------- ### Get Savings Withdrawals (From) - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves savings withdrawals made from an account. It uses the Account class and specifies the direction as 'from'. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_savings_withdrawals(direction="from")) ``` -------------------------------- ### Get Post Discussions by Payout Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves post discussions sorted by their payout using the Post_discussions_by_payout class. It requires a Query object with a limit. ```python from nectar.discussions import Query, Post_discussions_by_payout q = Query(limit=10) for h in Post_discussions_by_payout(q): print(h) ``` -------------------------------- ### Get Accounts Following a Target Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of accounts that are following a specified Hive account using the Account class. Requires the account name. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_following(): print(f) ``` -------------------------------- ### Get Hardfork Version Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the current hardfork version of the Hive blockchain using the Hive class. Accesses the 'hf_version' key from the properties. ```python from nectar import Hive hv = Hive() print(hv.get_hardfork_properties()["hf_version"]) ``` -------------------------------- ### Get Follow Count for Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the number of followers and following for a specific Hive account using the Account class. Requires the account name. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_follow_count()) ``` -------------------------------- ### Get Escrow Details for Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves escrow details for a specific Hive account using the Account class. Requires an account name as input. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_escrow()) ``` -------------------------------- ### Get Discussions by Creation Date Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions sorted by their creation date using the Discussions_by_created class. It utilizes a Query object, with a limit parameter being essential. ```python from nectar.discussions import Query, Discussions_by_created q = Query(limit=10) for h in Discussions_by_created(q): print(h) ``` -------------------------------- ### Get Dynamic Global Properties Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches dynamic global properties of the Hive blockchain using the Hive class. This provides real-time network information. ```python from nectar import Hive hv = Hive() print(hv.get_dynamic_global_properties()) ``` -------------------------------- ### Get Expiring Vesting Delegations Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches expiring vesting delegations for a given Hive account using the Account class. Requires the account name. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_expiring_vesting_delegations()) ``` -------------------------------- ### Get Current Median History Price Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the current median history price on the Hive blockchain. Requires a Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_current_median_history()) ``` -------------------------------- ### Get Account from Public Key Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves account information associated with a given public key using the Wallet class. It first obtains the public key from an account's posting authority. ```python from nectar.account import Account from nectar.wallet import Wallet acc = Account("gtg") w = Wallet() print(w.getAccountFromPublicKey(acc["posting"]["key_auths"][0][0])) ``` -------------------------------- ### Get Order Book Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the current order book for the Hive market using the Market class. This shows outstanding buy and sell orders. ```python from nectar.market import Market m = Market() print(m.orderbook()) ``` -------------------------------- ### Get Discussions by Comments Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions based on comments using the Discussions_by_comments class. It requires a Query object with specified parameters like limit, start_author, and start_permlink. ```python from nectar.discussions import Query, Discussions_by_comments q = Query(limit=10, start_author="thecrazygm", start_permlink="firstpost") for h in Discussions_by_comments(q): print(h) ``` -------------------------------- ### Get Discussions by Votes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions sorted by the number of votes they have received using the Discussions_by_votes class. A Query object with a limit is necessary. ```python from nectar.discussions import Query, Discussions_by_votes q = Query(limit=10) for h in Discussions_by_votes(q): print(h) ``` -------------------------------- ### Get Account Feed Entries Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches individual entries from a Hive account's feed using the Account class. This provides detailed information about each item in the feed. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_feed_entries(): print(f) ``` -------------------------------- ### Simple Sell Script with Hive Nectar Market Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Provides a script for selling assets on the Hive market using the Nectar library. It demonstrates how to instantiate Hive, define a market pair (HBD:HIVE), and execute a sell order with a specific price and amount. The `nobroadcast` option is set for testing. ```python from nectar import Hive from nectar.market import Market from nectar.price import Price from nectar.amount import Amount # Only for testing not a real working key wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" # # Instantiate Hive (pick network via API node) # hv = Hive( nobroadcast=True, # <<--- set this to False when you want to fire! keys=[wif] # <<--- use your real keys, when going live! ) # # This defines the market we are looking at. # The first asset in the first argument is the *quote* # Sell and buy calls always refer to the *quote* # market = Market("HBD:HIVE", blockchain_instance=hv ) # # Sell an asset for a price with amount (quote) # print(market.sell( Price(100.0, "HIVE/HBD"), Amount("0.01 HBD") )) ``` -------------------------------- ### Get Discussions by Hotness Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions ranked by 'hotness' using the Discussions_by_hot class. A Query object is necessary, and filtering by tag is a common practice. ```python from nectar.discussions import Query, Discussions_by_hot q = Query(limit=10, tag="hive") for h in Discussions_by_hot(q): print(h) ``` -------------------------------- ### Build and Broadcast Transfer Transaction Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Demonstrates how to manually build and broadcast a Hive transfer transaction using `TransactionBuilder`. It shows how to append operations and sign the transaction using a WIF key. ```python from nectar import Hive from nectar.transactionbuilder import TransactionBuilder from nectarbase import operations hv = Hive() # Uncomment the following when using a wallet: # hv.wallet.unlock("secret_password") tx = TransactionBuilder(blockchain_instance=hv) op = operations.Transfer(**{"from": 'user_a', "to": 'user_b', "amount": '1.000 HBD', "memo": 'test 2'})) tx.appendOps(op) # Comment appendWif out and uncomment appendSigner when using a stored key from the wallet tx.appendWif('5.....') # `user_a` # tx.appendSigner('user_a', 'active') tx.sign() tx.broadcast() ``` -------------------------------- ### Get Open Orders for Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the open orders placed by a specific Hive account using the Market class. Requires the account name as a parameter. ```python from nectar.market import Market m = Market() print(m.accountopenorders(account="gtg")) ``` -------------------------------- ### Get Discussions by Feed Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions from a user's feed using the Discussions_by_feed class. Requires a Query object, and a tag parameter is commonly used to filter discussions. ```python from nectar.discussions import Query, Discussions_by_feed q = Query(limit=10, tag="hive") for h in Discussions_by_feed(q): print(h) ``` -------------------------------- ### Get Next Scheduled Hardfork Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves information about the next scheduled hardfork for the Hive blockchain using the Hive class. It returns the properties related to hardforks. ```python from nectar import Hive hv = Hive() print(hv.get_hardfork_properties()) ``` -------------------------------- ### Get Reblogged By - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches a list of accounts that have reblogged a specific post. It uses the Account and Comment classes, requiring an account name and a post's authorperm. ```python from nectar.account import Account from nectar.comment import Comment acc = Account("gtg") post = acc.get_feed(0,1)[0] c = Comment(post["authorperm"]) for h in c.get_reblogged_by(): print(h) ``` -------------------------------- ### Get Discussions by Trending Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions that are currently trending using the Discussions_by_trending class. A Query object is required, and the tag parameter can be used for filtering. ```python from nectar.discussions import Query, Discussions_by_trending q = Query(limit=10, tag="hive") for h in Discussions_by_trending(q): print(h) ``` -------------------------------- ### Loading Hive Configuration Directly Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Shows how to load the configuration directly from the `nectar.storage` module without initializing the `nectar.hive.Hive` class. ```python from nectar.storage import configStorage as config ``` -------------------------------- ### Get Content Replies Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves replies to a specific piece of content. Requires an Account object to fetch the post, a Comment object for the post, and then calling get_replies() on the Comment object. ```python from nectar.account import Account from nectar.comment import Comment acc = Account("gtg") post = acc.get_feed(0,1)[0] c = Comment(post["authorperm"]) for h in c.get_replies(): print(h) ``` -------------------------------- ### Get Replies by Last Update - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves replies to posts, ordered by last update. It uses the Query and Replies_by_last_update classes, requiring query parameters like limit and start_author. ```python from nectar.discussions import Query, Replies_by_last_update q = Query(limit=10, start_author="thecrazygm", start_permlink="firstpost") for h in Replies_by_last_update(q): print(h) ``` -------------------------------- ### Get Feed History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the historical feed data for the Hive blockchain using the Hive class. This can be useful for analyzing trends and past activity. ```python from nectar import Hive hv = Hive() print(hv.get_feed_history()) ``` -------------------------------- ### Get Market History Buckets Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves available market history data buckets (time intervals) using the Market class. This helps in understanding the granularity of historical market data. ```python from nectar.market import Market m = Market() for t in m.market_history_buckets(): print(t) ``` -------------------------------- ### Setting Password Storage via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Illustrates how to configure the password storage mechanism (environment or keyring) using the `hive-nectar` command-line tool. ```bash hive-nectar set password_storage environment ``` ```bash hive-nectar set password_storage keyring ``` -------------------------------- ### Get Required Signatures - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the required signatures for a transaction using the TransactionBuilder and Blockchain classes. Similar to get_potential_signatures, it accesses block and transaction data. ```python from nectar.transactionbuilder import TransactionBuilder from nectar.blockchain import Blockchain b = Blockchain() block = b.get_current_block() trx = block.json()["transactions"][0] t = TransactionBuilder(trx) print(t.get_required_signatures()) ``` -------------------------------- ### Show Balances CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Command to display the balances for specified Hive accounts. You can list balances for multiple accounts. ```bash hive-nectar balance account_name1 account_name2 ``` -------------------------------- ### Get Owner History for Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the historical owner authority changes for a specific Hive account using the Account class. Requires the account name. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_owner_history()) ``` -------------------------------- ### Using Key JSON File for Authentication Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Shows how to use a JSON file containing private keys to authenticate with hive-nectar. When a key file is provided, the wallet is not used. ```json { "account_a": {"posting": "5xx", "active": "5xx"}, "account_b": {"posting": "5xx"} } ``` ```bash hive-nectar --keys key_file.json command ``` -------------------------------- ### Get Operations in Block Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves all operations contained within a specific Hive block using the Block class. The 'only_ops' parameter filters the output to only operations. ```python from nectar.block import Block b = Block(2e6, only_ops=True) print(b) ``` -------------------------------- ### Get Potential Signatures - Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves potential signatures for a given transaction using the TransactionBuilder and Blockchain classes from the nectar library. It requires accessing the current block and extracting a transaction. ```python from nectar.transactionbuilder import TransactionBuilder from nectar.blockchain import Blockchain b = Blockchain() block = b.get_current_block() trx = block.json()["transactions"][0] t = TransactionBuilder(trx) print(t.get_potential_signatures()) ``` -------------------------------- ### Get Account Feed Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the feed for a specific Hive account using the Account class. This typically includes posts and comments made by accounts the target account follows. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_feed(): print(f) ``` -------------------------------- ### Batch API Calls using AppBase RPC Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Demonstrates how to queue API calls with AppBase RPC nodes for efficient batch processing. Calls made with `add_to_queue=True` are stored and sent together when a call with `add_to_queue=False` is encountered. ```python from nectar import Hive hv = Hive("https://api.hive.blog") hv.rpc.get_config(add_to_queue=True) hv.rpc.rpc_queue ``` ```json [{'method': 'condenser_api.get_config', 'jsonrpc': '2.0', 'params': [], 'id': 6}] ``` ```python result = hv.rpc.get_block({"block_num":1}, api="block", add_to_queue=False) len(result) ``` ```python 2 ``` -------------------------------- ### Testing Wallet Unlocking via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Illustrates how to test wallet unlocking functionality using the `hive-nectar walletinfo --test-unlock` command. ```bash hive-nectar walletinfo --test-unlock ``` -------------------------------- ### Get Active Votes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves active votes for a specific post. Requires an Account object to fetch the post, and then an ActiveVotes object initialized with the post's authorperm. ```python from nectar.vote import ActiveVotes from nectar.account import Account acc = Account("gtg") post = acc.get_feed(0,1)[0] a = ActiveVotes(post["authorperm"]) a.printAsTable() ``` -------------------------------- ### Bundle Multiple Operations with Hive Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Demonstrates bundling multiple operations like transfers and upvotes into a single transaction using the Hive Nectar library. It enables bundle broadcasting and sets up accounts and comments for operations. The bundled transaction is then printed. ```python from pprint import pprint from nectar import Hive from nectar.account import Account from nectar.comment import Comment from nectar.instance import set_shared_blockchain_instance # not a real working key wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" hv = Hive( bundle=True, # Enable bundle broadcast # nobroadcast=True, # Enable this for testing keys=[wif], ) # Set hv as shared instance set_shared_blockchain_instance(hv) # Account and Comment will use now hv account = Account("test") # Post c = Comment("@gtg/witness-gtg-log") account.transfer("test1", 1, "HIVE") account.transfer("test2", 1, "HIVE") account.transfer("test3", 1, "HBD") # Upvote post with 25% c.upvote(25, voter=account) pprint(hv.broadcast()) ```