create account

Selenium/Hive-Nectar Turning Ecency Points into PeakePoints by paulmoon410

View this thread on: hive.blogpeakd.comecency.com
· @paulmoon410 ·
$4.88
Selenium/Hive-Nectar Turning Ecency Points into PeakePoints
<center>![](https://images.ecency.com/DQmWW3LQLHrdW16ZpCVZidXgDCRo3CrbatPXueDSrhD9qkd/image.png)
</center>


Well, well... I had a little chat with @enginewitty about a few things that would make Hive as a whole a little more cohesive. So again I'm onto @thecrazygm and the Hive-Nectar (@nectarflower) API over the older BEEM API, which is great by the way and works just the same, it's just a little dated. I do however use Beem API on an older PC that I have difficulties upgrading Python to 3.12 on...fuckin' Raspberry Pi's "I tell ya what..."

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



My whole concept was that I'm an active @Ecency user, and if you're not familiar with it, you get points for utilizing the platform, which is super neat. Those are, however, only used on the Ecency Platform. So my thoughts were, what do we do to be able to make those things an actual asset for Hive's chain? I'm literally sitting here coding a headless interface that allows users to transfer Ecency Points for @PeakeCoin as well as the reverse. 

I am using an alt account of @Peakecoin.bnb that I use for most coding inquiries as to not shall we say "screw the pooch"... I hope that's not your thing. I have not yet put this code into use. I am trying to secure a free server for some of this stuff, and I believe I have found one, so we'll see how that goes after I get it up and running. 

    import time
    import csv
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    from selenium.webdriver.common.by import By
    from selenium.webdriver.chrome.service import Service
    from nectar.hive import Hive
    from nectar.account import Account
    from nectar.transactionbuilder import TransactionBuilder
    from nectarbase.operations import Custom_json

    # ---- CONFIG ---- #

    HIVE_NODES = ["https://api.hive.blog", "https://anyx.io"]
    HIVE_ACCOUNT = "peakecoin.bnb"
    ACTIVE_KEY = "your_active_key_here"  # <-- INSERT YOUR ACTIVE KEY HERE
    PEK_TOKEN = "PEK"
    SWAP_RATE = 0.001

    ECENCY_POINTS_URL = "https://ecency.com/@peakecoin.bnb/points"
    CHECK_INTERVAL = 60  # seconds between page checks

    # ---- SETUP ---- #

    # Setup Hive connection
    hive = Hive(node=HIVE_NODES, keys=[ACTIVE_KEY])
    account = Account(HIVE_ACCOUNT, blockchain_instance=hive)

    # Setup Headless Chromium on Raspberry Pi
    chrome_options = Options()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-gpu")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--window-size=1920x1080")

    chromedriver_path = "/usr/lib/chromium-browser/chromedriver"
    driver = webdriver.Chrome(service=Service(chromedriver_path), 
    options=chrome_options)

    # Ensure swap log exists
    LOG_FILE = "swap_log.csv"
    try:
        with open(LOG_FILE, "x", newline="") as f:
        writer = csv.writer(f)
        writer.writerow(["timestamp", "username", "points", "pek_sent"])
    except FileExistsError:
         pass  # File already exists

    # Load processed usernames to avoid double swaps
    processed = set()
    with open(LOG_FILE, newline="") as f:
    reader = csv.reader(f)
    next(reader, None)  # skip header
    for row in reader:
        if len(row) > 1:
            processed.add(row[1])

    # ---- FUNCTIONS ---- #

    def send_pek(to_account, points_amount):
    pek_amount = points_amount * SWAP_RATE
    payload = {
        "contractName": "tokens",
        "contractAction": "transfer",
        "contractPayload": {
            "symbol": PEK_TOKEN,
            "to": to_account,
            "quantity": str(round(pek_amount, 8)),
            "memo": "Ecency Points Swap"
        }
    }

    tx = TransactionBuilder(blockchain_instance=hive)
    op = Custom_json(
        required_auths=[HIVE_ACCOUNT],
        required_posting_auths=[],
        id="ssc-mainnet-hive",
        json=payload
    )
    tx.appendOps(op)
    tx.appendSigner(HIVE_ACCOUNT, "active")
    tx.sign()
    tx.broadcast()

    print(f"✅ Sent {pek_amount} {PEK_TOKEN} to {to_account}")
    return pek_amount

    def monitor_swaps():
    print("🚀 Starting Ecency Points Swap Bot...")
    while True:
        try:
            driver.get(ECENCY_POINTS_URL)
            time.sleep(5)  # let the page load

            notifications = driver.find_elements(By.CLASS_NAME, "items-center")

            for note in notifications:
                text = note.text.lower()
                if "points" in text and "peakecoin transfer" in text:
                    # Extract username and points
                    try:
                        parts = text.split(" ")
                        from_index = parts.index("from")
                        username = parts[from_index + 1].lstrip("@").strip()
                        points = int([p for p in parts if p.isdigit()][0])

                        if username not in processed:
                            print(f"🔍 Swap found: {username} sent {points} Points")
                            pek_sent = send_pek(username, points)

                            with open(LOG_FILE, "a", newline="") as f:
                                writer = csv.writer(f)
                                writer.writerow([time.strftime("%Y-%m-%d %H:%M:%S"), username, points, pek_sent])

                            processed.add(username)

                    except Exception as e:
                        print(f"⚠️ Error parsing notification: {e}")

        except Exception as e:
            print(f"❌ Error during page check: {e}")

        time.sleep(CHECK_INTERVAL)

    # ---- RUN ---- #

    if __name__ == "__main__":
    monitor_swaps()



