CryptoCoinsInfoClub.com

Pybitcointools Bip32

Python - How To Convert A Wif Private Key To A Bip32 Extended Private Key - Bitcoin Stack Exchange

Python - How To Convert A Wif Private Key To A Bip32 Extended Private Key - Bitcoin Stack Exchange

How to convert a WIF private key to a BIP32 extended private key I am trying to recover the extended BIP32 master private key from its extended BIP32 public key (which I already know) and a WIF private key (which I obtained by decrypting a BIP38 seed with a passphrase). I followed the steps described in this article from Vitalik Buterin, but to use the crack_bip32_privkey function in pybitcointools, I need to have a private key in BIP32 format (not WIF). I can see how to obtain a BIP32 private master key from a BIP32 seed (with bip32_master_key), but not how to do the same from a private key in WIF format. How can I convert the WIF Private key into a BIP 32 private key (with Python, .NET or Javascript)? You've already asked this question, and it was closed as a duplicate of bitcoin.stackexchange.com/questions/56916/ . Pieter Wuille Jul 25 '17 at 5:22 I have edited the question with what he actually wanted to ask about: bitcoin.stackexchange.com/questions/56916/ Andrew Chow Jul 26 '17 at 1:47 You can't. The BIP 32 extended private key format contains information which is not present in the WIF private key. The extended private key format contains the chaincode of the private key, the index, and the parent fingerprint. Those information come from the derivation of the private key itself and cannot be found elsewhere. In order to get the parent public key, the only information that you need from the extended public key is the index of the child. This can be trivially found by simply brute forcing through all possible child indexes (2^31 - 1 indexes) until you get a master private key which has a public key that matches the parent public key, or until you have derived the correct child public key from the parent public key. Here is code that will find you the parent privat Continue reading >>

Importing Private Keys?

Importing Private Keys?

Not exactlyall wallets use the same encryption methodsyour passphrase is encrypted with AES 128 and sha512 most of the time If you have a private key you dont need a passphrase though private keys are encrypted using the passphrase in a wallet but if you have a bip38 private key then you can download electrum or exudous and import it to that and like I said you just need a passphrase to access your private keys in a wallet for signing transactions and such if you have the private key you can even create a raw transaction in a different wallet and sign it using that private key you can use any wallet youd like but make sure the format of key you are trying to import is supported in that wallet I would go to liteaddress.org (be sure to type in the address manually to the address bar as instead of to secure your connection) and once your there move your mouse around until it go to the next screen and then click wallet detailsnow enter that BIP 38 private key in the Private Key box and you will get a WIF private key at the bottom on the right side. Now after you have downloaded litecoin core form litecoin.org for your pc or mac and it is fully synced you can open Console under the Help tab/ Debug window and using the following command: then you can send your coins without a passphrase or re-encrypt from thereDONT FORGET YOUR PASSWORD more than likely your doing something like you wrote down a 5 that looks like an S or a 2 that looks like a z or something like thatpasswords are case sensitive as well and all characters and symbols as well as spaces are acceptable in Bitcoin and Litecoin wallets for passphrases. Thanks for the reply so quick. No problem is I tried 50 times over the past few days on to get the WIF with the private key and its asked for pass phrase and is tell Continue reading >>

Best Way To Create An Offline Bip44/bip32 Paper Wallet Based On A Bip39 Mnemonic? And Monitor It Using A Watching-only App On Android? : Bitcoin

Best Way To Create An Offline Bip44/bip32 Paper Wallet Based On A Bip39 Mnemonic? And Monitor It Using A Watching-only App On Android? : Bitcoin

