create account

Pimp/PeakeCoin Trailing Bot by paulmoon410

View this thread on: hive.blogpeakd.comecency.com
· @paulmoon410 ·
$0.78
Pimp/PeakeCoin Trailing Bot
 I was brainstorming something ferocious and trying to figure out how to help the platforms.... I came up with this and attempting to link the currencies on Hive Engine that actually have solid backing. This is just the first draft of the PeakeCoin trailing bot. I may add other currencies to it as well, I'm just not sure how resource credit-heavy this would actually be. With this being the rough draft we'll see. 

  Since I created @PeakeCoin, I have never made it staking, so you can earn more. I have always had the issue of some rough distribution to facilitate usage. So, what I started working on was a PeakeCoin following bot. So it's one that follows @pimp.token earnings and gives them a super small percentage of PEK.

<center>![](https://images.ecency.com/DQmVEHJURcMtAhvGSXfHkXcnGTdhgupenEoh5T2FpE92W7o/image.png)</center>

I've been trying to get @enginewitty up to speed with all this coding stuff I'm working on, and hopefully this may expedite him to hop on this train, lol. 

I worked on this on Sunday evening. I'm sorry, but I was working on the Sabbath.

If you want, you can definitely read over this, implement it, or improve it, just let me know because any help can be the greatest of help.



```

import requests
import time
import os
from nectar import Hive 

hive = Hive()

def send_pek(username, amount):
    # Replace these with your Hive account and private active key
    HIVE_ACCOUNT = "your_hive_account"
    ACTIVE_KEY = "your_private_active_key"  # NEVER share or hardcode in public code!

    # Prepare the custom_json payload for Hive Engine token transfer
    json_data = [
        "transfer",
        {
            "symbol": "PEK",
            "to": username,
            "quantity": f"{amount:.8f}",
            "memo": "PIMP reward"
        }
    ]
    try:
        tx = hive.broadcast_custom_json(
            username=HIVE_ACCOUNT,
            key=ACTIVE_KEY,
            id="ssc-mainnet-hive",
            json_data=json_data,
            required_posting_auths=[],
            required_active_auths=[HIVE_ACCOUNT]
        )
        print(f"Sent {amount} PEK to {username}. TX: {tx}")
    except Exception as e:
        print(f"Failed to send PEK to {username}: {e}")

REWARDED_TXIDS_FILE = "rewarded_txids.txt"

def load_rewarded_txids():
    if not os.path.exists(REWARDED_TXIDS_FILE):
        return set()
    with open(REWARDED_TXIDS_FILE, "r") as f:
        return set(line.strip() for line in f if line.strip())

def save_rewarded_txid(txid):
    with open(REWARDED_TXIDS_FILE, "a") as f:
        f.write(txid + "\n")

def main():
    rewarded_txids = load_rewarded_txids()
    while True:
        try:
            payload = {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "find",
                "params": {
                    "contract": "tokens",
                    "table": "transfers",
                    "query": {"symbol": "PIMP"},
                    "limit": 100,
                    "sort": "desc"
                }
            }
            r = requests.post("https://api.hive-engine.com/rpc/contracts", json=payload, timeout=10)
            data = r.json()
            for t in data.get("result", []):
                txid = t.get("transactionId")
                to_user = t.get("to")
                pimp_amt = float(t.get("quantity", 0))
                # Integer division: every 100 PIMP, reward 0.00000001 PEK
                pek_amt = int(pimp_amt // 100) * 0.00000001
                if pek_amt > 0 and txid not in rewarded_txids:
                    send_pek(to_user, pek_amt)
                    rewarded_txids.add(txid)
                    save_rewarded_txid(txid)
        except Exception as e:
            print(f"Error: {e}")
        time.sleep(60)  # Run every minute

if __name__ == "__main__":
    main()


```

Appreciate all the looking around... big shout out to @ecoinstant for the helping hands of putting people together to improve the community.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 37 others
properties (23)
authorpaulmoon410
permlinkpimp-peakecoin-trailing-bot
categoryhive-111011
json_metadata"{"app":"ecency/4.0.4-vision","tags":["hive-111011","leo","leofinance","creativecoin","palnet","archon","proofofbrain","bee","peakecoin","ctp","ecency"],"format":"markdown+html","image":["https://images.ecency.com/DQmVEHJURcMtAhvGSXfHkXcnGTdhgupenEoh5T2FpE92W7o/image.png"],"thumbnails":["https://images.ecency.com/DQmVEHJURcMtAhvGSXfHkXcnGTdhgupenEoh5T2FpE92W7o/image.png"],"description":"I was brainstorming something ferocious and trying to figure out how to help the platforms.... I came up with this and attempting to link the currencies on Hive Engine that actually have solid backing.","image_ratios":["1.0000"]}"
created2025-05-19 02:48:24
last_update2025-05-19 02:48:24
depth0
children3
last_payout2025-05-26 02:48:24
cashout_time1969-12-31 23:59:59
total_payout_value0.353 HBD
curator_payout_value0.427 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,976
author_reputation40,455,560,339,093
root_title"Pimp/PeakeCoin Trailing Bot"
beneficiaries
0.
accountpeakecoin
weight1,000
1.
accountstrangedad
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id142,819,450
net_rshares2,446,305,365,210
author_curate_reward""
vote details (101)
@enginewitty ·
Woop Woop! School is winding down and I can put more focus on Hive things here soon. If you can make it, should come to the !pimp chats Wednesday morning 9am EST.
👍  ,
properties (23)
authorenginewitty
permlinkre-paulmoon410-swl1up
categoryhive-111011
json_metadata{"tags":["hive-111011"],"app":"peakd/2025.5.6","image":[],"users":[]}
created2025-05-20 23:13:39
last_update2025-05-20 23:13:39
depth1
children2
last_payout2025-05-27 23:13:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length162
author_reputation693,845,252,695,147
root_title"Pimp/PeakeCoin Trailing Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,859,235
net_rshares33,419,012,561
author_curate_reward""
vote details (2)
@paulmoon410 ·
I'm full time employed. Unless someone here can pay my salary? I'd be glad to quit working. I would love to join the conversation.

No rush my guy. I get it. I just need money....lol, kids are expensive.
properties (22)
authorpaulmoon410
permlinkre-enginewitty-2025520t194142642z
categoryhive-111011
json_metadata{"type":"comment","tags":["hive-111011"],"app":"ecency/3.3.2-mobile","format":"markdown+html"}
created2025-05-20 23:41:42
last_update2025-05-20 23:41:42
depth2
children0
last_payout2025-05-27 23:41:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length203
author_reputation40,455,560,339,093
root_title"Pimp/PeakeCoin Trailing Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,859,584
net_rshares0
@tokenpimp ·
Test !PAKX
properties (22)
authortokenpimp
permlinkre-enginewitty-swm7iw
categoryhive-111011
json_metadata{"tags":["hive-111011"],"app":"peakd/2025.5.6","image":[],"users":[]}
created2025-05-21 14:13:48
last_update2025-05-21 14:13:48
depth2
children0
last_payout2025-05-28 14:13:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation16,079,424,016,430
root_title"Pimp/PeakeCoin Trailing Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,878,596
net_rshares0