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 ...

파이썬 beem에서 계정 트랜잭션 이력 조회(범위 지정)

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/4dhioe-beem


우선, 파이썬 beem에서 계정 트랜잭션(transaction) 이력을 가장 최근 항목부터 순차적으로 가져오는 기능은 Account 객체의 get_histoty_reverse()에서 제공하고 있으며 관련 내용은 아래의 링크입니다.

파이썬 beem에서 블러트 계정 트랜잭션 이력 조회

여기서는 특정 범위의 이력을 오래된 것부터 순차적으로 - 즉, 시간 순서대로 - 조회하는 방법을 정리합니다. Account 객체의 history() 함수를 사용합니다. 아래의 예시는 스팀에서 @joviansummer의 첫번째 트랜잭션부터 5번째 트랜잭션까지를 조회하는 코드입니다.

from beem import Steem
from beem.account import Account

steem_node = ["https://api.steemit.com"]
steem = Steem(node=steem_node)

account = Account('joviansummer', blockchain_instance=steem)

history_data = account.history(start=1, stop=5, use_block_num=False)
for record in history_data:
  print(record)

history()에서 use_block_num=False로 지정하면 시작번호(start)와 끝번호(stop)가 블럭 번호가 아니라 해당 계정의 이력 순서로 인식합니다. 트랜잭션 정보는 딕셔너리(dict) 형식이며, 출력 예시는 아래와 같습니다.

{'delegator': 'steem', 'delegatee': 'joviansummer', 'vesting_shares': {'amount': '30300000000', 'precision': 6, 'nai': '@@000000037'}, 'trx_id': '6f0bf219ed18a3efeecd10428173339be5e37523', 'block': 52497767, 'trx_in_block': 8, 'op_in_trx': 0, 'virtual_op': 0, 'timestamp': '2021-04-01T03:07:51', 'account': 'joviansummer', 'type': 'delegate_vesting_shares', '_id': 'e691f2bc608cb4a64c3302c1502d269b9f189356', 'index': 1}

history()의 인자에 raw_output=True로 지정하면 좀 더 많은 정보를 볼 수 있습니다.

history_data = account.history(start=1, stop=5, use_block_num=False, raw_output=True)
for record in history_data:
  print(record)

위와 같이 할 경우, 트랜잭션 정보는 리스트(list)이며, 첫번째 예시보다 좀 더 많은 정보를 볼 수 있습니다. 출력 예시는 아래와 같습니다.

[1, {'trx_id': '6f0bf219ed18a3efeecd10428173339be5e37523', 'block': 52497767, 'trx_in_block': 8, 'op_in_trx': 0, 'virtual_op': 0, 'timestamp': '2021-04-01T03:07:51', 'op': {'type': 'delegate_vesting_shares_operation', 'value': {'delegator': 'steem', 'delegatee': 'joviansummer', 'vesting_shares': {'amount': '30300000000', 'precision': 6, 'nai': '@@000000037'}}}}]

계정의 이력을 처음부터 끝까지 다 조회하려면 virtual_op_count() 함수를 이용해서 현재까지 몇개의 트랜잭션이 있었는지 먼저 파악합니다. virtual_op_count() 관련 내용은 아래의 링크입니다.

파이썬 beem에서 계정의 트랜잭션 개수 파악

history() 함수는 아래와 같이 될 것입니다.

max_ops = account.virtual_op_acount()
history_data = account.history(start=1, stop=max_ops, use_block_num=False)

만약 가장 최근 10개의 트랜잭션을 시간 순서대로 가져오려면 아래와 같이 할 수 있겠습니다.

history_data = account.history(start=max_ops-9, stop=max_ops, use_block_num=False)

@joviansummer의 스팀 프로젝트

스팀 증인노드를 운영중입니다. @jswit에 증인투표해 주시면 감사하겠습니다.
(https://steemitwallet.com/~witnesses)

jswit 증인 노드 프로젝트를 시작합니다.

jsup 업보팅(upvoting) 서비스 소개

jsup 수혜자 지정 기능 추가

jSTEEM 프로젝트 - 텔레그램 챗봇으로 구현하는 스팀 블럭체인 탐색기

STEEM.NFT - 디지털 아트 보존 프로젝트

Comments

Popular posts from this blog

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

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

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