Do not use URL shortening services: always submit the real link. Begging/asking for bitcoins is absolutely not allowed, no matter how badly you need the bitcoins. Only requests for donations to large, recognized charities are allowed, and only if there is good reason to believe that the person accepting bitcoins on behalf of the charity is trustworthy. News articles that do not contain the word "Bitcoin" are usually off-topic. This subreddit is not about general financial news. Submissions that are mostly about some other cryptocurrency belong elsewhere. For example, /r/CryptoCurrency is a good place to discuss all cryptocurrencies. Promotion of client software which attempts to alter the Bitcoin protocol without overwhelming consensus is not permitted. Trades should usually not be advertised here. For example, submissions like "Buying 100 BTC" or "Selling my computer for bitcoins" do not belong here. /r/Bitcoin is primarily for news and discussion. Please avoid repetition /r/bitcoin is a subreddit devoted to new information and discussion about Bitcoin and its ecosystem. New merchants are welcome to announce their services for Bitcoin, but after those have been announced they are no longer news and should not be re-posted. Aside from new merchant announcements, those interested in advertising to our audience should consider Reddit's self-serve advertising system . Do not post your Bitcoin address unless someone explicitly asks you to. Be aware that Twitter, etc. is full of impersonation. Continue reading >>

Pybitcointool-plus

Pybitcointool-plus

the following will show revised version doc from pybitcointool Many functions can be taken out and used individually Transaction deserialization format almost compatible with BitcoinJS Make and publish a transaction all in a single command line instruction Includes non-bitcoin-specific conversion and JSON utilities Not a full node, has no idea what blocks are Relies on centralized service (blockchain.info) for blockchain operations, although operations do have backups (eligius, blockr.io) from bitcoin import *priv = sha256('some big long brainwallet password')print(priv)'57c617d9b4e1f7af6ec97ca2ff57e94a28279a7eedd4d12a99fa11170e94f5a4'pub = privtopub(priv)print(pub)'0420f34c2786b4bae593e22596631b025f3ff46e200fc1d4b52ef49bbdc2ed00b26c584b7e32523fb01be2294a1f8a5eb0cf71a203cc034ced46ea92a8df16c6e9'addr = pubtoaddr(pub)print(addr)'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'h = history(addr)print(h)[{'output': u'97f7c7d8ac85e40c255f8a763b6cd9a68f3a94d2e93e8bfa08f977b92e55465e:0', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}, {'output': u'4cc806bb04f730c445c60b3e0f4f44b54769a1c196ca37d8d4002135e4abd171:1', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}]outs = [{'value': 90000, 'address': '16iw1MQ1sy1DtRPYw3ao1bCamoyBJtRB4t'}]tx = mktx(h,outs)print(tx)'01000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f7970000000000ffffffff71d1abe4352100d4d837ca96c1a16947b5444f0f3e0bc645c430f704bb06c84c0100000000ffffffff01905f0100000000001976a9143ec6c3ed8dfc3ceabcc1cbdb0c5aef4e2d02873c88ac00000000'tx2 = sign(tx,0,priv) # 0 is for get the prev outprint(tx2)'01000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f797000000008b483045022100dd29d89a28451febb990fb1dafa21245b105140083ced315ebcdea187572b3990220713f2e554f384d29d7abfedf Continue reading >>

Golang Bip 32 Implementation

Golang Bip 32 Implementation

documentation: It tests against the BIP 32 page test vectors ( ) and passes. (I'm sure it could use more eyes on the code, though) I used this as reference: Edit: changed repo name, added documentation link I love seeing Bitcoin Go projects. It is just such a nicer language to write compares to c++ Quote from: sidazhang on January 06, 2014, 05:53:32 AM I love seeing Bitcoin Go projects. It is just such a nicer language to write compares to c++ You'll like MC2 then, we're coding it entirely in Go. documentation: It tests against the BIP 32 page test vectors ( ) and passes. (I'm sure it could use more eyes on the code, though) I used this as reference: Edit: changed repo name, added documentation link Hey! This is cool and looks like what I need. So, I have this Electrum Master Public Key, but I'm not exactly sure how I would use this library with that to get the addresses. Could you help me with this? I shouldn't have to use the seed or any private key for this to work as far as I know. Continue reading >>

Python - How To Convert A Wif Private Key To A Bip32 Extended Private Key - Bitcoin Stack Exchange