I'm not overly familiar with how a headless Chromium and Selenium's API will work if at all. This is the closest I have gotten, and it seems like it should logically work. As always, I'm looking for critiques. 

 I appreciate all views, votes, shares, and forks of the code. 
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 85 others
properties (23)
authorpaulmoon410
permlinkselenium-hive-nectar-turning-ecency
categoryhive-167922
json_metadata"{"app":"ecency/4.0.3-vision","tags":["hive-167922","pimp","neoxian","palnet","waivio","proofofbrain","leo","ctp","creativecoin","bee","ecency"],"format":"markdown+html","image":["https://images.ecency.com/DQmWW3LQLHrdW16ZpCVZidXgDCRo3CrbatPXueDSrhD9qkd/image.png","https://images.ecency.com/DQmUBAL99HHJdyGVdsNqkHADeHdHKAAQebsPYo5cLDr3Ee9/image.png"],"thumbnails":["https://images.ecency.com/DQmWW3LQLHrdW16ZpCVZidXgDCRo3CrbatPXueDSrhD9qkd/image.png"],"description":"So again I'm onto @thecrazygm and the Hive-Nectar (@nectarflower) API over the older BEEM API, which is great by the way and works just the same, it's just a little dated. I do however use Beem API on","image_ratios":["0.9600","1.0000"]}"
created2025-04-29 23:59:06
last_update2025-04-29 23:59:06
depth0
children8
last_payout2025-05-06 23:59:06
cashout_time1969-12-31 23:59:59
total_payout_value2.414 HBD
curator_payout_value2.469 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,036
author_reputation40,583,385,514,311
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries
0.
accountpeakecoin
weight100
1.
accountpeakecoin.bnb
weight100
2.
accountpeakecoin.matic
weight100
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id142,406,158
net_rshares14,785,866,107,619
author_curate_reward""
vote details (149)
@cwow2 ·
$0.19
Hmm. What do you want to do with the Peakecoin compared to Ecency Points?  

!pakx
👍  , , , , , , , ,
👎  
properties (23)
authorcwow2
permlinkre-paulmoon410-sviijr
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2025.4.6","image":[],"users":[]}
created2025-04-30 03:47:51
last_update2025-04-30 03:47:51
depth1
children1
last_payout2025-05-07 03:47:51
cashout_time1969-12-31 23:59:59
total_payout_value0.096 HBD
curator_payout_value0.095 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length82
author_reputation208,690,518,984,185
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,408,909
net_rshares571,311,458,130
author_curate_reward""
vote details (10)
@paulmoon410 ·
Can you be more concise?
👍  
👎  
properties (23)
authorpaulmoon410
permlinkre-cwow2-2025430t53046474z
categoryhive-167922
json_metadata{"type":"comment","tags":["hive-167922"],"app":"ecency/3.3.2-mobile","format":"markdown+html"}
created2025-04-30 09:30:48
last_update2025-04-30 09:30:48
depth2
children0
last_payout2025-05-07 09:30: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_length24
author_reputation40,583,385,514,311
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,413,013
net_rshares28,848,206,562
author_curate_reward""
vote details (2)
@ecoinstant ·
$0.02
Honestly, tokenizing a broker-coin for ecency points is an amazing idea!!!  Talk about utility, these can be used for HP delegations!

