Git Product home page Git Product logo

transmitter's Introduction

transmitter

Transmitter is a CLI tool for HIVE blockchain witnesses. It quickly allows you to enable/disable your witness or set some properties for the new witness_set_properties call introduced in Hard Fork 20.

Installation

$ pip install transmitter

Configuration (Optional)

If you don't want to repeat yourself while calling commands, create a configuration file on your user directory:

$ mkdir -p ~/.transmitter
$ touch ~/.transmitter/config.json

Fill it with the corresponding values:

{
    "NODES": [
        "https://hived.emre.sh"
    ],
    "WITNESS_ACCOUNT": "<your_witness_account>",
    "SIGNING_KEY": "<signing_key>",
    "ACTIVE_KEY": "<active_key>",
    "DEFAULT_PROPERTIES": {
      "account_creation_fee": "3 HIVE",
      "maximum_block_size": 65536,
      "hbd_interest_rate": 0
    },
    "URL": "https://hive.blog/@emrebeyler"
}

All keys are optional. If you don't want to keep your signing key and active key in the config file, that's fine.

You can pass it to the commands in different ways:

  • Use TRANSMITTER_SIGNING_KEY and TRANSMITTER_ACTIVE_KEY environment values.
  • Use --signing-key and --active-key params while running the tool.

That's the same with WITNESS_ACCOUNT and URL parameters.

DEFAULT_PROPERTIES has a special case. You can't pass it via CLI parameters or environment vars. If you don't fill that key, transmitter will use the latest props information belongs to your witness account in the blockchain.

Enabling the witness

If you want to enable your witness:

$ transmitter enable 

Disabling the witness

$ transmitter disable

Setting a new property

$ transmitter set --property account_subsidy_decay=128 --property account_subsidy_budget=2

You can send single or multiple parameters.

Price feed

$ transmitter publish_feed

Bonus: Installation with Docker

$ git clone https://github.com/emre/transmitter.git
$ cd transmitter

Edit the config file as you wish:

$ vim config.json.docker 
$ docker build -t transmitter .

After that, you can run the transmitter like docker run -t transmitter <command>.

Example:

➜  transmitter git:(master) ✗ docker run -t transmitter disable
2018-10-08 19:14:20,326 - transmitter.main - INFO - Connecting to the blockchain using mainnet.
2018-10-08 19:14:21,007 - transmitter.main - INFO - Got the SIGNING_KEY in the config file.
2018-10-08 19:14:21,238 - transmitter.main - INFO - Got the WITNESS_ACCOUNT in the config file.
2018-10-08 19:14:21,403 - transmitter.main - INFO - Got the URL in the config file.
2018-10-08 19:14:21,403 - transmitter.main - INFO - Disabling the witness: <Witness emrebeyler>
2018-10-08 19:14:24,823 - transmitter.main - INFO - Operation broadcasted.

Disclaimer

Even though, I use transmitter in my witness operations, it's strongly advised for you to review and audit the code before using it. This software may include bugs, use it at your own risk.

transmitter's People

Contributors

crokkon avatar emre avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lemony-cricket

transmitter's Issues

pkg_resources.ContextualVersionConflict: (beem 0.23.9 (/usr/local/lib/python3.6/site-packages), Requirement.parse('beem==0.24.19'), {'transmitter'})

Can you help figure this error please?

docker run -t transmitter set --property hbd_interest_rate=2c01

╰─± docker run -t transmitter set --property hbd_interest_rate=2c01
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 574, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (beem 0.23.9 (/usr/local/lib/python3.6/site-packages), Requirement.parse('beem==0.24.19'), {'transmitter'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/transmitter", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3088, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3072, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 576, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 589, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'beem==0.24.19' distribution was not found and is required by transmitter

This is the build messages for reference

docker build -t transmitter .

╰─± docker build -t transmitter .
Sending build context to Docker daemon  137.2kB
Step 1/9 : FROM publysher/alpine-numpy
 ---> bd60ccc63866
Step 2/9 : COPY . /app
 ---> Using cache
 ---> 22e203cd09c0
Step 3/9 : RUN mkdir -v '/root/.transmitter/'
 ---> Using cache
 ---> 6ac839461b8d
Step 4/9 : RUN mv -v /app/config.json.docker /root/.transmitter/config.json
 ---> Using cache
 ---> 71aeae1a697c
Step 5/9 : WORKDIR /app
 ---> Using cache
 ---> 7c128f13d108
Step 6/9 : RUN apk add --no-cache gcc python3-dev libc-dev libressl-dev
 ---> Using cache
 ---> b4a39c16a551
Step 7/9 : RUN pip3 install requests beem==0.23.9
 ---> Using cache
 ---> 3c8d98c08f0d
Step 8/9 : RUN pip3 install -e . --no-deps
 ---> Using cache
 ---> 906ef88543e7
Step 9/9 : ENTRYPOINT ["transmitter"]
 ---> Using cache
 ---> ca81a064e8b5
Successfully built ca81a064e8b5
Successfully tagged transmitter:latest

json.decoder.JSONDecodeError: Expecting ',' delimiter: line 11 column 29 (char 366)

Is there something wrong with my config or it's something else?

Here is the error:

╰─± docker run -t transmitter set --property hbd_interest_rate=300
Traceback (most recent call last):
  File "/usr/local/bin/transmitter", line 11, in <module>
    load_entry_point('transmitter', 'console_scripts', 'transmitter')()
  File "/app/transmitter/main.py", line 259, in main
    peg_multiplier=args.peg_multiplier,
  File "/app/transmitter/main.py", line 35, in __init__
    self.config = self.get_config(config_file)
  File "/app/transmitter/main.py", line 87, in get_config
    config = json.loads(open(config_file).read())
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 11 column 29 (char 366)

Here is my config:

{
    "NODES": [
        "https://hived.emre.sh"
    ],
    "WITNESS_ACCOUNT": "helo",
    "SIGNING_KEY": "5J...yP",
    "ACTIVE_KEY": "5J...4F",
    "DEFAULT_PROPERTIES": {
      "account_creation_fee": "3 HIVE",
      "maximum_block_size": 65536,
      "hbd_interest_rate": 300
    },
    "URL": "https://hive.blog/@helo"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.