Python - How To Convert A Wif Private Key To A Bip32 Extended Private Key - Bitcoin Stack Exchange

How to convert a WIF private key to a BIP32 extended private key I am trying to recover the extended BIP32 master private key from its extended BIP32 public key (which I already know) and a WIF private key (which I obtained by decrypting a BIP38 seed with a passphrase). I followed the steps described in this article from Vitalik Buterin, but to use the crack_bip32_privkey function in pybitcointools, I need to have a private key in BIP32 format (not WIF). I can see how to obtain a BIP32 private master key from a BIP32 seed (with bip32_master_key), but not how to do the same from a private key in WIF format. How can I convert the WIF Private key into a BIP 32 private key (with Python, .NET or Javascript)? You've already asked this question, and it was closed as a duplicate of bitcoin.stackexchange.com/questions/56916/ . Pieter Wuille Jul 25 '17 at 5:22 I have edited the question with what he actually wanted to ask about: bitcoin.stackexchange.com/questions/56916/ Andrew Chow Jul 26 '17 at 1:47 You can't. The BIP 32 extended private key format contains information which is not present in the WIF private key. The extended private key format contains the chaincode of the private key, the index, and the parent fingerprint. Those information come from the derivation of the private key itself and cannot be found elsewhere. In order to get the parent public key, the only information that you need from the extended public key is the index of the child. This can be trivially found by simply brute forcing through all possible child indexes (2^31 - 1 indexes) until you get a master private key which has a public key that matches the parent public key, or until you have derived the correct child public key from the parent public key. Here is code that will find you the parent privat Continue reading >>

Transactions: Bitcoin For Humans

Transactions: Bitcoin For Humans

As part of our development stack here at ascribe we decided to write a simple tool to create and push bitcoin transactions into the bitcoin network. Inspired by requests which took the best from different python libraries to handle http requests and wrapped it into a simple and easy to use api we decided to follow the same path and create a simple python library to handle bitcoin transactions. The core of the libray relies on two simple methods: get and push. get allows yout to get information of any hash from the bitcoin network. # bitcoin address - gives the transactions and # unspents of the address transactions.get('mhyCaF2HFk7CVwKmyQ8TahgVdjnHSr1pTv') {'transactions': [{'amount': -20000, 'confirmations': 36, 'time': 1431333905, 'txid': u'7f4902599ac9e5c9db347228b489c25fe5095f812c979dd84cc4e88f6812db9e'}, {'amount': -40000, 'confirmations': 42, 'time': 1431329129, 'txid': u'382639448115e859b0dc4092892bc0921edc8851a2b7adbd7b5ab39ccefb73ee'}, ... 'unspents': [{'amount': 809760000, 'confirmations': 36, 'txid': u'7f4902599ac9e5c9db347228b489c25fe5095f812c979dd84cc4e88f6812db9e', 'vout': 1}]} # transaction id - get all information related to a # transaction transactions.get('7f4902599ac9e5c9db347228b489c25fe5095f812c979dd84cc4e88f6812db9e') {u'block': 395972, u'confirmations': 40, u'days_destroyed': u'0.34', u'extras': None, u'fee': u'0.00010000', u'is_coinbased': 0, u'is_unconfirmed': False, u'time_utc': u'2015-05-11T10:45:05Z', u'trade': {u'vins': [{u'address': u'mhyCaF2HFk7CVwKmyQ8TahgVdjnHSr1pTv', u'amount': -0.0002, u'is_nonstandard': False, u'n': 3, u'type': 0, u'vout_tx': u'382639448115e859b0dc4092892bc0921edc8851a2b7adbd7b5ab39ccefb73ee'}], u'vouts': [{u'address': u'mqXz83H4LCxjf2ie8hYNsTRByvtfV43Pa7', u'amount': 0.0001, u'is_nonstandard': False, u'is_spent': 0, Continue reading >>

Bip32 - How Do I Generate Multiple Address With A Master Public Key In Pybitcointools? - Bitcoin Stack Exchange

Bip32 - How Do I Generate Multiple Address With A Master Public Key In Pybitcointools? - Bitcoin Stack Exchange

