cleos

Python front-end for EOSIO cleos.

class cleos.CreateAccount(creator, name, owner_key, active_key='', permission='', expiration_sec=30, skip_signature=0, dont_broadcast=0, forceUnique=0, max_cpu_usage=0, max_net_usage=0, ref_block='', is_verbose=1)

Bases: cleos._Cleos

Create an account, buy ram, stake for bandwidth for the account.

  • parameters:

    creator: The name, of the account creating the new account. May be an 
        object having the attribute `name`, like `CreateAccount`, 
        or a string.
    name: The name of the new account.
    owner_key: The owner public key for the new account.
    active_key: The active public key for the new account.
    
    permission: An account and permission level to authorize, as in 
        'account@permission'. May be a `CreateAccount` or `Account` object
    expiration: The time in seconds before a transaction expires, 
        defaults to 30s
    skip_sign: Specify if unlocked wallet keys should be used to sign 
        transaction.
    dont_broadcast: Don't broadcast transaction to the network (just print).
    forceUnique: Force the transaction to be unique. this will consume extra 
        bandwidth and remove any protections against accidently issuing the 
        same transaction multiple times.
    max_cpu_usage: Upper limit on the milliseconds of cpu usage budget, for 
        the execution of the transaction 
        (defaults to 0 which means no limit).
    max_net_usage: Upper limit on the net usage budget, in bytes, for the 
        transaction (defaults to 0 which means no limit).
    ref_block: The reference block num or block id used for TAPOS 
        (Transaction as Proof-of-Stake).
    
  • attributes:

    owner_key: Owner private key.
    active_key: Active private key.
    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.    
    
class cleos.CreateKey(key_name, key_public='', key_private='', r1=False, is_verbose=1)

Bases: cleos._Cleos

Create a new keypair and print the public and private keys.

  • parameters:

    key_name: Key name.
    r1: Generate a key using the R1 curve (iPhone), instead of the 
        K1 curve (Bitcoin)
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.    
    
class cleos.GetAccount(account, is_verbose=1, json=False)

Bases: cleos._Cleos

Retrieve an account from the blockchain.

  • parameters:

    account: The account object or the name of the account to retrieve.
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    name: The name of the account.
    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.GetAccounts(key, is_verbose=1)

Bases: cleos._Cleos

Retrieve accounts associated with a public key.

  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.GetBlock(block_number, block_id='', is_verbose=1)

Bases: cleos._Cleos

Retrieve a full block from the blockchain.

  • parameters:

    block_number: The number of the block to retrieve.
    block_id: The ID of the block to retrieve, if set, defaults to "".
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.    
    
class cleos.GetCode(account, code='', abi='', wasm=False, is_verbose=1)

Bases: cleos._Cleos

Retrieve the code and ABI for an account.

  • parameters:

    account: The name of an account whose code should be retrieved. 
        May be an object having the  May be an object having the attribute 
        `name`, like `CreateAccount`, or a string.
    code: The name of the file to save the contract .wast/wasm to.
    abi: The name of the file to save the contract .abi to.
    wasm: Save contract as wasm.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.    
    
class cleos.GetInfo(is_verbose=1)

Bases: cleos._Cleos

Get current blockchain information.

  • parameters:

    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.GetTable(contract, table, scope, binary=False, limit=10, key='', lower='', upper='', is_verbose=1)

Bases: cleos._Cleos

Retrieve the contents of a database table

  • parameters:

    contract: The name, of the contract that owns the table. May be 
        an object having the  May be an object having the attribute 
        `name`, like `CreateAccount`, or a string.
    scope: The scope within the contract in which the table is found,
        can be a `CreateAccount` or `Account` object, or a name.
    table: The name of the table as specified by the contract abi.
    binary: Return the value as BINARY rather than using abi to 
        interpret as JSON
    limit: The maximum number of rows to return.
    key: The name of the key to index by as defined by the abi, 
        defaults to primary key.
    lower: JSON representation of lower bound value of key, 
        defaults to first.
    upper: JSON representation of upper bound value value of key, 
        defaults to last.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.GetTransaction(transaction_id, is_verbose=1)

Bases: cleos._Cleos

Retrieve a transaction from the blockchain

  • parameters:

    transaction_id: ID of the transaction to retrieve.
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    transaction_id: ID of the transaction retrieved.
    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.PushAction(account, action, data, permission='', expiration_sec=30, skip_signature=0, dont_broadcast=0, forceUnique=0, max_cpu_usage=0, max_net_usage=0, ref_block='', is_verbose=1, json=False)

Bases: cleos._Cleos

