GentBG x PUSSTEEM - burning both STEEM and PUSS

Image
by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/gentbg-x-pussteem-burning-both-steem-and-puss Hello, this is @joviansummer(witness: @jswit), developer of GentBG project. I registered @gentbg account to PUSSTEEM about a week ago and donated some of my own PUSS token to @gentbg's EPUSS account. Now, @gentbg will burn STEEM and EPUSS at the same time. PUSSTEEM's boosting upvotes will help increasing baseline burning significantly. @gentbg's SP reward is delegate to @jsup to get automated upvotes, forming a baseline burning of liquid reward independent of other people's upvotes. Some may argue 100%(both liquid and SP reward) burning is much better, but I chose this approach to prevent @gentbg from becoming a spamming account. Constantly asking for upvotes via mentioning and commenting every week may eventually become a big annoyance to curators. That being said, anyone is welcome to participate in countering STEEM inflation by giving upvotes ...

파이썬(steem-python)에서 스팀잇 계정의 현재 스팀파워(SP) 확인

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/steem-python-sp


steem-python을 이용해서 특정 스팀id의 현재 스팀파워를 확인할 수 있습니다. 우선 계정 정보를 가져옵니다. 이 부분은 예전에 포스팅했던 바 있습니다. 아래의 링크입니다.

파이썬(steem-python)에서 스팀잇 계정 정보 확인
https://steemit.com/hive-141029/@joviansummer/rvj35-steem-python

여기에 한번 더 써 보면 아래와 같습니다.

from steem import Steem

steem_id = 'joviansummer'
s = Steem()
user_info = s.get_account(steem_id)

스팀 블럭체인에서는 스팀파워가 아니라 VEST라는 단위를 사용합니다. 위의 코드로 가져온 계정 정보는 딕셔너리(dict) 형식이며, 스팀파워 관련 키(key)는 다음과 같습니다.

vesting_shares: 소유하고 있는 스팀파워(단위: VEST)
delegated_vesting_shares: 임대한 스팀파워(단위: VEST)
received_vesting_shares: 임대 받은 스팀파워(단위: VEST)

따라서, 현재 가용한 스팀파워 = 소유한 SP - 임대한 SP + 임대 받은 SP 이런 식으로 계산할 수 있습니다.

값은 '920224.825430 VESTS' 이렇게 문자열(str) 형식으로 받게 되므로, 위의 계산을 하려면 약간의 변환작업이 필요합니다.

from steem import Steem

s = Steem()
user_info = s.get_account('joviansummer')

vesting_shares = float(user_info['vesting_shares'].split(' ')[0])
delegated_shares = float(user_info['delegated_vesting_shares'].split(' ')[0])
received_shares = float(user_info['received_vesting_shares'].split(' ')[0])

current_shares = vesting_shares - delegated_shares + received_shares

문자열에서 split()을 이용해서 공백 기준으로 첫번째([0], 인덱스 0) 항목을 잘라낸 후에 부동소수점 수자(float) 형식으로 변환해 주었습니다.

이제 VEST 값을 스팀파워(SP)로 변환해 보겠습니다. Converter 객체의 vests_to_sp()를 이용합니다.

from steem.converter import Converter

c = Converter()
current_sp = c.vests_to_sp(current_shares)

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기