How do I generate multiple address with a master public key in pybitcointools? I'm goofing around with this fork of pybitcointools and I got stock with generating multiple address for receiving coins with a master public key. So far, this is what I have: import bitcoin as btcprivatekey = btc.sha256("large example seed for this great test")print privatekey# 03e02b95a485112b543ac29cd262afbbd64dca9b4496e264e47312cb193ae5abbip32_masterprivatekey = btc.bip32_master_key(privatekey)bip32_masterpublickey = btc.bip32_privtopub(bip32_masterprivatekey)print bip32_masterprivatekey# xprv9s21ZrQH143K3tQmGrVtKc7B6ZPtCJAmD6wDAJXxb7YXAoZFTb55UroSxrU7k823vSQmYPDhdseRKqP1mgSUWDneinai2seUd7RLX2xkmGWprint bip32_masterpublickey# xpub661MyMwAqRbcGNVENt2tgk3uebENbktcaKroxgwa9T5W3btQ18PL2f7vp78LNoioGhZcgSH1i2cH48YcQttiEaAh86TuJpsUu2J7jQWnmbC That would generate one bitcoin address, right? How do I generate two or more using the master public key? shackra Jul 22 '16 at 4:57 Indeed, that would. You'll want to do bip32_descend to get keys that are not the root key. Jimmy Song Jul 22 '16 at 13:45 Sorry for being annoying, but what parameters should I exactly feed bip32_descend with, besides the public master key (I guess) to achieve what I'm looking? I did this btc.pubkey_to_address(btc.bip32_descend(bip32_masterpublickey, [1, 0, 0])) and I'm getting a different address changing the third 0 of the list, but I'm not sure if that equals to M/i'/0 shackra Jul 22 '16 at 21:42 So the last argument is the BIP32 path. [1,0,0] => M/1/0/0 path. Changing any of the numbers in the path or making it longer by an element will change the address. Jimmy Song Jul 23 '16 at 15:41 Continue reading >>

Python/13651/pybitcointools/bitcoin/deterministic.py

Python/13651/pybitcointools/bitcoin/deterministic.py

from bitcoin.main import *import hmacimport hashlibfrom binascii import hexlify# Electrum walletsdef electrum_stretch(seed): return slowsha(seed)# Accepts seed or stretched seed, returns master public keydef electrum_mpk(seed): if len(seed) == 32: seed = electrum_stretch(seed) return privkey_to_pubkey(seed)[2:]# Accepts (seed or stretched seed), index and secondary index# (conventionally 0 for ordinary addresses, 1 for change) , returns privkeydef electrum_privkey(seed, n, for_change=0): if len(seed) == 32: seed = electrum_stretch(seed) mpk = electrum_mpk(seed) offset = dbl_sha256(from_int_representation_to_bytes(n)+b':'+from_int_representation_to_bytes(for_change)+b':'+binascii.unhexlify(mpk)) return add_privkeys(seed, offset)# Accepts (seed or stretched seed or master pubkey), index and secondary index# (conventionally 0 for ordinary addresses, 1 for change) , returns pubkeydef electrum_pubkey(masterkey, n, for_change=0): if len(masterkey) == 32: mpk = electrum_mpk(electrum_stretch(masterkey)) elif len(masterkey) == 64: mpk = electrum_mpk(masterkey) else: mpk = masterkey bin_mpk = encode_pubkey(mpk, 'bin_electrum') offset = bin_dbl_sha256(from_int_representation_to_bytes(n)+b':'+from_int_representation_to_bytes(for_change)+b':'+bin_mpk) return add_pubkeys('04'+mpk, privtopub(offset))# seed/stretched seed/pubkey -> address (convenience method)def electrum_address(masterkey, n, for_change=0, version=0): return pubkey_to_address(electrum_pubkey(masterkey, n, for_change), version)# Given a master public key, a private key from that wallet and its index,# cracks the secret exponent which can be used to generate all other private# keys in the walletdef crack_electrum_wallet(mpk, pk, n, for_change=0): bin_mpk = encode_pubkey(mpk, 'bin_electrum') offset = dbl_sha256(str(n)+' Continue reading >>