Push a transaction with a single action

  • parameters:

    account: The account to publish a contract for.  May be an object 
        having the  May be an object having the attribute `name`, like 
        `CreateAccount`, or a string.
    action: A JSON string or filename defining the action to execute on 
        the contract.
    data: The arguments to the contract.
    
    permission: An account and permission level to authorize, as in 
        'account@permission'. May be a `CreateAccount` or `Account` object
    expiration: The time in seconds before a transaction expires, 
        defaults to 30s
    skip_sign: Specify if unlocked wallet keys should be used to sign 
        transaction.
    dont_broadcast: Don't broadcast transaction to the network (just print).
    forceUnique: Force the transaction to be unique. this will consume extra 
        bandwidth and remove any protections against accidently issuing the 
        same transaction multiple times.
    max_cpu_usage: Upper limit on the milliseconds of cpu usage budget, for 
        the execution of the transaction 
        (defaults to 0 which means no limit).
    max_net_usage: Upper limit on the net usage budget, in bytes, for the 
        transaction (defaults to 0 which means no limit).
    ref_block: The reference block num or block id used for TAPOS 
        (Transaction as Proof-of-Stake).
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.SetContract(account, contract_dir, wast_file='', abi_file='', permission='', expiration_sec=30, skip_signature=0, dont_broadcast=0, forceUnique=0, max_cpu_usage=0, max_net_usage=0, ref_block='', is_verbose=1)

Bases: cleos._Cleos

Create or update the contract on an account.

  • parameters:

    account: The account to publish a contract for. May be an object 
        having the  May be an object having the attribute `name`, like 
        `CreateAccount`, or a string.
    contract_dir: The path containing the .wast and .abi. 
    wast_file: The file containing the contract WAST or WASM (absolute).
    abi_file: The ABI for the contract (absolute).
    
    permission: An account and permission level to authorize, as in 
        'account@permission'. May be a `CreateAccount` or `Account` object
    expiration: The time in seconds before a transaction expires, 
        defaults to 30s
    skip_sign: Specify if unlocked wallet keys should be used to sign 
        transaction.
    dont_broadcast: Don't broadcast transaction to the network (just print).
    forceUnique: Force the transaction to be unique. this will consume extra 
        bandwidth and remove any protections against accidently issuing the 
        same transaction multiple times.
    max_cpu_usage: Upper limit on the milliseconds of cpu usage budget, for 
        the execution of the transaction 
        (defaults to 0 which means no limit).
    max_net_usage: Upper limit on the net usage budget, in bytes, for the 
        transaction (defaults to 0 which means no limit).
    ref_block: The reference block num or block id used for TAPOS 
        (Transaction as Proof-of-Stake).
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.    
    
class cleos.WalletCreate(name='default', password='', is_verbose=1)

Bases: cleos._Cleos

Create a new wallet locally.

  • parameters:

    name: The name of the new wallet, defaults to `default`.
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    name: The name of the wallet.
    password: The password returned by wallet create.
    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletImport(key, wallet='default', is_verbose=1)

Bases: cleos._Cleos

Import a private key into wallet.

  • parameters:

    wallet: A wallet object or the name of the wallet to import key into.
    key: A key object or a private key in WIF format to import.
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletKeys(is_verbose=1)

Bases: cleos._Cleos

List of public keys from all unlocked wallets.

  • parameters:

    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • parameters:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletList(is_verbose=1)

Bases: cleos._Cleos

List opened wallets, * marks unlocked.

  • parameters:

    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletLock(wallet='default', is_verbose=1)

Bases: cleos._Cleos

Lock wallet.

  • parameters:

    wallet: The name of the wallet to import key into. May be an object 
        having the  May be an object having the attribute `name`, like 
        `CreateAccount`, or a string. 
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • parameters:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletLockAll(wallet='default', is_verbose=1)

Bases: cleos._Cleos

Lock all unlocked wallets.

class cleos.WalletOpen(wallet='default', is_verbose=1)

Bases: cleos._Cleos

Open an existing wallet.

  • parameters:

    wallet: The name of the wallet to import key into. May be an object 
        having the  May be an object having the attribute `name`, like 
        `CreateAccount`, or a string. 
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
class cleos.WalletStop(is_verbose=1)

Bases: cleos._Cleos

Stop keosd (doesn’t work with nodeos).

class cleos.WalletUnlock(wallet='default', password='', timeout=0, is_verbose=1)

Bases: cleos._Cleos

Unlock wallet.

  • parameters:

    wallet: The name of the wallet. May be an object 
        having the  May be an object having the attribute `name`, 
        like `CreateAccount`, or a string.
    password: If the wallet argument is not a wallet object, the password 
        returned by wallet create, else anything, defaults to "".
    is_verbose: If `0`, do not print unless on error; if `-1`, 
        do not print. Default is `1`.
    
  • attributes:

    error: Whether any error ocurred.
    json: The json representation of the object.
    is_verbose: Verbosity at the construction time.
    
cleos.set_wallet_url_arg(cleos_object, url=None, check_error=True)

Implements the use_keosd flag in the setup module.