In terms of tokenomics, are you going to take like a 1% fee / "value rake" on these in and outs?  Free work doesnt work, long term - it never does.
👍  , , , ,
properties (23)
authorecoinstant
permlinkre-paulmoon410-svif6k
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2025.4.6","image":[],"users":[]}
created2025-04-30 02:35:09
last_update2025-04-30 02:35:09
depth1
children1
last_payout2025-05-07 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length282
author_reputation847,614,012,647,141
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,408,148
net_rshares77,710,629,275
author_curate_reward""
vote details (5)
@paulmoon410 ·
$0.11
I really haven't even gotten there yet. I have only debugged the code, I've yet to implement it. A fee would probably be charged, something that can't be built and maintained for free. It's just like you say, anything can be done for free... but it's going to maintain a lower quality effort.
👍  , , , , , ,
properties (23)
authorpaulmoon410
permlinkre-ecoinstant-2025429t22436876z
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"ecency/4.0.3-vision","format":"markdown+html"}
created2025-04-30 02:43:06
last_update2025-04-30 02:43:06
depth2
children0
last_payout2025-05-07 02:43:06
cashout_time1969-12-31 23:59:59
total_payout_value0.056 HBD
curator_payout_value0.055 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length292
author_reputation40,583,385,514,311
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,408,234
net_rshares334,942,581,388
author_curate_reward""
vote details (7)
@thecrazygm ·
$0.19
What version of python is on the raspberry pi? I only set it to 3.12 as that is the standard stable version of python at the moment, but I do not believe it's making use of anything specific to the later versions. I could drop the requirement version if you think that's the only thing stopping it from working right, I do think even 3.10 is still considered "in play" as in not depreciated.
👍  , , , , , , , ,
properties (23)
authorthecrazygm
permlinkre-paulmoon410-svivf2
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2025.4.6","image":[],"users":[]}
created2025-04-30 08:25:51
last_update2025-04-30 08:25:51
depth1
children3
last_payout2025-05-07 08:25:51
cashout_time1969-12-31 23:59:59
total_payout_value0.094 HBD
curator_payout_value0.094 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length391
author_reputation88,578,967,128,712
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,412,281
net_rshares575,052,466,207
author_curate_reward""
vote details (9)
@paulmoon410 ·
$0.20
I have an older Pi that doesn't like it. The Pis operate on 3.10 basically.
👍  , , , , , , ,
👎  
properties (23)
authorpaulmoon410
permlinkre-thecrazygm-2025430t5291610z
categoryhive-167922
json_metadata{"type":"comment","tags":["hive-167922"],"app":"ecency/3.3.2-mobile","format":"markdown+html"}
created2025-04-30 09:29:03
last_update2025-04-30 09:29:03
depth2
children2
last_payout2025-05-07 09:29:03
cashout_time1969-12-31 23:59:59
total_payout_value0.101 HBD
curator_payout_value0.100 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length75
author_reputation40,583,385,514,311
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,412,992
net_rshares609,541,915,933
author_curate_reward""
vote details (9)
@thecrazygm ·
$0.20
I'll bump the requirements down to 3.10 for version 0.0.7 (which should be in the next day or so, as soon as i'm done bug testing) so you should be able to use it on the pi after that.
👍  , , , , , , , ,
properties (23)
authorthecrazygm
permlinkre-paulmoon410-svj1vc
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2025.4.6","image":[],"users":[]}
created2025-04-30 10:45:15
last_update2025-04-30 10:45:15
depth3
children1
last_payout2025-05-07 10:45:15
cashout_time1969-12-31 23:59:59
total_payout_value0.100 HBD
curator_payout_value0.098 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length184
author_reputation88,578,967,128,712
root_title"Selenium/Hive-Nectar Turning Ecency Points into PeakePoints"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,413,827
net_rshares598,075,538,123
author_curate_reward""
vote details (9)