beem.hivesigner

class beem.hivesigner.HiveSigner(blockchain_instance=None, *args, **kwargs)

Bases: object

Parameters:scope (str) – comma separated string with scopes login,offline,vote,comment,delete_comment,comment_options,custom_json,claim_reward_balance
# Run the login_app in examples and login with a account
from beem import Steem
from beem.HiveSigner import HiveSigner
from beem.comment import Comment
hs = HiveSigner(client_id="beem.app")
steem = Steem(HiveSigner=hs)
steem.wallet.unlock("supersecret-passphrase")
post = Comment("author/permlink", blockchain_instance=steem)
post.upvote(voter="test")  # replace "test" with your account

Examples for creating HiveSigner urls for broadcasting in browser:

from beem import Steem
from beem.account import Account
from beem.HiveSigner import HiveSigner
from pprint import pprint
steem = Steem(nobroadcast=True, unsigned=True)
hs = HiveSigner(blockchain_instance=steem)
acc = Account("test", blockchain_instance=steem)
pprint(hs.url_from_tx(acc.transfer("test1", 1, "HIVE", "test")))
'https://hivesigner.com/sign/transfer?from=test&to=test1&amount=1.000+HIVE&memo=test'
from beem import Steem
from beem.transactionbuilder import TransactionBuilder
from beembase import operations
from beem.HiveSigner import HiveSigner
from pprint import pprint
stm = Steem(nobroadcast=True, unsigned=True)
hs = HiveSigner(blockchain_instance=stm)
tx = TransactionBuilder(blockchain_instance=stm)
op = operations.Transfer(**{"from": 'test',
                            "to": 'test1',
                            "amount": '1.000 HIVE',
                            "memo": 'test'})
tx.appendOps(op)
pprint(hs.url_from_tx(tx.json()))
'https://hivesigner.com/sign/transfer?from=test&to=test1&amount=1.000+HIVE&memo=test'
addToken(name, token)
broadcast(operations, username=None)

Broadcast an operation

Sample operations:

[
    [
        'vote', {
                    'voter': 'gandalf',
                    'author': 'gtg',
                    'permlink': 'steem-pressure-4-need-for-speed',
                    'weight': 10000
                }
    ]
]
changePassphrase(new_pwd)

Change the passphrase for the wallet database

create(pwd)

Alias for newWallet()

Parameters:pwd (str) – Passphrase for the created wallet
create_hot_sign_url(operation, params, redirect_uri=None)

Creates a link for broadcasting an operation

Parameters:
  • operation (str) – operation name (e.g.: vote)
  • params (dict) – operation dict params
  • redirect_uri (str) – Redirects to this uri, when set
created()

Do we have a wallet database already?

getPublicNames()

Return all installed public token

getTokenForAccountName(name)

Obtain the private token for a given public name

Parameters:name (str) – Public name
get_access_token(code)
get_login_url(redirect_uri, **kwargs)

Returns a login url for receiving token from HiveSigner

headers
is_encrypted()

Is the key store encrypted?

lock()

Lock the wallet database

locked()

Is the wallet database locked?

me(username=None)

Calls the me function from HiveSigner

from beem.HiveSigner import HiveSigner
hs = HiveSigner()
hs.steem.wallet.unlock("supersecret-passphrase")
hs.me(username="test")
newWallet(pwd)

Create a new wallet database

Parameters:pwd (str) – Passphrase for the created wallet
refresh_access_token(code, scope)
removeTokenFromPublicName(name)

Remove a token from the wallet database

Parameters:name (str) – token to be removed
revoke_token(access_token)
setToken(loadtoken)

This method is strictly only for in memory token that are passed to Wallet/Steem with the token argument

set_access_token(access_token)

Is needed for broadcast() and me()

set_username(username, permission='posting')

Set a username for the next broadcast() or me() operation. The necessary token is fetched from the wallet

unlock(pwd)

Unlock the wallet database

unlocked()

Is the wallet database unlocked?

update_user_metadata(metadata)
url_from_tx(tx, redirect_uri=None)

Creates a link for broadcasting an operation

Parameters:
  • tx (dict) – includes the operation, which should be broadcast
  • redirect_uri (str) – Redirects to this uri, when set