Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Hive Nectar
https://github.com/thecrazygm/hive-nectar
Admin
Hive Blockchain Python Library
Tokens:
41,568
Snippets:
453
Trust Score:
7.4
License:
MIT
Update:
6 months ago
Context
Chat
Benchmark
12
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Install pip using get-pip.py Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Download and execute the get-pip.py script to install or upgrade pip, the Python package installer. ```bash curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py ``` -------------------------------- ### Install hive-nectar using pip Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Install the hive-nectar package using pip. This is the primary method for installing the library. ```bash pip install -U hive-nectar ``` -------------------------------- ### Get Key References Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves account key references. This example demonstrates getting the public key from an account's posting authority and then using it to find the associated account. ```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])) ``` -------------------------------- ### Clone and Install from Repository Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Manually install the latest version of nectar by cloning the repository and using uv sync. This may install a potentially unstable version. ```bash git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` -------------------------------- ### Install hive-nectar from Repository Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Clone the hive-nectar repository and install the latest development version using uv for dependency management. ```bash git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` -------------------------------- ### Install Ledger Support Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Install the 'ledgerblue' package using pip3 to enable Ledger Nano S signing capabilities. Replace pip3 with pip if necessary. ```bash pip3 install ledgerblue ``` -------------------------------- ### Install cryptography for Performance Boost Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Install the cryptography library using pip to significantly speed up signing and verification operations. ```bash pip install -U cryptography ``` -------------------------------- ### Install gmpy2 for Speedup (Debian/Ubuntu) Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Install the python3-gmpy2 package on Debian/Ubuntu to significantly speed up hive-nectar operations. ```bash sudo apt-get install python3-gmpy2 ``` -------------------------------- ### Install Build Tools (Debian/Ubuntu) Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Ensure necessary build tools and Python development packages are installed on Debian/Ubuntu systems before installing hive-nectar. ```bash sudo apt-get install build-essential libssl-dev python3-dev python3-pip python3-setuptools ``` -------------------------------- ### Simple Transfer Example Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Demonstrates how to build and broadcast a simple transfer transaction. ```APIDOC ## Simple Transfer ### Description Builds and broadcasts a single transfer operation. ### Method ```python TransactionBuilder(blockchain_instance=hv).appendOps(Transfer({...})) ``` ### Parameters - **blockchain_instance**: An instance of the Hive blockchain. - **from**: The sender's account name. - **to**: The recipient's account name. - **amount**: The amount to transfer (e.g., "1.000 HIVE"). - **memo**: An optional memo for the transaction. ### Signing and Broadcasting ```python tx = TransactionBuilder(blockchain_instance=hv) tx.appendOps(Transfer({ "from": "alice", "to": "bob", "amount": "1.000 HIVE", "memo": "payment", })) tx.appendSigner("alice", "active") signed = tx.sign() result = tx.broadcast() print(result) ``` ### Response Example ```json { "ref_block_num": ..., "signatures": [...], "trx_id": "..." } ``` ``` -------------------------------- ### Install Build Dependencies on Fedora/RHEL Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Ensure these essential packages are installed before proceeding with nectar installation on Fedora or RHEL derivatives. ```bash sudo yum install gcc openssl-devel python-devel ``` -------------------------------- ### Install Build Dependencies on Debian/Ubuntu Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Ensure these essential packages are installed before proceeding with nectar installation on Debian or Ubuntu systems. ```bash sudo apt-get install build-essential libssl-dev python-dev curl ``` -------------------------------- ### Alternative hive-nectar Installation with pip3 Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst If the standard pip installation fails, try using pip3, which might be linked to a different Python version. ```bash pip3 install -U hive-nectar ``` -------------------------------- ### Install Cryptography for Signing Speedup Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Install the 'cryptography' package using pip3 to accelerate signing and verification operations. Replace pip3 with pip if necessary. ```bash pip3 install -U cryptography ``` -------------------------------- ### Install secp256k1prp for Signing Speedup Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Alternatively, install the 'secp256k1prp' package using pip3 to accelerate signing and verification. Replace pip3 with pip if necessary. ```bash pip3 install -U secp256k1prp ``` -------------------------------- ### Install Packages (Termux) Source: https://github.com/thecrazygm/hive-nectar/blob/main/README.md Install required packages including clang, openssl, and python for Termux on Android. ```bash pkg install clang openssl python ``` -------------------------------- ### Install OpenSSL and Set Environment Variables on OSX Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Install OpenSSL using Homebrew and set the necessary CFLAGS and LDFLAGS environment variables for compilation on macOS. ```bash brew install openssl export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS" export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS" ``` -------------------------------- ### Install Build Dependencies on Termux (Android) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Install the required development packages for nectar on Termux for Android devices. ```bash pkg install clang openssl-dev python-dev ``` -------------------------------- ### Run Tests with pytest Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Execute the project's tests using the pytest framework after installation. ```bash pytest ``` -------------------------------- ### Get State (Promoted) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves promoted content. Requires importing RecentByPath. ```python from nectar.comment import RecentByPath for p in RecentByPath(path="promoted"): print(p) ``` -------------------------------- ### Get Following Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of accounts that a given account is following. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_following(): print(f) ``` -------------------------------- ### Get Escrow Details Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves escrow details for a given account. Requires initializing an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_escrow()) ``` -------------------------------- ### Manage Wallet with Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst This example covers essential wallet operations: wiping an existing wallet, creating a new one with a passphrase, unlocking it, adding a private key, and locking it again. Ensure you handle passphrases securely. ```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 Vesting Delegations Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches vesting delegations for a given account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") for v in acc.get_vesting_delegations(): print(v) ``` -------------------------------- ### Get Account Information Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Fetch resource credit balance, token balances, account history, blog posts, and follow counts. Use `print_info` for a formatted summary. ```python rc_mana = acc.get_rc_manabar() print(rc_mana["current_pct"]) print(rc_mana["max_mana"]) b = acc.balances print(b["available"]) print(b["savings"]) print(b["rewards"]) for op in acc.history(limit=10, only_ops=["transfer"]): print(op) blog = acc.get_blog(limit=5) for entry in blog: print(entry["authorperm"], entry["comment"Показать title"]) print(acc.get_follow_count()) acc.print_info(use_table=True) ``` -------------------------------- ### 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 author permission. Requires an Account object to get the post and a Comment object initialized with the author permission. ```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 Witness Schedule Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the witness schedule for the Hive blockchain. Requires importing Hive. ```python from nectar import Hive hv = Hive() print(hv.get_witness_schedule()) ``` -------------------------------- ### Get Blog Entries Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves blog entries for a given account. Requires an initialized Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog(): print(h) ``` -------------------------------- ### Stream Blockchain Operations with Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst This example shows how to stream and print all operations occurring on the blockchain. It requires initializing the Blockchain class. ```python from nectar.blockchain import Blockchain blockchain = Blockchain() for op in blockchain.stream(): print(op) ``` -------------------------------- ### Get Configuration Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the configuration settings of the Hive node. Requires an initialized Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_config()) ``` -------------------------------- ### Alternative hive-nectar Installation with python -m pip Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst As another alternative, use the 'python -m pip' command to ensure you are using the pip associated with your current Python interpreter. ```bash python -m pip install hive-nectar ``` -------------------------------- ### Get Witness Information by Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves witness information for a specific account. Requires importing Witness. ```python from nectar.witness import Witness w = Witness("gtg") print(w) ``` -------------------------------- ### Get Discussions by Promoted Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions that have been promoted, filtered by a tag. Requires a Query object. ```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 Blog Authors Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of authors from a blog. Requires an initialized Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog_authors(): print(h) ``` -------------------------------- ### 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 get the post and a Comment object initialized with the author permission, then calling get_replies. ```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 Withdraw Routes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the withdrawal routes for an account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_withdraw_routes()) ``` -------------------------------- ### Get Market History Buckets Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves market history data aggregated into buckets. Requires initializing a Market object. ```python from nectar.market import Market m = Market() for t in m.market_history_buckets(): print(t) ``` -------------------------------- ### Get Followers Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of followers for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_followers(): print(f) ``` -------------------------------- ### Get Blog Entries List Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of blog entries for an account. Requires an initialized Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_blog_entries(): print(h) ``` -------------------------------- ### Get Ticker Information Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves current ticker information from the market. Requires importing Market. ```python from nectar.market import Market m = Market() print(m.ticker()) ``` -------------------------------- ### Get Savings Withdrawals (From) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves savings withdrawals originating from the account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_savings_withdrawals(direction="from")) ``` -------------------------------- ### 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 and the Discussions_by_blog class. ```python from nectar.discussions import Query, Discussions_by_blog q = Query(limit=10) for h in Discussions_by_blog(q): print(h) ``` -------------------------------- ### Get Account Bandwidth Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the bandwidth information for a specified account. Requires an initialized Account object. ```python from nectar.account import Account account = Account("test") account.get_account_bandwidth() ``` -------------------------------- ### Get Conversion Requests Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves conversion requests for a given account. Requires an initialized Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_conversion_requests()) ``` -------------------------------- ### Get Market History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves historical market data. Requires initializing a Market object. ```python from nectar.market import Market m = Market() for t in m.market_history(): print(t) ``` -------------------------------- ### Get Account History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the transaction history for a given account. Requires an initialized Account object and specifies start and end block numbers. ```python from nectar.account import Account acc = Account("thecrazygm") for h in acc.get_account_history(1,0): print(h) ``` -------------------------------- ### Get Account Feed Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the feed for a specific account. Requires initializing an Account object. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_feed(): print(f) ``` -------------------------------- ### Get Savings Withdrawals (To) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves savings withdrawals directed to the account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_savings_withdrawals(direction="to")) ``` -------------------------------- ### Sell Asset at Timely Rate with Threading Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Schedule recurring sell orders using Python's `threading.Timer`. This example demonstrates selling an asset every 60 seconds. ```python import threading 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" def sell(): """ Sell an asset for a price with amount (quote) """ print(market.sell( Price(100.0, "HBD/HIVE"), Amount("0.01 HIVE") )) threading.Timer(60, sell).start() if __name__ == "__main__": # # Instantiate Hive (pick network via API node) # hv = Hive( ``` -------------------------------- ### Get Order Book Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the current order book for the market. Requires initializing a Market object. ```python from nectar.market import Market m = Market() print(m.orderbook()) ``` -------------------------------- ### Get Reward Funds Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches information about reward funds on the Hive blockchain. Requires importing Hive. ```python from nectar import Hive hv = Hive() print(hv.get_reward_funds()) ``` -------------------------------- ### Get Witness Information Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Retrieves detailed information about a specific witness. Requires a Hive instance. ```python from nectar.witness import Witness, WitnessesRankedByVote, WitnessesVotedByAccount from nectar import Hive hv = Hive() w = Witness("gtg", blockchain_instance=hv) print(w["votes"]) print(w["signing_key"]) print(w["url"]) print(w["total_missed"]) ``` -------------------------------- ### Get Follow Count Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the follower and following counts for an account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_follow_count()) ``` -------------------------------- ### Use Key JSON File with Command Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst When using a key_file.json, specify it with the --keys option. Note that when a key file is provided, the wallet cannot be used. ```bash hive-nectar --keys key_file.json command ``` -------------------------------- ### Get 24h Volume Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the market volume for the last 24 hours. Requires importing Market. ```python from nectar.market import Market m = Market() print(m.volume24h()) ``` -------------------------------- ### Get Owner History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the owner history for a given account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_owner_history()) ``` -------------------------------- ### Build and Broadcast a Single Transaction Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Constructs and broadcasts a single transaction with one operation (e.g., a transfer) using `TransactionBuilder`. This example shows how to append operations, sign with a WIF key, and broadcast. ```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 Account Reputations Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the reputation data for accounts on the blockchain. Requires an initialized Blockchain object. ```python from nectar.blockchain import Blockchain b = Blockchain() for h in b.get_account_reputations(): print(h) ``` -------------------------------- ### 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 and the Discussions_by_cashout class. ```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 Creation Date Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions sorted by their creation date. Uses a Query object with a limit. ```python from nectar.discussions import Query, Discussions_by_created q = Query(limit=10) for h in Discussions_by_created(q): print(h) ``` -------------------------------- ### Get Discussions by Comments Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions based on comments. Requires a Query object with specific parameters. ```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) ``` -------------------------------- ### Interact with Market Tickers and Orders with Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst This snippet demonstrates how to get market ticker information and place a sell order. It requires unlocking the wallet and specifying the market pair. ```python from nectar.market import Market market = Market("HBD:HIVE") print(market.ticker()) market.hive.wallet.unlock("wallet-passphrase") print(market.sell(300, 100) # sell 100 HIVE for 300 HIVE/HBD ``` -------------------------------- ### Get Witnesses Ranked by Vote Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of witnesses ranked by their votes. Requires importing WitnessesRankedByVote. ```python from nectar.witness import WitnessesRankedByVote for w in WitnessesRankedByVote(): print(w) ``` -------------------------------- ### 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. Parameters include limit and author. ```python from nectar.discussions import Query, Discussions_by_author_before_date for h in Discussions_by_author_before_date(limit=10, author="gtg"): print(h) ``` -------------------------------- ### Hive-Nectar Help Command Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Display the help message for the hive-nectar CLI, showing all available options and commands. ```bash ~ % hive-nectar --help ``` -------------------------------- ### Get Discussions by Active Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions sorted by activity. Requires a Query object and the Discussions_by_active class. ```python from nectar.discussions import Query, Discussions_by_active q = Query(limit=10) for h in Discussions_by_active(q): print(h) ``` -------------------------------- ### Get Open Orders Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves open orders for a specific account. Requires initializing a Market object and specifying the account. ```python from nectar.market import Market m = Market() print(m.accountopenorders(account="gtg")) ``` -------------------------------- ### Get Tags Used by Author Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches a list of tags used by a specific account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_tags_used_by_author()) ``` -------------------------------- ### Get Account Recovery Request Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the recovery request details for a given account. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_recovery_request()) ``` -------------------------------- ### Get Post Discussions by Payout Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches post discussions sorted by payout. Uses 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 Account Count Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the total number of accounts on the blockchain. Requires an initialized Blockchain object. ```python from nectar.blockchain import Blockchain b = Blockchain() b.get_account_count() ``` -------------------------------- ### View Configuration via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Access and view the current configuration settings using the hive-nectar command-line tool. ```bash hive-nectar config ``` -------------------------------- ### Build and Broadcast Multiple Transactions Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Constructs and broadcasts a transaction containing multiple operations (e.g., a transfer and a vote). This example demonstrates appending a list of operations to the `TransactionBuilder` before signing and broadcasting. ```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) ops = [] op = operations.Transfer(**{"from": 'user_a', "to": 'user_b', "amount": '1.000 HBD', "memo": 'test 2'})) ops.append(op) op = operations.Vote(**{"voter": v, "author": author, "permlink": permlink, "weight": int(percent * 100)}) ops.append(op) tx.appendOps(ops) # 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 Active Witnesses Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves and prints a table of active witnesses on the network. Requires an initialized Witnesses object. ```python from nectar.witness import Witnesses w = Witnesses() w.printAsTable() ``` -------------------------------- ### Get Potential Signatures for Transaction Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves potential signatures for a given transaction. Requires importing TransactionBuilder and Blockchain. ```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 Active Votes for a Post Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches and prints active votes associated with a specific post. Requires an Account object to get the post and an ActiveVotes object initialized with the post's author permission. ```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() ``` -------------------------------- ### Get Next Scheduled Hardfork Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves information about the next scheduled hardfork. Requires initializing the Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_hardfork_properties()) ``` -------------------------------- ### get_trending_tags Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves trending tags on the blockchain, starting from a specific tag. ```APIDOC ## get_trending_tags ### Description Retrieves trending tags on the blockchain, starting from a specific tag. ### Method Python Function Call ### Code Example ```python from nectar.discussions import Query, Trending_tags q = Query(limit=10, start_tag="hive") for h in Trending_tags(q): print(h) ``` ``` -------------------------------- ### Get Discussions by Feed Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions for a user's feed, filtered by a tag. Requires a Query object. ```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 Expiring Vesting Delegations Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves information about expiring vesting delegations for an account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") print(acc.get_expiring_vesting_delegations()) ``` -------------------------------- ### Get Top Witnesses by Vote Count Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Retrieves a list of top witnesses ranked by their vote count. Requires a Hive instance. ```python # Top 100 witnesses sorted by votes for witness in WitnessesRankedByVote(limit=21, blockchain_instance=hv): print(witness["owner"], witness["votes"]) ``` -------------------------------- ### Get Witness Count Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the total number of witnesses. Requires importing Witnesses. ```python from nectar.witness import Witnesses w = Witnesses() print(w.witness_count) ``` -------------------------------- ### Lookup Account Names (Full=False) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Looks up account information, with 'full' set to False, returning minimal details. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg", full=False) print(acc.json()) ``` -------------------------------- ### Simple Sell Order Script Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Place a sell order on the market using `Market.sell()`. Specify the price and the amount of the quote asset to sell. Set `nobroadcast=False` to execute the order. ```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 Transaction Hex Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the hexadecimal representation of a transaction. Requires importing Blockchain. ```python from nectar.blockchain import Blockchain b = Blockchain() block = b.get_current_block() trx = block.json()["transactions"][0] print(b.get_transaction_hex(trx)) ``` -------------------------------- ### Show Balances Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Display the balances for specified Hive accounts. ```bash hive-nectar balance account_name1 account_name2 ``` -------------------------------- ### Get Replies by Last Update Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves replies to a post, ordered by last update time. Requires importing Query and Replies_by_last_update. ```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) ``` -------------------------------- ### Query Account Blog Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Fetches posts from an account's blog. Requires a Hive instance and a Query object. ```python blog_q = Query(limit=5, tag="thecrazygm") for post in Discussions_by_blog(query=blog_q, blockchain_instance=hv): print(post["title"]) ``` -------------------------------- ### Get Trade History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the historical trade data from the market. Requires importing Market. ```python from nectar.market import Market m = Market() for t in m.trade_history(): print(t) ``` -------------------------------- ### Witness Initialization with Unexpected Parameters Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/changelog.rst The Witness constructor now accepts **kwargs, issuing warnings for any unexpected parameters. ```python from hive.witness import Witness # Initialize Witness, unexpected kwargs will raise warnings # witness = Witness(unexpected_param='value') ``` -------------------------------- ### Initialize Blocks with Optional Parameters Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/changelog.rst The Blocks constructor now correctly handles **kwargs, and supports 'only_ops' and 'only_virtual_ops' parameters for filtering operations. ```python from hive.block import Blocks # Initialize Blocks with optional parameters # blocks = Blocks(only_ops=['vote'], only_virtual_ops=['follow']) # blocks_with_kwargs = Blocks(some_other_kwarg='value') ``` -------------------------------- ### Wallet Management for Key Storage Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Demonstrates creating, unlocking, and managing private keys within an AES-encrypted SQLite wallet using the Hive instance. Requires a passphrase for security. ```python from nectar import Hive hv = Hive() # Create a brand-new wallet (raises WalletExists if one already exists) hv.wallet.wipe(True) hv.wallet.create("supersecret-passphrase") # Unlock the wallet hv.wallet.unlock("supersecret-passphrase") # Add a WIF private key hv.wallet.addPrivateKey("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3") # List all stored public keys for pubkey in hv.wallet.getPublicKeys(): print(pubkey) # Retrieve private key for a given public key wif = hv.wallet.getPrivateKeyForPublicKey( "STM6MQBLaX9Q15CK3prXoWK4C6EqtsL7C4rqq1h6BQjxvfk9tuN" ) print(wif) # Remove a key hv.wallet.removePrivateKeyFromPublicKey( "STM6MQBLaX9Q15CK3prXoWK4C6EqtsL7C4rqq1h6BQjxvfk9tuN" ) # Lock the wallet again hv.wallet.lock() print(hv.wallet.locked()) # True ``` -------------------------------- ### Import Hive Account Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst Use this command to import your existing Hive account into hive-nectar. ```bash hive-nectar importaccount ``` -------------------------------- ### TransactionBuilder - Build and Sign Transactions Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Assemble and sign custom Hive transactions using various operations like Transfer, Vote, and Comment options. Requires a WIF key for signing. ```python from nectar.transactionbuilder import TransactionBuilder from nectarbase.operations import Transfer, Vote, Comment_options from nectar import Hive wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" hv = Hive(nobroadcast=True, keys={"active": wif}) ``` -------------------------------- ### Set and Use Shared Hive Instance Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Initialize a Hive object, set it as the shared blockchain instance, and then create an account without explicitly passing the instance. ```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") ``` -------------------------------- ### Load Configuration Directly Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Load the configuration storage directly without initializing the Hive class. Use this for standalone configuration access. ```python from nectar.storage import configStorage as config ``` -------------------------------- ### Get Block Header Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the header for a specific block. Requires an initialized BlockHeader object. ```python from nectar.block import BlockHeader print(BlockHeader(1)) ``` -------------------------------- ### Set Hive Nodes via Command Line (General) Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Use the command line tool to update nodes. This is a general command for updating nodes. ```bash hive-nectar updatenodes ``` -------------------------------- ### Convert Beneficiary Weights to Percentages Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/changelog.rst Ensures accurate beneficiary percentage outputs by converting weights from HIVE_100_PERCENT units (10000) to standard percentages. ```python from hive.comment import Comment # Assuming 'comment' is a Comment object # beneficiaries_pct = Comment.get_beneficiaries_pct(comment) # print(f"Beneficiary percentages: {beneficiaries_pct}") ``` -------------------------------- ### Append WIF Directly Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Demonstrates using `appendWif` to sign transactions directly with a private key without relying on wallet lookups. ```APIDOC ## Use appendWif Directly ### Description Signs a transaction using a provided WIF private key directly, bypassing wallet lookups. ### Method ```python TransactionBuilder(...).appendWif(wif) ``` ### Parameters - **wif**: The WIF private key to sign with. ### Example ```python tx3 = TransactionBuilder(blockchain_instance=Hive(nobroadcast=True)) tx3.appendOps(Vote({"voter": "alice", "author": "bob", "permlink": "a-post", "weight": 10000})) tx3.appendWif(wif) tx3.sign() print(tx3["signatures"]) ``` ``` -------------------------------- ### Set Default Account via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Set the default account name using the hive-nectar command-line tool. ```bash hive-nectar set default_account test ``` -------------------------------- ### Get Transaction Details Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the details of a specific transaction using its ID. Requires importing Blockchain. ```python from nectar.blockchain import Blockchain b = Blockchain() print(b.get_transaction("6fde0190a97835ea6d9e651293e90c89911f933c")) ``` -------------------------------- ### Initialize Hive Object with Shared Instance Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Create a Hive object and associate it with a specific account, ensuring they use the same blockchain instance. ```python from nectar import Hive from nectar.account import Account hive = Hive() account = Account("test", blockchain_instance=hive) print(hive.is_hive) ``` -------------------------------- ### Perform a Transfer with Nectar Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst This snippet demonstrates how to initiate a transfer of assets between accounts. Ensure the wallet is unlocked and the default account is configured or specified. ```python from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") account = Account("test", blockchain_instance=hive) account.transfer("<to>", "<amount>", "<asset>", "<memo>") ``` -------------------------------- ### Get Recent Market Trades Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of recent trades from the market. Requires importing Market. ```python from nectar.market import Market m = Market() for t in m.recent_trades(): print(t) ``` -------------------------------- ### Batch API Calls with AppBase Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst Demonstrates how to queue API calls using AppBase RPC nodes. Calls with `add_to_queue=True` are stored and sent together when a call with `add_to_queue=False` is made. ```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_api", add_to_queue=False) len(result) ``` ```python 2 ``` -------------------------------- ### Get Operations in Block Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves operations within a specific block. The `only_ops=True` parameter filters for operations only. ```python from nectar.block import Block b = Block(2e6, only_ops=True) print(b) ``` -------------------------------- ### Get Feed History Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the feed history from the Hive blockchain. Requires initializing the Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_feed_history()) ``` -------------------------------- ### Perform Transaction with Temporary Keys Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Initialize a Hive object with temporary private keys directly. This bypasses the need for a wallet for signing operations. ```python from nectar import Hive hive = Hive(keys=["xxxxxxxxx"]) account = Account("test", blockchain_instance=hive) account.transfer("<to>", "<amount>", "<asset>", "<memo>") ``` -------------------------------- ### Get Account Feed Entries Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves feed entries for a specific account. Requires an Account object. ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_feed_entries(): print(f) ``` -------------------------------- ### Get Discussions by Trending Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions sorted by trending, filtered by a tag. Uses a Query object. ```python from nectar.discussions import Query, Discussions_by_trending q = Query(limit=10, tag="hive") for h in Discussions_by_trending(q): print(h) ``` -------------------------------- ### Bundle Multiple Operations Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Shows how to bundle multiple operations into a single transaction before signing and broadcasting. ```APIDOC ## Bundle Multiple Operations ### Description Allows bundling multiple operations into a single transaction for efficiency. ### Method ```python TransactionBuilder(blockchain_instance=hv_bundle).appendOps(Operation({...})) ``` ### Parameters - **blockchain_instance**: An instance of the Hive blockchain, potentially configured for bundling. - **Operations**: Multiple operations appended using `appendOps`. ### Example ```python hv_bundle = Hive(nobroadcast=True, bundle=True) tx2 = TransactionBuilder(blockchain_instance=hv_bundle) tx2.appendOps(Transfer({"from": "alice", "to": "charlie", "amount": "0.500 HIVE", "memo": ""})) tx2.appendOps(Transfer({"from": "alice", "to": "dave", "amount": "0.500 HIVE", "memo": ""})) tx2.appendSigner("alice", "active") print(tx2.json()) # Inspect the unsigned bundled transaction ``` ``` -------------------------------- ### Add Individual Private Key Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst This command allows you to add a single private key to your wallet. ```bash hive-nectar addkey <private_key> ``` -------------------------------- ### Create and Unlock Hive Wallet Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Initialize a Hive object, wipe any existing wallet, and then unlock it with a passphrase. This is necessary before the first wallet use. ```python from nectar import Hive hive = Hive() hive.wallet.wipe(True) hive.wallet.unlock("wallet-passphrase") ``` -------------------------------- ### Get Chain Properties Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches the current properties of the Hive chain. Requires an initialized Hive object. ```python from nectar import Hive hv = Hive() print(hv.get_chain_properties()) ``` -------------------------------- ### Set Default Account via Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Set the default account name programmatically. This account will be used for operations when none is specified. ```python from nectar import Hive hv = Hive() hv.set_default_account("test") hv.config["default_account"] = "test" ``` -------------------------------- ### 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 initialized Account object. ```python from nectar.account import Account acc = Account("gtg") for h in acc.get_account_votes(): print(h) ``` -------------------------------- ### Hive-Nectar CLI Usage Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst The general usage pattern for the hive-nectar CLI, including common options for specifying nodes, offline mode, and broadcast behavior. ```bash 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. ``` -------------------------------- ### Vote Initialization with Deprecated Instances Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/changelog.rst The Vote constructor now supports deprecated 'steem_instance' and 'hive_instance' kwargs, issuing deprecation warnings. ```python from hive.vote import Vote # Initialize Vote with deprecated instances (will show warnings) # vote = Vote(steem_instance=old_steem_instance) # vote_hive = Vote(hive_instance=old_hive_instance) ``` -------------------------------- ### Get Trending Tags Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of trending tags on the Hive blockchain. Requires importing Query and Trending_tags. ```python from nectar.discussions import Query, Trending_tags q = Query(limit=10, start_tag="hive") for h in Trending_tags(q): print(h) ``` -------------------------------- ### Initialize Hive Connection in Python Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Initialize a connection to the Hive blockchain using Python. This involves updating the node list and creating a Hive object. ```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) ``` -------------------------------- ### Get Required Signatures for Transaction Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves the required signatures for a given transaction. Requires importing TransactionBuilder and Blockchain. ```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()) ``` -------------------------------- ### get_following Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves a list of accounts that a given account is following. ```APIDOC ## get_following ### Description Fetches a list of all accounts that the specified Hive account is currently following. ### Method Nectar Python SDK function ### Parameters - **account** (string) - Required - The username of the account whose following list to retrieve. ### Request Example ```python from nectar.account import Account acc = Account("gtg") for f in acc.get_following(): print(f) ``` ### Response - **f** (string) - The username of an account being followed. ### Response Example ``` # Output will vary based on following data ``` ``` -------------------------------- ### Access Market Ticker Data Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst Instantiate the Market class and retrieve ticker information. Requires the market pair as a string. ```python from nectar.market import Market market = Market("HBD:HIVE") print(market.ticker()) ``` -------------------------------- ### Get Discussions by Votes Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions sorted by the number of votes they have received. Uses a Query object with a limit. ```python from nectar.discussions import Query, Discussions_by_votes q = Query(limit=10) for h in Discussions_by_votes(q): print(h) ``` -------------------------------- ### Dynamic Node Discovery with NodeList Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Fetches and caches ranked node data from PeakD/v4v beacon APIs. Falls back to a hardcoded list if caching fails. Demonstrates clearing the cache for a fresh fetch. ```python from nectar.nodelist import NodeList, clear_beacon_cache nl = NodeList() print(nl.get_hive_nodes()) # ['https://api.hive.blog', 'https://api.openhive.network', ...] print(nl.get_nodes()) # same as get_hive_nodes() — full scored node list # Force fresh fetch (e.g., after detecting node failures) clear_beacon_cache() nl2 = NodeList() ``` -------------------------------- ### Get Discussions by Hotness Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Fetches discussions sorted by their 'hotness' algorithm, filtered by a tag. Uses a Query object. ```python from nectar.discussions import Query, Discussions_by_hot q = Query(limit=10, tag="hive") for h in Discussions_by_hot(q): print(h) ``` -------------------------------- ### Lookup Similar Account Names Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Finds account names similar to a given name, with a specified limit. Requires importing Account. ```python from nectar.account import Account acc = Account("gtg") for a in acc.get_similar_account_names(limit=100): print(a) ``` -------------------------------- ### List Accounts Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst View a list of all accounts managed by hive-nectar. ```bash hive-nectar listaccounts ``` -------------------------------- ### Test Wallet Unlocking via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Test if the wallet unlocks automatically without prompting for a password using the hive-nectar command-line tool. ```bash hive-nectar walletinfo --test-unlock ``` -------------------------------- ### Get Comment Discussions by Payout Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves discussions sorted by payout. Requires a Query object and the Comment_discussions_by_payout class. ```python from nectar.discussions import Query, Comment_discussions_by_payout q = Query(limit=10) for h in Comment_discussions_by_payout(q): print(h) ``` -------------------------------- ### Enable INFO Level Logging Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst Configure Python's logging module to display informational messages and above. This is useful for general debugging. ```python import logging log = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) ``` -------------------------------- ### Set Password Storage to Keyring via CLI Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst Configure hive-nectar to use the system's keyring for storing the master password. This will prompt for the password upon execution. ```bash hive-nectar set password_storage keyring ``` -------------------------------- ### get_escrow Source: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst Retrieves escrow details for a given account. ```APIDOC ## get_escrow ### Description Retrieves details about escrow agreements associated with a specific Hive account. ### Method Nectar Python SDK function ### Parameters - **account** (string) - Required - The username of the account to retrieve escrow details for. ### Request Example ```python from nectar.account import Account acc = Account("gtg") print(acc.get_escrow()) ``` ### Response - **(object)** - An object containing escrow details. ### Response Example ```json { "example": "{\"escrow_id\": 123, \"from\": \"user1\", \"to\": \"user2\", ...}" } ``` ``` -------------------------------- ### Get Witnesses Voted by an Account Source: https://context7.com/thecrazygm/hive-nectar/llms.txt Retrieves a list of witnesses that a specific account has voted for. Requires a Hive instance. ```python # Which witnesses has an account voted for? for witness in WitnessesVotedByAccount("thecrazygm", blockchain_instance=hv): print(witness["owner"]) ```