📰 Fed News
- Loading news...
DEWALT DCF850
20V Brushless Impact Driver
฿1,887
คลิกเพื่อดูข้อเสนอ!
ราคาทองคำ (PAXG)
สะท้อนตลาดโลกเลือกเหรียญ Binance
โพสต์ล่าสุด
@puk
30 Sep 2025 15:18การปรับเปลี่ยนและเพิ่มฟีเจอร์ใหม่ ๆ เข้าไปในโค้ดเกม Card Battle RPG ของคุณอย่างครอบคลุม ดังนี้: สรุปการปรับเปลี่ยนหลัก (Major Changes) ระบบหลัก รายละเอียดการปรับปรุง โครงสร้างข้อมูล รวม free_cards เข้าไปใน inventory อย่างถาวร เพื่อลดความซ้ำซ้อนในการจัดการการ์ด ระบบ HP รวม เปลี่ยนระบบต่อสู้ให้เป็นการ์ดต่อการ์ด (Card vs Card) แต่มี Player HP และ Enemy HP รวมของทั้งทีม เมื่อการ์ดถูกกำจัด HP รวม ของฝั่งนั้นจะลดลงตามค่า HP ที่เหลือของการ์ดที่ถูกทำลาย (Overflow Damage) ทำให้การกำจัดเป็นเป้าหมายสำคัญกว่าแค่การลด HP การสเกลความยาก ปรับสูตรการสเกลความแข็งแกร่งของศัตรูให้สูงขึ้นอย่างชัดเจน (+30% ต่อระดับ) เพื่อให้เกมมีความท้าทายมากขึ้นในทุก ๆ รอบ (Scale Factor=1+(Battle Count×0.30)) UI/UX ปรับปรุงการแสดงผล HP Bar, Text, และเพิ่มพื้นหลังภาพ (ถ้ามีไฟล์) เพื่อให้ดูทันสมัยและน่าสนใจยิ่งขึ้น การจัดการเสียง เพิ่มฟังก์ชันการเล่น Background Music (BGM) สำหรับแต่ละหน้าจอ (Title, Battle, Shop, Deck Select) และเพิ่ม Sound Effects (SFX) สำหรับ Gacha, Attack, Heal, Victory, และ Defeat ส่งออกไปยังชีต การเพิ่มฟีเจอร์เชิงลึก (In-Depth Features Added) 1. ระบบ Card Abilities และ Status Effects การ์ดบางใบจะมีการติดตั้งความสามารถพิเศษ (Ability) ที่จะทำงานก่อนการโจมตี (ยกเว้น Heal ที่ทำงานกับตัวเอง) และสามารถใช้ได้ทุกเทิร์น: Ability Effect Status Effect ที่เกี่ยวข้อง Heal ฟื้นฟู HP ให้ตัวเอง 25% ของ Max HP N/A Block ได้รับสถานะ Block: ลดความเสียหายที่จะได้รับในเทิร์นหน้าลง 50% block_active Poison ใส่สถานะ Poison Stack ให้การ์ดศัตรู poison_stacks (ทำ Damage Over Time - DoT) Stun ใส่สถานะ Stun ให้การ์ดศัตรู is_stunned (ไม่สามารถโจมตีได้ในเทิร์นหน้า) Crit Boost มีโอกาส 50% ที่จะเพิ่มพลังโจมตีเป็นสองเท่าสำหรับการโจมตีในเทิร์นนั้น N/A ส่งออกไปยังชีต 2. ระบบ DoT (Damage over Time) การ์ดที่มีสถานะ Poison จะได้รับความเสียหายต่อเนื่อง (Damage over Time) เท่ากับ 5% ของ Max HP ต่อ Poison Stack ในช่วงเริ่มต้นเทิร์นของตัวเอง 3. ระบบ Upgrade และ Evolution (Shop) ฟีเจอร์ รายละเอียด ค่าใช้จ่าย/เงื่อนไข Card Upgrade เพิ่มระดับการ์ด level (สูงสุด 10) และเพิ่มโบนัส power_boost และ res_boost แบบสุ่ม 10,000,000 ต่อครั้ง Card Evolution การ์ดบางใบสามารถเปลี่ยนไปเป็นการ์ด ID ใหม่ที่สูงกว่าได้ (เช่น Card ID 99 → Card ID 100) ต้องมี Level สูงสุด (10/10) และใช้เงิน 100,000,000 Gacha/Pack เพิ่มระบบ Buy Normal Pack (Common/Rare) และ Buy Special Pack (Epic/Legendary/Mythic) พร้อมระบบ Refund เมื่อได้การ์ดซ้ำ Normal: 2,000,000, Special: 10,000,000 ส่งออกไปยังชีต โหมดและหน้าจอใหม่ หน้าจอ รายละเอียด Deck Select Screen หน้าจอเฉพาะสำหรับการจัดการ Inventory และการจัด Deck (จำกัด 5 ใบ) Shop Screen หน้าจอสำหรับซื้อ Pack, อัปเกรดการ์ด (Upgrade), และพัฒนาร่างการ์ด (Evolution) Start Game Screen หน้าจอให้เลือกโหมดการเล่นระหว่าง Normal Mode (Manual) (คลิกโจมตีเอง) และ Auto Mode (ปล่อย AI เล่นจนรู้ผล) Battle Log กล่องข้อความด้านล่างสำหรับการแสดงผลการต่อสู้โดยละเอียด (การโจมตี, ความสามารถ, การใช้สถานะ)
@puk
30 Sep 2025 08:19https://github.com/githubway2us/gamecard
@puk
30 Sep 2025 06:171️⃣ Restart แบบง่าย docker compose restart botline-app จะหยุดแล้วเริ่ม container ใหม่ทันที โค้ดใหม่ใน volume หรือไฟล์ host จะถูกโหลด 2️⃣ Down + Up docker compose down docker compose up -d เหมือน restart แต่ reset network/container ทุกตัว ใช้ถ้ามีปัญหา network หรือ volume
@puk
30 Sep 2025 02:04เช็คโหนด
@puk
29 Sep 2025 03:41ตัวอย่างสคริปต์ Python (ลองรันออฟไลน์) บันทึกเป็นไฟล์ xrp_wallet_try_decrypt.py แล้วรัน (แนะนำรันใน virtualenv และติดตั้ง dependency ก่อน pip install pycryptodome) #!/usr/bin/env python3 # xrp_wallet_try_decrypt.py # Requires: pip install pycryptodome import json import base64 import binascii from getpass import getpass from Crypto.Protocol.KDF import PBKDF2 from Crypto.Cipher import AES from Crypto.Hash import SHA256, SHA512 from Crypto.Util.Padding import unpad # helper: try to decode hex or base64 def decode_blob(s): if s is None: return None s = s.strip() # try hex try: return binascii.unhexlify(s) except Exception: pass # try base64 try: return base64.b64decode(s) except Exception: pass # maybe it's raw bytes as-is return s.encode('utf-8') # derive key with PBKDF2 using hash module and iterations def derive_key(password, salt_bytes, dklen=32, iters=10000, hash_name='sha256'): if hash_name == 'sha256': return PBKDF2(password, salt_bytes, dkLen=dklen, count=iters, hmac_hash_module=SHA256) else: return PBKDF2(password, salt_bytes, dkLen=dklen, count=iters, hmac_hash_module=SHA512) # try AES-256-CBC decryption given ciphertext bytes and key def try_aes_cbc_decrypt(key, ciphertext): # require at least 16 bytes IV if len(ciphertext) <= 16: return None iv = ciphertext[:16] ct = ciphertext[16:] try: cipher = AES.new(key, AES.MODE_CBC, iv) pt = cipher.decrypt(ct) # try unpad try: pt2 = unpad(pt, AES.block_size) return pt2 except ValueError: # maybe no padding or wrong key; still return raw decrypted return pt except Exception: return None # heuristic: common iteration counts to try COMMON_ITERS = [1000, 4096, 10000, 16384, 65536] def attempt_decrypt_wallet(json_obj, password): results = [] # Some wallets store salts as hex strings, sometimes two salts (salt1, salt2) # We'll try to derive a key from salt1 (or concatenation) with sha256/sha512 and try AES-CBC candidates = [] # gather candidate encrypted blobs from known fields # look for ppsecret, rpsecret, erk, etc. accounts = json_obj.get('accounts', {}) for acct, data in accounts.items(): for field in ('ppsecret', 'rpsecret', 'secret', 'masterkey', 'ppsalt', 'rpsalt'): if field in data: candidates.append((acct, field, data[field])) # also top-level: rpdata/ppdata erk for top in ('ppdata', 'rpdata'): if top in json_obj: for k, v in json_obj[top].items(): # include salts & hashes too candidates.append((top, k, v)) # try each candidate with salts found nearby # helper to get salt bytes (try salt1, salt2, ppsalt, rpsalt) def find_salts(obj): salts = [] if isinstance(obj, dict): for k in ('salt', 'salt1', 'salt2', 'ppsalt', 'rpsalt'): if k in obj: try: salts.append(decode_blob(obj[k])) except Exception: pass return salts top_salts = find_salts(json_obj) for acct, field, blob in candidates: blob_bytes = None if isinstance(blob, str): blob_bytes = decode_blob(blob) elif isinstance(blob, dict): # if nested dict, skip continue else: continue # collect salts: account-level, top-level acct_obj = json_obj.get('accounts', {}).get(acct, {}) salts = find_salts(acct_obj) + top_salts # if no salt found, try empty salt if not salts: salts = [b''] # try derivation variants for salt_bytes in salts: for hash_name in ('sha256', 'sha512'): for iters in COMMON_ITERS: key = derive_key(password, salt_bytes, dklen=32, iters=iters, hash_name=hash_name) pt = try_aes_cbc_decrypt(key, blob_bytes) if pt: # Heuristic: if plaintext contains ascii-readable words (like "s" secret, "master", "ed25519", or starts with 's' or 32/64 bytes), # record probable success. text = None try: text = pt.decode('utf-8', errors='ignore') except Exception: text = None score = 0 if text: if 's' in text and len(text) >= 15: score += 2 if 'ed25519' in text or 'master' in text or 'secret' in text or 'xprv' in text: score += 3 results.append({ 'account_field': f'{acct}.{field}', 'hash': hash_name, 'iters': iters, 'salt_hex': binascii.hexlify(salt_bytes).decode(), 'plaintext_preview': (text[:400] if text else binascii.hexlify(pt[:64]).decode()), 'raw_plain': pt, 'score': score }) # sort by score (best first) results.sort(key=lambda r: r['score'], reverse=True) return results if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(description='Try to decrypt XRP wallet JSON fields with a password (offline tool).') parser.add_argument('walletfile', help='path to wallet .json (or paste your json string)') args = parser.parse_args() with open(args.walletfile, 'r', encoding='utf-8') as f: j = json.load(f) pwd = getpass('Enter wallet password/PIN to try (input hidden): ') out = attempt_decrypt_wallet(j, pwd) if not out: print('No plausible decryptions found. You can try other iteration counts or KDFs (scrypt) or inspect salts manually.') else: print('Possible decryptions (ordered by heuristic score):\n') for i, r in enumerate(out): print(f'#{i+1} field: {r["account_field"]} hash:{r["hash"]} iter:{r["iters"]} salt(hex):{r["salt_hex"]}') print('preview:', r['plaintext_preview']) print('---') print('\nIf you see a secret-like string (starts with "s" and ~29 chars) that is your XRP secret. Keep it safe!')
@puk
28 Sep 2025 02:10LND :: เช็ค Wallet
@puk
28 Sep 2025 01:41รอพัฒนาต่อ...เร็วๆนี้
@puk
28 Sep 2025 01:39หลังจากที่ HDD พังไป 2 ลูก ตอนนี้ด้ จัดการให้ระบบกลับมาใช้งานได้ปกติแล้ว เหลือรอ LND กลับมาออนไลน์ เพื่อพัฒนาต่อ....
@puk
28 Sep 2025 00:441️⃣ สร้าง Telegram Bot เปิด Telegram → ค้นหา BotFather พิมพ์ /newbot ตั้งชื่อ bot และ username (username ต้องลงท้ายด้วย bot) BotFather จะให้ API Token → ตัวอย่าง: 123456789:ABCDefGhIJKlmNoPQRsTUVwxyZ บันทึก token ไว้ใช้ในโค้ด 2️⃣ หา Chat ID ของคุณ เปิด Telegram → ค้นหา userinfobot หรือ @get_id_bot กดเริ่ม → bot จะส่งข้อความที่มี chat_id ของคุณ นำ chat_id นี้ไปใส่ในโค้ด 3️⃣ ติดตั้ง Python package สำหรับส่งข้อความ โค้ดของคุณใช้ requests อยู่แล้ว แต่คุณสามารถติดตั้งผ่าน pip: pip install requests requests ใช้ส่ง HTTP POST ไปยัง Telegram API 4️⃣ แก้ไข config ในโค้ด TELEGRAM_BOT_TOKEN = "123456789:ABCDefGhIJKlmNoPQRsTUVwxyZ" # จาก BotFather TELEGRAM_CHAT_ID = "987654321" # chat_id ของคุณ 5️⃣ ทดสอบส่งข้อความ สร้างไฟล์ test_telegram.py: import requests TELEGRAM_BOT_TOKEN = "123456789:ABCDefGhIJKlmNoPQRsTUVwxyZ" TELEGRAM_CHAT_ID = "987654321" message = "Hello from Python! Telegram bot works." url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage" data = {"chat_id": TELEGRAM_CHAT_ID, "text": message} r = requests.post(url, data=data) print(r.json()) ถ้า status "ok": True → แสดงว่าพร้อมใช้งาน
@puk
28 Sep 2025 00:38Flatpak: ถ้าใช้ Flatpak อยู่แล้ว สามารถติดตั้งได้: flatpak install flathub org.telegram.desktop
@puk
28 Sep 2025 00:311) Security & production hardening checklist (ให้ทำตอนรันโหนด/สคริปต์เสมอ) เก็บ RPC credentials ให้ปลอดภัย (อย่า hardcode ใน repo ที่สาธารณะ) — เก็บในไฟล์ .bitcoin/bitcoin.conf หรือ environment variables; ใช้ rpcauth ถ้าจำเป็น เปิด rpcallowip ให้แคบ (เฉพาะ localhost หรือ VPN) และบล็อกพอร์ต RPC ด้วย firewall (ufw/iptables) ใช้ bitcoin-cli cookie (cookie auth) แทนการเก็บ password ในโค้ด ถ้ารันบนเครื่องเดียวกัน รัน bitcoind ด้วย user ที่ไม่ใช่ root; ตั้ง ulimit และ resource limits ให้เหมาะสม สำรอง wallet/keystore และ bitcoin.conf เป็นประจำ (ถ้าใช้ wallet) เปิด logging ที่เหมาะสม (rotation) และเก็บ log ไว้ดูย้อนหลัง ถ้ามี remote access ให้ผูกกับ VPN / SSH port-forwarding เท่านั้น 2) Operational suggestions (เพื่อสถานะ “พร้อมฉุกเฉิน”) รัน bitcoind เต็ม node เสมอ (pruned=false) เพื่อให้ getblocktemplate ใช้ได้ทันที เปิด txindex ถ้าคุณต้องการ getrawtransaction แบบสะดวก แต่ไม่จำเป็นถ้าใช้ transactions[].data จาก GBT ตั้งระบบ monitoring (disk, mem, uptime, sync progress) และ alert เมื่อ initialblockdownload = false แล้วหรือเมื่อ verificationprogress เข้าใกล้ 1.0 ตั้งค่า MIN_TARGET โดยอ้างอิงความสามารถ H/s ของเครื่อง
@puk
27 Sep 2025 00:14Create a single photo collage in one image, divided into a clean 3x3 grid (9 equal panels), aspect ratio 9:16. Use the face exactly from the attached photo (100% identical facial features, do not alter the face shape or structure). Each panel shows the same woman with a different trendy 2025 female hairstyle, no repetition. Background in all panels is light brown, uniform, minimal. No text, no titles, no watermark. Hairstyles for each panel (2025 trends): 1. Long sleek straight hair with soft inward ends. 2. Wavy lob (long bob) with natural volume. 3. High ponytail with face-framing bangs. 4. Short bob with blunt cut and glass-hair shine. 5. Layered haircut with wispy see-through bangs. 6. Long loose waves with soft balayage highlights. 7. Chic pixie cut with textured top. 8. Half-up, half-down hairstyle with subtle curls. 9. Ultra-short stylish bob (jawline length, sharp and modern).
@puk
26 Sep 2025 05:33bitcoin core + PUK trading simulator + LND
@puk
24 Sep 2025 08:50bitcoin-cli -datadir=/mnt/data2/bitcoin loadwallet "geomanss" bitcoin-cli -datadir=/mnt/data2/bitcoin listwallets
@puk
24 Sep 2025 02:55/usr/local/bin/bitcoind -datadir=/mnt/data2/bitcoin -daemon Bitcoin Core starting
@puk
22 Sep 2025 15:22ขั้นตอนต่อไป (Skip BDB, ตรงไป CMake Build)ยืนยัน Dependencies (คุณ install แล้ว แต่เช็คเพิ่มถ้าต้องการ SQLite support): sudo apt install libsqlite3-dev ถ้า error already newest: ok แล้ว. Build ด้วย CMake (ใน /mnt/data2/pukcoin): cd /mnt/data2/pukcoin mkdir -p build # สร้าง build dir ถ้ายังไม่มี cd build cmake .. \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_GUI=OFF \ -DWALLET=ON \ -DENABLE_WALLET=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local อธิบาย options:-DCMAKE_BUILD_TYPE=RelWithDebInfo: Build optimized พร้อม debug info (ดีสำหรับ dev/test). -DBUILD_GUI=OFF: ไม่ build Qt GUI เพื่อ simple (ถ้าต้องการ GUI เปลี่ยนเป็น ON และ install Qt deps: sudo apt install qtbase5-dev qttools5-dev-tools libqt5dbus5 qttools5-dev). -DWALLET=ON -DENABLE_WALLET=ON: Enable wallet ด้วย SQLite (สำหรับ mint/send ใน Flask). -DCMAKE_INSTALL_PREFIX=/usr/local: Install ไป global path (หรือใช้ /opt/pukcoin ถ้าต้องการ isolate). ถ้า cmake success: จะเห็น output สุดท้ายแบบ "Build files have been written to: /mnt/data2/pukcoin/build" และ summary ของ features (e.g., Wallet: ON). Compile และ Install: make -j$(nproc) # Compile parallel (ใช้ CPU cores ทั้งหมด; ~10-40 นาที ขึ้นกับเครื่อง) sudo make install # Install binaries ไป /usr/local/bin (bitcoind, bitcoin-cli, etc.) ถ้า RAM น้อย (e.g., OOM error): ลอง make -j4 (ลด jobs). ถ้า error เกี่ยวกับ missing lib: ส่ง log มา (e.g., ถ้า ZMQ อยาก enable: เพิ่ม -DWITH_ZMQ=ON ใน cmake). Test Build: bitcoind -version # ควรแสดง "Bitcoin Core version v29.x.x" หรือ latest bitcoind -daemon -regtest -printtoconsole # Run regtest mode (test chain; Ctrl+C เพื่อ stop) # ใน terminal ใหม่: bitcoin-cli getblockchaininfo # เช็ค status (ควรเห็น chain: "regtest") bitcoin-cli stop # Stop daemon ถ้า run ok: Build สำเร็จ! ตอนนี้คุณมี bitcoind ที่ ready สำหรับ fork.
@puk
22 Sep 2025 14:55คำอธิบายโปรเจค: ระบบเทรดคริปโตแบบ Simulation เชื่อมบล็อกเชน PUK Coinภาพรวมของโปรเจคโปรเจคนี้เป็นการพัฒนาระบบเทรดคริปโตแบบจำลอง (Simulation Trading Platform) ที่ผสมผสานระหว่างแอปพลิเคชันเว็บด้วย Flask (Python) และบล็อกเชนส่วนตัวที่ fork มาจาก Bitcoin Core เพื่อสร้างเหรียญดิจิทัลใหม่ชื่อ "PUK" (PUK Coin) โดยมีเป้าหมายหลักคือ:จำลองการเทรด: ผู้ใช้สามารถเปิด/ปิดตำแหน่งเทรด (trade positions) ในคู่สกุลเงินคริปโตจริง (เช่น BTC/USDT) ผ่าน API โดยคำนวณกำไร/ขาดทุน (PNL) แบบเรียลไทม์จากราคาจริงจาก Binance. เชื่อมต่อบล็อกเชน: แทนการเก็บข้อมูลในไฟล์ JSON ธรรมดา ระบบจะบันทึกธุรกรรม (เช่น การ mint เหรียญเริ่มต้น, ล็อก collateral สำหรับเทรด) บนบล็อกเชน PUK จริง เพื่อให้โปร่งใสและปลอดภัย โดยใช้ JSON-RPC สำหรับการโต้ตอบ. จำกัด supply: เหรียญ PUK ทั้งหมดมีจำนวนคงที่ 1,000 ล้านเหรียญ (1 พันล้าน) เพื่อป้องกัน inflation และเลียนแบบเศรษฐกิจดิจิทัลที่ยั่งยืน. โหมดการทำงาน: รองรับทั้ง testnet (regtest) สำหรับพัฒนาและ mainnet สำหรับ production โดยใช้ nodes หลายตัวเพื่อยืนยันธุรกรรม (confirm TX) จากการเทรด. โปรเจคนี้เหมาะสำหรับการเรียนรู้หรือ prototype ระบบ DeFi (Decentralized Finance) ที่รวม trading simulation กับ on-chain transactions โดย fork จาก Bitcoin Core ทำให้ใช้ consensus mechanism (Proof-of-Work) เดียวกัน แต่ปรับแต่งให้เหมาะกับ use case เฉพาะ.ลักษณะการทำงานหลัก (Operational Flow)ระบบแบ่งออกเป็น 2 ส่วนหลัก: Frontend/Backend (Flask App) สำหรับ UI และ logic การเทรด และ Backend Blockchain (PUK Node) สำหรับเก็บข้อมูลธุรกรรม. การทำงานแบบ end-to-end มีดังนี้:การตั้งค่าเริ่มต้น (Setup):Fork Bitcoin Core: Clone source code จาก GitHub (bitcoin/bitcoin master branch) แล้ว build ด้วย CMake (ไม่ใช้ Autotools ที่ deprecated แล้ว). ปรับแต่งใน src/chainparams.cpp เพื่อ:สร้าง genesis block ใหม่ (block แรกของ chain) ด้วย message เช่น "PUK Coin - Launched 2025". กำหนด block reward เริ่มต้น (e.g., 50 PUK/block) และ halving interval (e.g., ทุก 210,000 blocks) เพื่อให้ total supply ไม่เกิน 1 พันล้านเหรียญ (อาจ pre-mine ~900 ล้านใน genesis เพื่อแจกจ่ายเริ่มต้น). Rename binaries เป็น pukcoind (daemon) และ pukcoin-cli (CLI tool). Run Nodes: รัน pukcoind หลาย instance (e.g., บน port 18332, 18333) ด้วย config file (pukcoin.conf) ที่กำหนด RPC user/password, regtest mode สำหรับ test. Nodes เชื่อมต่อกันผ่าน addnode RPC เพื่อ validate blocks. Flask App: รันบน port 5000 ด้วย app.run(). ใช้ library ccxt สำหรับดึงราคาจาก Binance และ requests สำหรับเรียก RPC ไปยัง PUK node. การสมัครผู้ใช้และ Mint เหรียญ (User Registration & Minting):ผู้ใช้เรียก API /register ด้วย user_id (e.g., POST JSON {"user_id": "user123"}). ระบบ generate Bitcoin address ใหม่ผ่าน RPC getnewaddress (label ด้วย user_id). Mint/send 1 ล้าน PUK จาก master wallet (pre-mined address) ไปยัง user address ผ่าน sendtoaddress RPC. Mine block ใหม่ด้วย generate 1 เพื่อ confirm TX ทันที (ใน testnet; mainnet ใช้ miners pool). บันทึก address ในไฟล์ JSON (user_{user_id}.json) สำหรับ reference (balance ดึงจาก chain ด้วย getreceivedbyaddress). การจำลองเทรด (Trading Simulation):เปิดตำแหน่ง (/open_trade): POST JSON ด้วย symbol (e.g., "BTC/USDT"), side ("BUY"/"SELL"), amount, leverage.เช็ค balance on-chain ถ้าพอ (load_balance เรียก RPC). คำนวณ entry price, SL (Stop Loss 1%), TP (Take Profit 2%) จากราคาปัจจุบัน (ccxt.fetch_ticker). ล็อก collateral (amount * leverage PUK) โดย send TX ไปยัง escrow address (e.g., multi-sig) ผ่าน sendtoaddress. บันทึก trade details ใน logs JSON (off-chain สำหรับ UI) รวม txid. ห้ามเปิด trade ซ้ำ symbol เดียวกัน. อัปเดตสถานะ (/update): GET ด้วย user_id ทุก ๆ วินาที (สำหรับ real-time UI).ดึงราคาใหม่, คำนวณ PNL สำหรับแต่ละ trade. Auto-close ถ้าถึง SL/TP: เรียก close_trade ภายใน, unlock TX จาก escrow + PNL กลับ user address. สร้าง signals สุ่ม (e.g., BUY/SELL BTC ด้วย tools อย่าง EMA/RSI) สำหรับ suggestion. ส่งคืน trades, prices, balance (จาก chain), PNL total. ปิดตำแหน่ง (/close_trade หรือ /close_all): POST ด้วย symbol หรือ all.คำนวณ PNL จากราคาปัจจุบัน. Unlock TX: Send principal + PNL จาก escrow กลับ user (ถ้า PNL negative = loss). ลบ trade จาก logs (clean UI). Mine block เพื่อ confirm. การจัดการธุรกรรมและ Nodes:ปิด Block และ Confirm TX: ทุก TX จากเทรด (lock/unlock) จะถูก broadcast ไปยัง nodes แล้ว mine ด้วย generate RPC เพื่อปิด block (ใน dev; production ใช้ miners จริงเพื่อ PoW). Leaderboards: ดึง balance ทุก user จาก RPC แล้ว sort ตาม PNL (แสดง top traders). Security: ใช้ RPC auth, escrow สำหรับ prevent double-spend, และ HTTPS สำหรับ production. คุณสมบัติเด่น (Key Features)Transparency: ทุก trade/PNL บันทึก on-chain ทำให้ verifiable (ผู้ใช้เช็ค txid ด้วย explorer ถ้าสร้าง). Scalability: Nodes หลายตัวสำหรับ high throughput; supply cap 1B เพื่อ value stability. Simulation Mode: ไม่ใช้เงินจริง – PNL คำนวณจากราคา Binance แต่ collateral ใช้ PUK จริงบน chain. Extensibility: สามารถเพิ่ม smart contracts (ถ้า migrate ไป EVM-compatible fork) หรือ integrate กับ wallet apps. ข้อจำกัดและขั้นตอนถัดไปปัจจุบัน: ยังเป็น prototype – test บน regtest, ไม่มี full explorer หรือ mobile app. พัฒนาต่อ: เพิ่ม UI (templates ใน Flask), deploy nodes บน cloud (AWS), สร้าง faucet สำหรับ mint ฟรี, และ audit code สำหรับ security. ประโยชน์: ช่วยนักพัฒนาเรียนรู้ DeFi โดย integrate trading กับ blockchain ได้ง่าย เหมาะสำหรับ edtech หรือ gaming economy.
@puk
22 Sep 2025 13:11import tkinter as tk from tkinter import ttk import subprocess import json import threading import time # --- Config --- CLI = "/usr/local/bin/bitcoin-cli" DATADIR = "/mnt/data2/bitcoin" RPCUSER = "xxxx" RPCPASS = "xxxx" class BitcoinMonitor(tk.Tk): def __init__(self): super().__init__() self.title("Bitcoin Core Monitor 🪙") self.geometry("500x300") self.configure(bg="#1e1e1e") # Title self.label_title = tk.Label( self, text="📡 Bitcoin Core Sync Status", font=("Arial", 16, "bold"), fg="white", bg="#1e1e1e" ) self.label_title.pack(pady=10) # Info area self.info_text = tk.StringVar() self.label_info = tk.Label( self, textvariable=self.info_text, font=("Consolas", 12), fg="#00ff99", bg="#1e1e1e", justify="left" ) self.label_info.pack(pady=10) # Progress bar self.progress = ttk.Progressbar(self, length=400, mode="determinate", maximum=100) self.progress.pack(pady=10) # Refresh button self.refresh_btn = tk.Button( self, text="🔄 Refresh Now", command=self.update_status, bg="#333", fg="white", font=("Arial", 12, "bold") ) self.refresh_btn.pack(pady=10) # Auto update thread self.running = True threading.Thread(target=self.auto_update, daemon=True).start() # Handle closing window self.protocol("WM_DELETE_WINDOW", self.on_close) def on_close(self): self.running = False self.destroy() # ฟังก์ชันเรียก bitcoin-cli พร้อม datadir และ RPC def get_status(self): try: output = subprocess.check_output( [CLI, f"-datadir={DATADIR}", f"-rpcuser={RPCUSER}", f"-rpcpassword={RPCPASS}", "getblockchaininfo"], stderr=subprocess.STDOUT ) return json.loads(output) except subprocess.CalledProcessError as e: msg = e.output.decode() if "error code: -28" in msg: # Node ยัง sync อยู่ return {"blocks": 0, "headers": 0, "verificationprogress": 0, "initialblockdownload": True, "chain": "unknown"} print("Error calling bitcoin-cli:", msg) return None except Exception as e: print("Other error:", e) return None # อัปเดต GUI def update_status(self): info = self.get_status() if not info: self.info_text.set("❌ Bitcoin Core is not running or RPC failed.") self.progress["value"] = 0 return blocks = info.get("blocks", 0) headers = info.get("headers", 0) progress = info.get("verificationprogress", 0) * 100 text = ( f"🟢 Running: Bitcoin Core\n\n" f"Blocks: {blocks:,} / {headers:,}\n" f"Progress: {progress:.4f}%\n" f"IBD: {info.get('initialblockdownload', True)}\n" f"Chain: {info.get('chain', 'unknown')}" ) self.info_text.set(text) self.progress["value"] = progress # อัปเดตอัตโนมัติทุก 5 วินาที def auto_update(self): while self.running: self.update_status() time.sleep(5) if __name__ == "__main__": app = BitcoinMonitor() app.mainloop()
@puk
22 Sep 2025 05:14นวนิยาม เล่ม 1 ใน Diary
@puk
22 Sep 2025 00:53"รูปแบบการเทรด" (Trading Styles / Approaches) ที่เกิดขึ้นบนโลกจริงนั้นมีหลายมิติ ขึ้นอยู่กับว่าเรามองจากมุมไหน เช่น มองจาก ระยะเวลา, กลยุทธ์, เทคนิคการวิเคราะห์ หรือแม้แต่ พฤติกรรมของเทรดเดอร์ ✅ 1. แบ่งตาม ระยะเวลาในการถือครอง (Timeframe-based Styles) Scalping → เทรดเร็วมากในไม่กี่นาทีหรือวินาที เอากำไรเล็กๆ ซ้ำๆ Day Trading → เปิด-ปิดออเดอร์ภายในวัน ไม่ค้างข้ามคืน Swing Trading → ถือ 2-7 วันหรือหลายสัปดาห์ จับคลื่นกลาง Position Trading / Investing → ถือยาวเป็นเดือน-ปี มองแนวโน้มใหญ่ ✅ 2. แบ่งตาม แนวคิดหลัก (Approach-based Styles) Technical Trading → ใช้กราฟ, indicator, price action Fundamental Trading → อิงข่าว เศรษฐกิจ กำไรบริษัท, macro trend Quantitative / Algorithmic Trading → ใช้สูตร, คณิตศาสตร์, AI, Algo Sentiment Trading → เทรดตามข่าว, กระแสโซเชียล, ความเชื่อมั่นตลาด ✅ 3. แบ่งตาม กลยุทธ์ (Strategies) Trend Following → ซื้อเมื่อขึ้น ขายเมื่อกำลังลง Counter-Trend (Mean Reversion) → สวนทาง เช่น ซื้อเมื่อราคาต่ำเกินไป Breakout Trading → รอทะลุแนวรับ/แนวต้านแล้วเข้า Range Trading → เล่นในกรอบ support/resistance Arbitrage → หาต่างราคาตลาด (เช่น BTC ใน Binance vs Coinbase) News Trading → เล่นตามข่าวแรงๆ เช่น FOMC, CPI ✅ 4. แบ่งตาม การจัดการเงินทุน (Risk/Capital Management Styles) Value Averaging (VA) Dollar-Cost Averaging (DCA) Martingale / Anti-Martingale Kelly Criterion ✅ 5. แบ่งตาม จิตวิทยาและพฤติกรรมเทรดเดอร์ Systematic Trader → ทำตามระบบ/กฎชัดเจน Discretionary Trader → ใช้ประสบการณ์และวิจารณญาณ Copy Trading / Social Trading → ตามคนอื่น / ตามบอท