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을 이용한 팔로우/언팔로우 (custom json 예시)

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/beem-custom-json


파이썬 beem을 이용해서 특정 계정을 팔로우(follow)하거나 언팔로우(unfollow)하는 방법입니다. 포스팅키를 필요로 하며, custom json 오퍼레이션을 통해서 이루어집니다.

예를 들어 @joviansummer가 @jswit 계정을 팔로우한다면 아래와 같이 코드를 작성할 수 있습니다. 스팀 기준이며, 하이브나 블러트에서도 Steem 클래스 대신 Hive 또는 Blurt 클래스를 사용하면 동일하게 작업 가능할 것입니다.

import json
import beem
from beem import Steem
from beem.account import Account
from beem.transactionbuilder import TransactionBuilder
from beembase.operations import Custom_json

node_list = ["https://api.steemit.com"]

steem_id = 'joviansummer'
posting_key = '5XXXXX...'

target_id = 'jswit'

steem = Steem(node=node_list)
account = Account(steem_id, blockchain_instance=steem)

# 이미 팔로우하고 있는지 확인
following = account.get_following()
if len(following) > 0 and target_id in following:
  print(target_id, ": 이미 팔로우하고 있습니다.")
  exit()
else:
  print(target_id, ": 팔로우하겠습니다.")

tx = TransactionBuilder(blockchain_instance=steem)
tx.appendOps(Custom_json(**{
  'required_auths': [],
  'required_posting_auths': [steem_id],
  'id': 'follow',
  'json': json.dumps(['follow', {
    'follower': steem_id,
    'following': target_id,
    'what': ['blog']
    }])
  }))
tx.appendWif(posting_key)
signed_tx = tx.sign()
broadcast_tx = tx.broadcast(trx_id=True)

만약 반대로 언팔로우를 한다면, 아래와 같이 변경됩니다. tx.appendOps()에 들어가는 Custom_json() 함수의 인자 구성에서 "what" 부분이 빈 리스트([])가 됩니다. 위의 팔로우하는 코드에서는 이 부분이 ['blog']였습니다.

# 팔로우하고 있는지 확인
following = account.get_following()
if len(following) > 0 and target_id in following:
  print(target_id, ": 언팔로우하겠습니다.")
else:
  print(target_id, ": 팔로우하고 있지 않습니다.")
  exit()

tx = TransactionBuilder(blockchain_instance=steem)
tx.appendOps(Custom_json(**{
  'required_auths': [],
  'required_posting_auths': [steem_id],
  'id': 'follow',
  'json': json.dumps(['follow', {
    'follower': steem_id,
    'following': target_id,
    'what': []
    }])
  }))
tx.appendWif(posting_key)
signed_tx = tx.sign()
broadcast_tx = tx.broadcast(trx_id=True)

Account 클래스에서 follow(), unfollow() 함수를 제공하기 때문에 이것을 사용하면 더 간단할 것 같긴 합니다만, custom json 사용 예시를 기록해 두는 것이 좋을 것 같아서 좀 복잡하지만 일단은 위의 코드를 기록해 둡니다.


@joviansummer의 스팀 프로젝트

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

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

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

jsup 수혜자 지정 기능 추가

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

Comments

Popular posts from this blog

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

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

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