Pybitcointools Examples

Pybitcointools Examples

I'm utilizing the pybitcointools module in python 3. I've went through pybitcointools and time again in the examples listed on the github page, but it isn't documented very well nor is the code. My situation is this: If someone examples create an example of the process while also documenting each step and explaining what each argument for pybitcointools function is for and how it's used. This would be an amazing help if someone pybitcointools give a hand here! I've searched far and low, but I just can't find a good documentation of this process. I'm sure this would help many others examples well! By posting your answer, examples agree pybitcointools the privacy policy and terms of service. Questions Tags Users Badges Unanswered. Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only pybitcointools a minute: Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top. Examples, signing, and pybitcointools a Bitcoin transaction by using pybitcointools with Python. Give me an hour and I'll write up an answer. You're right, pybitcointools code examples severely lacking in documentation. Check out this fork for some better code examples until i reply but examples it's not tested for pybitcointools. OK, so first off: Wizard Pybitcointools Ozzie 3, 15 What function are you using to easily get the values for utxos? What's the best way to go about it? In the examples block above you have there doesn't show you using pybitcointools but you explained it above. Pybitcointools still really, really confused because it seems like in the pybitcointools example pybitcointools do it in a completely different way. I'm trying to imagine how to do it from pybitcointools very b Continue reading >>

Bitcoin 1.1.41 : Python Package Index

Bitcoin 1.1.41 : Python Package Index

Make and publish a transaction all in a single command line instruction Includes non-bitcoin-specific conversion and JSON utilities Not a full node, has no idea what blocks are Relies on centralized service (blockchain.info) for blockchain operations, although operations do have backups (eligius, blockr.io) ### Example usage (best way to learn :) ): > from bitcoin import *> priv = sha256(some big long brainwallet password)> priv57c617d9b4e1f7af6ec97ca2ff57e94a28279a7eedd4d12a99fa11170e94f5a4> pub = privtopub(priv)> pub0420f34c2786b4bae593e22596631b025f3ff46e200fc1d4b52ef49bbdc2ed00b26c584b7e32523fb01be2294a1f8a5eb0cf71a203cc034ced46ea92a8df16c6e9> addr = pubtoaddr(pub)> addr1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6> h = history(addr)> h[{output: u97f7c7d8ac85e40c255f8a763b6cd9a68f3a94d2e93e8bfa08f977b92e55465e:0, value: 50000, address: u1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6}, {output: u4cc806bb04f730c445c60b3e0f4f44b54769a1c196ca37d8d4002135e4abd171:1, value: 50000, address: u1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6}]> outs = [{value: 90000, address: 16iw1MQ1sy1DtRPYw3ao1bCamoyBJtRB4t}]> tx = mktx(h,outs)> tx01000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f7970000000000ffffffff71d1abe4352100d4d837ca96c1a16947b5444f0f3e0bc645c430f704bb06c84c0100000000ffffffff01905f0100000000001976a9143ec6c3ed8dfc3ceabcc1cbdb0c5aef4e2d02873c88ac00000000> tx2 = sign(tx,0,priv)> tx201000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f797000000008b483045022100dd29d89a28451febb990fb1dafa21245b105140083ced315ebcdea187572b3990220713f2e554f384d29d7abfedf39f0eb92afba0ef46f374e49d43a728a0ff6046e01410420f34c2786b4bae593e22596631b025f3ff46e200fc1d4b52ef49bbdc2ed00b26c584b7e32523fb01be2294a1f8a5eb0cf71a203cc034ced46ea92a8df16c6e9ffffffff71d1abe4352100d4d837ca96c1a16947b5444f0 Continue reading >>

Deterministic Wallet Tools

Deterministic Wallet Tools

