Bitcoin Forum
May 07, 2024, 05:52:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Good python projects for learning?  (Read 219 times)
ap334 (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 12, 2018, 10:15:33 PM
 #1

I'm a btc beginner rusty on my cpp, so looking for a solid python btc implementation to learn how everything works.

Any recommendations on a good implementation to look at? I've found:
- https://github.com/petertodd/python-bitcoinlib
- https://github.com/ofek/bit

I'm also brushing up on cpp, but wanted to start digging in to the logic in a language I understand simultaneously. Thanks!
The trust scores you see are subjective; they will change depending on who you have in your trust list.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715061174
Hero Member
*
Offline Offline

Posts: 1715061174

View Profile Personal Message (Offline)

Ignore
1715061174
Reply with quote  #2

1715061174
Report to moderator
1715061174
Hero Member
*
Offline Offline

Posts: 1715061174

View Profile Personal Message (Offline)

Ignore
1715061174
Reply with quote  #2

1715061174
Report to moderator
1715061174
Hero Member
*
Offline Offline

Posts: 1715061174

View Profile Personal Message (Offline)

Ignore
1715061174
Reply with quote  #2

1715061174
Report to moderator
frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
February 12, 2018, 10:22:55 PM
 #2

Not exactly what you're asking for but:

https://github.com/Frankenmint/PKGenerator_Checker

and a v2 version in a single script here:

Code:
#!/usr/bin/env python3

import time
import logging
import requests
from lxml import html
from random import randint


iterating = 0
napLength = 3 # time in seconds to sleep for
iterLimits = 1000 # how many API lookups till we take a Nap

from smtplib import SMTP_SSL as SMTP
from time import sleep

host        = "smtp.ymail.com"
usrnme      = "myemail@yahoomail.com"
pswd        = "myFancyPantsPasswording"
subject = "check this private key pls"

def send_email(from_addr, to_addr, body_text):
    """
    Send an Email
    """

    msg_body = ""
    parts = ["From: %s" % from_addr,
            "To: %s" % to_addr,
            "MIME-Version: 1.0",
            "Content-type: text/html",
            "Subject: %s" % subject,
            "",
            body_text
            , "\r\n"]
    msg_body = "\r\n".join(parts)
    server = SMTP(host, 465)
    # server.set_debuglevel(1)
    server.ehlo()
    server.login(usrnme,pswd)
    server.sendmail(from_addr, to_addr, msg_body)
    server.quit()



def generatePage():
    return randint(0,904625697166532776746648320380374280100293470930272690489102837043110636675)



def grabPks(pageNum):
    req = requests.get("https://directory.io/"+str(pageNum))
        tree = html.fromstring(req.text)
        pk = tree.xpath("//*[@id]/span[1]//text()")
    resCmpress = tree.xpath("//*[@id]/a[3]//text()")
    resXtend = tree.xpath("//*[@id]/a[2]//text()")
    return pk, resCmpress, resXtend


while True:
    pkArray = grabPks(generatePage())
    for i in range(len(pkArray[0])):
        if (iterating >= iterLimits):
            print("taking a {0} second Nap..ZZZzzzzz".format(napLength))
            time.sleep(napLength)
            iterating = -1
        iterating +=1
        resCmp = requests.get("https://blockchain.info/q/addressbalance/" +str(pkArray[1][i]))
        endCmp =  resCmp.text
        resXnd = requests.get("https://blockchain.info/q/addressbalance/" +str(pkArray[2][i]))
        endExt =  resXnd.text
        if "Illegal character   at position" not in endCmp:

        if endCmp != "0" :
            print ("endCmp = " + endCmp)
            print("We may have found something! check out Private Key {0}, for compressed Address {1}".format(pkArray[0][i], pkArray[1][i]))
            send_email("myemail@gmail.com", "myemail@gmail.com", "check out Private Key {0}, for Adress {1}, and {2}".format(pkArray[0][i], pkArray[1][i], pkArray[2][i] ))
            raise SystemExit


    if "Illegal character   at position" not in endExt:

        if endExt != "0" :
            print ("endExt = " + endExt)
            print("We may have found something! check out Private Key {0}, for extended Address {1}".format(pkArray[0][i], pkArray[2][i]))
            send_email("myemail@gmail.com", "myemail@gmail.com", "check out Private Key {0}, for Adress {1}, and {2}".format(pkArray[0][i], pkArray[1][i], pkArray[2][i] ))
            raise SystemExit

    print ("Ext: {0}, Stndrd {1}".format(endExt, endCmp))


''' HEY THERE PIRATE!

THIS IS A 2017 FACELIFT TO THE TOY APP POOR MANS MINING.
HUNT THEM 2010 ERA COINS!!!!  Currently the Script uses Directory.IO
and blockchain.info to parse (at random) the entire sha256 keylist page by page
256 different lookups per page (1 for compressesed public address one for standard.
Feel Free to checkout Line 63 IF YOU REALLY WANT TO KNOW HOW BIG THIS IS...
and impractical mind you!  This script may be your friend if you - can setup
and distribute this, like a botnet so that its scanning all the time from different
machines and ultimately pinging you on anything found.  You are literally stealing
someone else's private key - if the BTC utxo's are OLD like 2010 old you may be
able to comformably claim those - if the funds are a couple months old however,
you may need to consider returning a large portion if not all of them back to the
rightful owner.  Just like with my PK generator/checker tool this is literally for
enteratinment purposes and not designed for extended real world use.  Your IP
Address may become blocked from using this toy extensively, proceed with caution.
If you DO actually happen to find a collision (ie someone else's private key),
pat yourself on the back because that's supposed to not be possible...and maybe
send a few duckets my way: 1FFbaH8YH2e7u77ewGbrAcW1EPKVJboEuu

'''

Take a look at the first link to actually see how a private key is used to generate a public key.  This embedded file simply takes out the address generation logic and runs a random lookup generator an entire page at a time to blockchain.info

kooler1
Jr. Member
*
Offline Offline

Activity: 33
Merit: 1


View Profile
February 22, 2018, 09:53:22 PM
 #3

Not sure if there are actually serious crypto projects written on Python. Looks like C++ is the strong and respected industry standard.

There is part of the Dash called Sentinel though, that is written on Python, perhaps will be interesting to check out: https://github.com/dashpay/sentinel
BitProNews
Full Member
***
Offline Offline

Activity: 376
Merit: 103



View Profile
February 22, 2018, 10:02:09 PM
 #4

Almost easy to get up with c++ or any similar languae if you can interact with python programmation language that majority of all those devepement tools are c+ based. Ethereum has its own language (solidity) which is c+ backed with the interfer of java and a little bit of php.
The key is to get integretad into this environment where everything is possible.
itod
Legendary
*
Offline Offline

Activity: 1974
Merit: 1076


^ Will code for Bitcoins


View Profile
February 23, 2018, 05:15:17 PM
 #5

I'm a btc beginner rusty on my cpp, so looking for a solid python btc implementation to learn how everything works.

Any recommendations on a good implementation to look at? I've found:
- https://github.com/petertodd/python-bitcoinlib
- https://github.com/ofek/bit

I'm also brushing up on cpp, but wanted to start digging in to the logic in a language I understand simultaneously. Thanks!

It's not exactly BTC implementation, but Armory BTC wallet is written in Python and has many, many things blockchain related:
https://github.com/goatpig/BitcoinArmory/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!