I hit a wall trying to use Hive Engine’s built-in swap flow after PEK was already live. So I rolled up my sleeves and built a lightweight, custodial bridge to get PEK moving between Hive Engine → Polygon. It’s intentionally simple, rate-limited by my on-hand liquidity, and designed to be audited at a glance. This is a rough draft — but it works.
Repo: https://github.com/PaulMoon410/hiveengine_polygon
Polygon token (custom token for wallets):
peakecoin.matic and put your Polygon address as the memo (must look like 0x... and be exactly 42 characters).A Python script polls Hive Engine’s history to find incoming PEK transfers to peakecoin.matic. It writes each valid transfer to a JSONL log for the distributor to pick up. It also includes simple CLI helpers to check recent history or specific blocks.
pek_transactions.jsonl with deduping.latest shows the latest block; blocks dumps a range for debugging.A second Python script watches pek_transactions.jsonl, validates each entry, and if the memo is a valid Polygon address, sends an ERC-20 transfer from the bridge wallet to that address. Amounts are converted to 18 decimals (× 1e18) to match the PEK ERC-20. Confirmed txids are recorded to a processed set (pol_dist_processed.txt) so nothing gets double-paid.
polygon_private_key.txt, and signs/sends raw transactions.A short launcher spins up two threads: one for the monitor and one for the distributor, prefixing the output so you can tail both in one terminal.
Requirements: Python 3.10+, install web3 and requests. Keep your Polygon key safe.
Clone:
$ git clone https://github.com/PaulMoon410/hiveengine_polygon
$ cd hiveengine_polygon
(Optional) Virtualenv:
$ python -m venv .venv
$ source .venv/bin/activate (Windows: .venv\Scripts\activate)
Install deps:
$ pip install -r requirements.txt
(or: $ pip install web3 requests)
Provide your Polygon private key:
$ echo "YOUR_PRIVATE_KEY" > polygon_private_key.txt
$ chmod 600 polygon_private_key.txt
Launch both services (monitor + distributor):
$ python pek_pol.py
Run separately if you prefer:
Note: Amount handling uses 18 decimals: quantity × 1e18.
In your Hive wallet, transfer PEK to peakecoin.matic.
In MetaMask (Polygon) or a compatible wallet, Add Token:
Wait for the bot to detect your transfer and send the matching PEK (ERC-20). The script waits for confirmation before marking your Hive tx as processed.
Note: Liquidity is limited while testing to throttle abuse and ensure stability. Large transfers may not clear until there’s enough on the Polygon side.
monitor_peakecoin.py → polls history, filters symbol/op, logs JSONL.pol_dist.py → validates, converts amount to 18 decimals, sends ERC-20 transfer, persists processed txids.pek_pol.py → launches both with prefixed output for easy ops.pol_dist_processed.txt. If a Polygon tx fails, it isn’t marked processed and can be retried.polygon_private_key.txt. Lock this file down (0600). Consider env-vars or a keystore in the next revision.Better Safety:
Swap UX:
Reverse Direction (Polygon → Hive):
Trust Minimization:
Q: Why memo=address?
A: It makes the user’s intent explicit and keeps parsing trivial. The distributor only pays if the memo looks like a proper 0x address.
Q: Decimals on Polygon?
A: ERC-20 uses 18 decimals; quantities are multiplied by 1e18 before sending.
Q: Can I use Atomic Wallet?
A: If your wallet supports Polygon custom tokens, you can track PEK by adding the contract above. MetaMask on Polygon definitely works.
Q: What happens if my Polygon tx fails?
A: The script waits for a receipt; if it’s not successful, that Hive txid isn’t marked processed, so it can be retried later.
This is a pragmatic bridge to unblock movement while we design something more robust. If you test it, start small, double-check the memo address, and share any edge cases you hit. I’ll keep improving the code and liquidity as we go.