[ENG] STEEM Security update - added power down alert

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/eng-steem-security-update-added-power-down-alert STEEM Security - receive STEEM alert messages via Discord Hello, this is @joviansummer(witness: @jswit). STEEM Security code has been revised. Previously, STEEM Security was sending alert message via discord for the following 3 kinds of operations: sending STEEM/SBD to another account changing SP delegation account update Now, power down operation has been added. If there is a power down operation, you will also receive alert message. Please check the original post of the above link for detailed information on how to use the service. Thank you for reading, and have a wonderful day! @joviansummer's STEEM projects @jswit witness: I'm running a STEEM witness node. I'd really appreciate it if you vote for my witness account @jswit. ( https://steemitwallet.com/~witnesses ) [ENG] Introducing @jswit witness project @jsup curation: [ENG] Int...

파이썬 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

[ENG] jsup 2.0 - make your upvote great again

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

Nuitka - 파이썬 스크립트를 바이너리 실행 파일로 변환