[Steemit] 스팀잇 보상받기 자동화 하기

in #busy6 years ago (edited)

안녕하세요. @anpigon입니다.

매번 스팀잇 지갑에 들어가서 보상을 받는 것이 귀찮아서 만들었습니다.

이 포스팅에서는 보상을 자동으로 받는 봇을 구현합니다. 그리고 안드로이드폰에서 봇을 실행 할 수 있는 방법을 설명합니다. 놀고 있는 안드로이드를 재활용해도 좋습니다.


안드로이드 마켓에서 도리앱 설치

도리앱(Dory)은 안드로이드에서 Node.js로 구현된 코드를 실행할 수 있는 앱입니다. 구글 마켓에서 Dory - node.js을 찾아 설치합니다.

https://play.google.com/store/apps/details?id=io.tempage.dorynode

설치가 완료되면 도리앱을 실행하고 Add New Temfile 버튼을 선택합니다. 그럼 아래와 같이 console.log('Hello World');가 입력되어 있는 검은 화면이 보입니다. 입력되어 있는 내용은 모두 지웁니다.


npm 모듈 설치

필요한 모듈을 설치합니다. 오른쪽 상단 메뉴에서 npm install -g를 선택합니다. 그리고 steemnode-cron를 각각 입력하여 설치합니다.

}


에디터에 아래 코드를 복사&붙여넣기 합니다. 그리고 save버튼을 눌러 저장합니다.

코드 내용(복사&붙여넣기)
const steem = require('steem');
const cron = require('node-cron');

const username = process.env.username;
const wif = process.env.wif;

function reward() {
  steem.api.getAccountsAsync([username]).then(function([account]) {
    const { name, reward_vesting_steem, reward_sbd_balance, reward_vesting_balance } = account;
    console.log(`Pending Rewards: ${reward_vesting_steem} / ${reward_sbd_balance} / ${reward_vesting_balance}`);
    if(reward_vesting_balance !== "0.000000 VESTS") {
      steem.broadcast.claimRewardBalanceAsync(wif, name, '0.000 STEEM', '0.000 SBD', reward_vesting_balance).then(function() {
        console.log("Rewards Claimed!");
      });
    }
  });
}

// 1시간마다 실행
cron.schedule('0 */1 * * *', reward);


뒤로가기 버튼을 눌러 이전 화면으로 이동합니다. 그리고 Setting버튼을 눌러 설정화면으로 이동합니다. 설정 화면의 하단의 environment1과 environment2에 각각 username 사용자아이디wif 포스팅키를 입력합니다. 그리고 부팅될때 봇이 자동으로 실행되도록 하고 싶으면 start on boot를 on합니다.


START 버튼을 누르면 cron에 설정한 시간마다 실행됩니다. STD OUT버튼을 누르면 아래와 같이 실행 로그를 확인 할 수 있습니다.


node-cron 추가 설명

코드 맨 아래에 있는 cron.schedule함수의 입력값* * * * *은 봇이 실행되는 시간을 설정함니다. 각 입력값은 순서대로 분, 시간, 일, 월, 요일을 의미합니다.


만약 매일 아침 7시에 동작하고 싶다. 하면 아래와 같이 입력합니다.

  • 0 7 * * * : 매일 7시 0분에 실행.


몇 가지 예제를 더 나열 하겠습니다.

  • 5 * * * * : 매 시간 5분에 실행.

  • 0 5 1 * *: 매달 1일 새벽 5시에 실행.

  • */5 * * * * : 5분 마다 실행.

  • 0 */3 * * * : 3시간에 한 번씩 실행.

  • 0 7,21 * * * : 새벽 5시와 21시에 실행.


cronjob에 대해 더 자세히 알고 싶으면 인터넷에서 찾아보시기 바랍니다.

위 방법을 사용하면 필요한 자동화봇을 만들어 안드로이드폰에서 동작시킬 수 있습니다.


여기까지 읽어주셔셔 감사합니다.

Sort:  

좋은기능입니다! 파이팅

마이님 감사합니다~😃

헐 신기하네요
저는 아이폰이라서 일단 못하네요

댓글과 보팅 감사합니다. 아이폰은 이 방법을 사용할 수가 없어 아쉽습니다.😔

Congratulations @anpigon! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @anpigon! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the number of comments

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

이런 피가되고 살이 되는 정보 감사합니다
팔로합니다

피가 되고 살이 되는 정보는 공유되어야합니다.😁

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65762.16
ETH 3485.95
USDT 1.00
SBD 2.50