List of tools/services for working with Hierarchical Deterministic Wallets, aka hd-wallets aka bip32 wallets. Tools listed on this page can typically perform some form of key derivation and list hd-wallet addresses. Warning: You should never give an online service your master extended private key (xprv) as they could use it to drain your entire wallet. Even sharing an extended public key entails risks . If using an online hosted javascript tool, be careful to work with it offline only. 3.2 Risks of Sharing an Extended Public Key (xpub) bip32.org : A tool for displaying information derived from bip32 extended key, or nmenonic phrase. Appears to list only the first address. Mnemonic Code Converter : A tool for listing keys and addresses from a bip32 mnemonic phrase. The tool can be saved as a file and used without any internet connection. WebHDWallet : Implementing the Hierarchical Deterministic Wallet proposal BIP32, with the aim of creating easy to use, secure, and powerful tools for managing HD wallets and the funds within. mybitprices.info : A tool that can derive all used wallet addresses from an extended public key and can further lookup historic price information for all wallet transactions and create gain/loss reports. bitcore playground : Derive HD keys from a private or public extended key and a path. python-mnemonic : Reference implementation of BIP-0039: Mnemonic code for generating deterministic keys hd-wallet-derive : A command-line tool that derives bip32 addresses and private keys from bip32 extended keys or mnemonic. hd-wallet-addrs : A command-line tool for finding bitcoin hd-wallet addresses that have actually received funds, including change addresses. (note: key derivation occurs offline, but funds lookup requires internet connection.) pybitcointools Continue reading >>

Deterministic Wallets, Their Advantages And Their Understated Flaws

Deterministic Wallets, Their Advantages And Their Understated Flaws

Deterministic Wallets, Their Advantages and their Understated Flaws cIf you have been following the last year of progress in Bitcoin wallet development, you will have likely already heard of one of the latest trends in backend designbe: deterministic wallets. Unlike old-style Bitcoin wallets, which generate new Bitcoin addresses and private keys randomly as needed, in a deterministic wallet all of the data is generated using a specific algorithm from a single seed. That is to say, if you write down the seed to your deterministic wallet, and then after six months your hard drive gets corrupted and the wallet unrecoverable, you can simply create a new wallet using the same seed and all of the addresses and private keys from your old wallet will come back again exactly as they were before. This trend in wallet development has received near-universal praise, and nearly every Bitcoin client that intends to handle multiple addresses either already has a deterministic wallet implemented or is planning to create one. However, deterministic wallets in Bitcoin do not stop there. In fact, the latest deterministic wallets go beyond the simple design described above and have two key properties that are heavily advertised by their developers. The first of these properties is the concept of a master public key. A master public key is a key that can be generated from the wallets master private key (either the same thing as the seed or a derivative of it) that has the power to generate all of the addresses in a Bitcoin wallet, but none of the private keys. Thus, someone with access to a master public key can look at the balance of a deterministic wallet, but cannot actually spend the balance because they have no way of generating the private key corresponding to each address. The secon Continue reading >>

Pybitcointoolsbip32

Pybitcointoolsbip32

HD BIP32 HD<<>>BIP32: safe_from_hex16byte "1234"->b"\x12\x34" I = HMAC-SHA512Key =Bitcoin seedData = S def bip32_master_key(seed, vbytes=MAINNET_PRIVATE): I = hmac.new(from_string_to_bytes("Bitcoin seed"), seed, hashlib.sha512).digest() return bip32_serialize((vbytes, 0, b'\x00'*4, 0, I[32:], I[:32]+b'\x01')) Ihmac-sha512key"Bitcoin seed"data: b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" I[32:]IR I[:32]ILILbip32_serialize 4mainnet0x0488B21E public0x0488ADE4 private; testnet0x043587CF public0x04358394 private 4ixi = xpar / iser32ixi 0x00000000 33serPK0x00 || ser256k 32SHA-256Base58 b'\x00'*4pythonb'\x00\x00\x00\x00' def bip32_serialize(rawtuple): vbytes, depth, fingerprint, i, chaincode, key = rawtuple i = encode(i, 256, 4) keydata = b'\x00'+key[:-1] if vbytes in PRIVATE else key bindata = vbytes + from_int_to_byte(depth % 256) + fingerprint + i + chaincode + keydata return changebase(bindata+bin_dbl_sha256(bindata)[:4], 256, 58) i0 i = encode(i, 256, 4)0b'\x00\x00\x00\x00' def bip32_ckd(data, i): return bip32_serialize(raw_bip32_ckd(bip32_deserialize(data), i)) bip32_serializebip32_deserialize CKDprivkparcparikici I= HMAC-SHA512Key = cparData = 0x00 || ser256kpar|| ser32i 0x0033 I= HMAC-SHA512Key = cparData = serPpointkpar|| ser32i parse256ILnki = 0i 1/2127 def raw_bip32_ckd(rawtuple, i): vbytes, depth, fingerprint, oldi, chaincode, key = rawtuple i = int(i) if vbytes in PRIVATE: priv = key pub = privtopub(key) else: pub = key if i >= 2**31: if vbytes in PUBLIC: raise Exception("Can't do private derivation on public key!") I = hmac.new(chaincode, b'\x00'+priv[:32]+encode(i, 256, 4), hashlib.sha512).digest() else: I = hmac.new(chaincode, pub+encode(i, 256, 4), hashlib.sha512).digest() if vbytes in PRIVATE: newkey = add_privkeys(I[:32]+B'\x01', pri Continue reading >>

Vbuterin/pybitcointools Simple, Common-sense Bitcoin-themed Python Ecc Library By @vbuterin - Repository | Devhub.io

Vbuterin/pybitcointools Simple, Common-sense Bitcoin-themed Python Ecc Library By @vbuterin - Repository | Devhub.io

Make and publish a transaction all in a single command line instruction Includes non-bitcoin-specific conversion and JSON utilities Not a full node, has no idea what blocks are Relies on centralized service (blockchain.info) for blockchain operations, although operations do have backups (eligius, blockr.io) > from bitcoin import *> priv = sha256('some big long brainwallet password')> priv'57c617d9b4e1f7af6ec97ca2ff57e94a28279a7eedd4d12a99fa11170e94f5a4'> pub = privtopub(priv)> pub'0420f34c2786b4bae593e22596631b025f3ff46e200fc1d4b52ef49bbdc2ed00b26c584b7e32523fb01be2294a1f8a5eb0cf71a203cc034ced46ea92a8df16c6e9'> addr = pubtoaddr(pub)> addr'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'> h = history(addr)> h[{'output': u'97f7c7d8ac85e40c255f8a763b6cd9a68f3a94d2e93e8bfa08f977b92e55465e:0', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}, {'output': u'4cc806bb04f730c445c60b3e0f4f44b54769a1c196ca37d8d4002135e4abd171:1', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}]> outs = [{'value': 90000, 'address': '16iw1MQ1sy1DtRPYw3ao1bCamoyBJtRB4t'}]> tx = mktx(h,outs)> tx'01000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f7970000000000ffffffff71d1abe4352100d4d837ca96c1a16947b5444f0f3e0bc645c430f704bb06c84c0100000000ffffffff01905f0100000000001976a9143ec6c3ed8dfc3ceabcc1cbdb0c5aef4e2d02873c88ac00000000'> tx2 = sign(tx,0,priv)> tx2'01000000025e46552eb977f908fa8b3ee9d2943a8fa6d96c3b768a5f250ce485acd8c7f797000000008b483045022100dd29d89a28451febb990fb1dafa21245b105140083ced315ebcdea187572b3990220713f2e554f384d29d7abfedf39f0eb92afba0ef46f374e49d43a728a0ff6046e01410420f34c2786b4bae593e22596631b025f3ff46e200fc1d4b52ef49bbdc2ed00b26c584b7e32523fb01be2294a1f8a5eb0cf71a203cc034ced46ea92a8df16c6e9ffffffff71d1abe4352100d4d837ca96c1a16947b5444f0f3e0bc Continue reading >>

More in bitcoin