Running Bitcoin: Tools, Apps and Guides SourceCrypto

The power of "import electrum" as a python bitcoin scripting engine

I've been a big fan of Electrum as a wallet for a while now. Traditionally, when I wanted to do bitcoin scripting I would use either trezorlib, pycoin, or bitcoinlib. But recently I was digging a bit deeper into the Electrum source and found it to be one of the simpler python libraries to use to craft bitcoin transactions.
One of the nicer things about Electrum as a scripting engine is that you can drop the standalone app or AppImage on a system and run your scripts directly through the console. This makes doing things on Tails or other locked down systems much easier. To run one one of your scripts (without the event loop) simply type (assuming you correct the file path):
with open(r"myscript.py", 'r') as s: exec(s.read())
Obviously only do this with scripts you've personally authored. Never run random code on your machine especially when wallet private keys are in play.
There are already some great scripting examples in the electrum\scripts folder, but most of these use the event loop which brings in a lot of overhead. I found simple TXN processing can easily be done without spawning an full electrum thread. I'd be happy to PR the samples if there is any interest in this style from the maintainers.
Here's two examples I put together that craft a BIP65 spending transaction. It turned out to be much simpler than I imagined. I did it both in bitcoinlib and electrum. The structure is very similar and should hopefully be easier to follow. Feel free to start a PythonRoastMe on it.
Two things of note. I had to disable R-value grinding (nuked while loop) so that I had parity with bitcoinlib, which hasn't rolled it out yet. This is why the TXIDs differ. I also had to override the the PartialTransaction.get_preimage_script method since it makes certain multisig assumptions that don't apply to generic scripting.
Reference: * Electrum script to spend an OP_HODL P2WSH address (txid 3a461e6...78de2b6) * Electrum script to spend an OP_HODL P2SH address (txid a8110bb...3dadc93) * BitcoinLib script to spend an OP_HODL P2WSH address (txid 3a461e6...78de2b6) * BitcoinLib script to spend an OP_HODL P2SH address (txid a8110bb...3dadc93) * TXID 3a461e6...78de2b6 (P2WSH) on the blockchain * TXID a8110bb...3dadc93 (P2SH) on the blockchain * BIP-0065: OP_CHECKLOCKTIMEVERIFY (aka OP_HODL) * BIP-0141: P2WSH symantics * BIP-0016: P2SH symantics
submitted by brianddk to Electrum [link] [comments]

Weird behavior when scripting electrum's ECPrivkey(...).sign_transaction(...)

Update

Nevermind... Electrum is performing low-value R-grinding and bitcoinlib and CoinBin are not. For anyone interested, the grinding code his here. Nuking the while look makes the sigs the same.
A few days ago I used bitcoinlib to create a OP_CLTV transaction. Tonight I did the same with Electrum 4.0.4 via python and my sigs don't match.
The TXN I'm trying to match is:
The TXN has the following characteristics:
When I try signing the sighash (pre-image hash) using both bitcoinlib and Electrum 4.0.4, I get different results. I coded the TXN through another wallet as well (CoinBin), and bitcoinlib seems to be producing the proper signature, but Electrum's seems off.
I'm sure there is something simple I'm missing, but I can't figure it out.
Here's a test script to illustrate the differences:
``` from bitcoin.core.key import use_libsecp256k1_for_signing from bitcoin.core import x, b2x from bitcoin.wallet import CBitcoinSecret from electrum.ecc import ECPrivkey from electrum.bitcoin import EncodeBase58Check
use_libsecp256k1_for_signing(True) sechex = '535b755a4c265772c4f6c7e0316bfd21e24c9e47441989e14e8133c7cb2f41a3' hashhex = '9039c54c1c34aa12b69b4dda962f501bb6c9cdb6745014ef326f5d4d0472aa99' seckey = CBitcoinSecret.from_secret_bytes(x(sechex)) sig = seckey.sign(x(hashhex)) b_wif = str(seckey) b_pub = b2x(seckey.pub) b_sig = b2x(sig) seckey = ECPrivkey(x(sechex)) sig = seckey.sign_transaction(x(hashhex)) e_wif = EncodeBase58Check(b'\x80' + seckey.get_secret_bytes() + b'\x01') e_pub = seckey.get_public_key_hex(compressed=True) e_sig = b2x(sig) assert b_wif == e_wif assert b_pub == e_pub print("wif:", b_wif) print("pub:", b_pub) print("sighash:", hashhex) print("bitcoinlib sig:", b_sig) print("electrum sig: ", e_sig) 
```
The resultant sigs are:
Thoughts?
submitted by brianddk to Electrum [link] [comments]

Trezor Troubleshooting Guide

I've noticed some redundancy in some of the issues raised on this subreddit, thought I'd start a generic troubleshooting thread of what I've found useful. I'd appreciate any suggestions mods or other experts might have.

I - Prerequisite

  1. Read the FAQ
  2. Read the Users manual
  3. Read the Developers guide
  4. Search the Wiki
  5. Try the trezor Troubleshooter

II - Trezor connectivity / stuck spinning circle

  1. Try different cable / USB port / computer
  2. Try without crappy Antivirus software.
  3. Manually add the bootloader registry value just to be paranoid.
  4. Install WinUSB driver with Zadig.
  5. Try disabling browser extensions / ad-blockers.
  6. Try Chrome Guest Mode (easiest way to disable extensions)
  7. Try different browser (Chrome / Chromium / Firefox / Brave)
  8. Try WebUSB
  9. Try Android
  10. Try VirtualBox
  11. Try old-wallet.trezor.io
  12. Try beta-wallet.trezor.io
  13. Try beta-wallet.trezor.io/next

III - Updated FW, coins are gone

  1. Try Legacy Account section.
  2. Did you use the right seed?
  3. Did you use the right passphrase?
  4. Did you enter the recover seed words in the order the Trezor asked you to (hint: not first to last)?
  5. Did you verify that your recovery seed words are in the word list?
  6. Did you check all accounts (click add account) for transactions, or check all MEW ETH accounts (next page) as well?
  7. Did you check your transaction history (Legacy and Segwit) to see if anyone moved coins while you were dormant?
  8. Did you regularly do a dry-run recover to verify that you actually possess the recovery seed that the Trezor is operating with?
  9. Check to see if your brother-in-law found your seed and stole your coins.
  10. Check to see if the digital copy of your seed was hacked.

IV - Can't / Don't want to update FW.

  1. Try performing a dry-run to ensure you have the right seed.
  2. Say a prayer and hope you have the right passphrase.
  3. Use an old version of Electrum / MyCrypto / MEW to see if you can find TXN history.
  4. Use an old version of Electrum / MyCrypto / MEW to move most funds.
  5. Use an old version of trezorctl to move the other funds.
  6. Buy a second Trezor and update that.

V - I'm new to this, How should I backup my seed / passphrase.

  1. Make it simple, your kids / kin may be the ones doing the recovery.
  2. Make it secure in a lockbox or safe or something reasonable.
  3. Make it accessible in case there is market volatility.
  4. Make it resilient and redundant in case there is a fire / zombie apocalypse.
  5. Don't make it digital, hackers are smarter than you are.

VI - I forgot my PIN now I can't access my device

  1. Say a prayer and hope you have the right seed.
  2. Say a prayer and hope you have the right passphrase.
  3. Wipe your device then recover with the seed / passphrase to reset PIN.
  4. Don't forget again.

VII - I forgot my seed / passphrase, what now

  1. Nothing, you effectively put physical currency in an incinerator, no getting it back.
  2. Realize that you've learned a valuable lesson that will serve you well in the future.
  3. Advocate to others the importance of following section [V] above.

VIII - I want support for CrappyForkCoin and I want it now!

  1. Figure out what the fork_id is for CrappyForkCoin and write your own coin JSON file.
  2. Use your JSON file to compile your own CrappyForkCoin trezor FW.
  3. Flash your CrappyForkCoin trezor FW to your personal trezor.
  4. Use trezorctl to make CrappyForkCoin transactions.
  5. Read the wiki on how to add coins just to make sure.
submitted by brianddk to TREZOR [link] [comments]

A guide to sign a super bitcoin (SBTC) transaction offline with patched Electrum for paranoid. Supports any wallets supported by Electrum (including segwit-p2sh and bech32 and all BIP39 seeds). Later BCD will be added.

This is quite advanced. This guide assumes you have some basic experience with the command line, can run Linux and you understand the basics of keys/signing/broadcasting transactions. And that you can compile and run Bitcoin Core and run Electrum. Also, some JSON experience is also nice.
Move you bitcoins to safe addresses first. It is best to use a new seed. Although the procedure in this guide is safe even for hot addresses (containing bitcoins), there is always a risk of a critical mistake. So play it safe.
Why such a guide? I followed these steps because I did not want to expose the keys to any online machine at all. Even if the keys do not have any bitcoins, you can some day have bitcoins sent to these addresses or you have a fork that you have not claimed. All can be stolen if you exposed your key.
This procedure should work with everything that Electrum supports (except maybe F2A that may be not supported on the SBTC chain), so Electrum seed legacy or segwit, LedgeTrezor with legacy or segiwt-p2sh (m/'49) derivation. Similarly, any BIP39 seeds or a single key. are also fine.
  1. Download Electrum. git clone https://github.com/spesmilo/electrum
  2. Apply my patch patch -P0 also this article. The guide assumes that you use patched Electrum from now on.
  3. Run the patched Electrum and catch up with your wallets you want to claim (the wallets can and rather should be watch only, or on ledgetrezor, otherwise your keys are exposed). Now go offline or set localhost as your server that Electrum connects to so no connection is performed. It's required so Electrum will not update the wallet after you edit it.
  4. You can manually create a transaction from the command line but you can use Electrum GUI. You need to locate the wallet file and remove all the transactions from the wallet file except for the one that funds the address you want to claim (the wallet obviously must not be encrypted but for watch-only this is OK). This is tricky. You need to make sure, you gave a proper JSON file, so all the final commas must be dropped. So "addr_history":, "transactions": , "tx_fees":, "txi", "txo", and "verified_tx3": should only contain the funding transaction(s), i.e. the one that you want to spend from.
  5. Run Electrum and check if the wallet is OK. Electrum will show an error if not. You will probably make a few errors so go back to editing the wallet.
  6. Download SBTC bitcoin core clone. git clone https://github.com/superbitcoin/SuperBitcoin
  7. Compile it and let it sync the blockchain (it will take a long time). Run it it with as large -dbcache= as you can. If you have a Bitcoin blockchain you can copy the blocks up to the fork date and issue sbtcd with -reindex. It will just reindex them and it will be faster.
  8. Generate a sbtc address with sbtc-cli getnewaddress. You can skip this step and send directly to an exchange but this intermediate step is safer.
  9. Create a transaction in Electrum to this address. Select all the bitcoins and use as small fee as possible (SBTC blocks are empty so any fee above 1 SBTCsat/byte should be OK).
  10. Save the transaction to a pendrive
  11. Download and install Kubuntu 16.04 (Kubuntu has all the QT libraries for Electrum) on a pen drive.
  12. Copy patched Electrum and the save the transaction to a pen drive (separate from Kubuntu will be more convenient).
  13. Run Kubuntu from the USB without any network access. Run Electrum from the pendrive. Create a wallet from the seed or private keys. The wallets are stored in RAM so after you reboot the computer, they will be gone. Load the transaction, sign it and save it to the pen drive.
  14. Go back to the SBTC Core on the online machine. Display the raw transaction (starts with the hex=). Check in the SBTC Core if it is correct sbtc-cli decoderawtransaction hex
  15. If it looks fine (and your blockchain got synced), broadcast it sbtc-cli sendrawtransaction hex
If there is no error, congratulations, you sent the transaction to the specified address. If it is to your SBTC Core wallet, wait until it confirms and send it further with sbtc-cli setfee feeperkb sbtc-cli sendtoaddress "addr" value "" "" true true
I'm going to update this guide when I figure out the BCD transactions intrinsics. You can download and run the BitcoinDiamond Core clone in the meantime.
SBTC tips: 1KjuY8CTrwMhdLt3uF3hCcSgfkHMyo1ELf
submitted by PVmining to BitcoinAirdrops [link] [comments]

Recover ancient Bitcoins from a formatted drive

Hi! Back in around 2011, I THINK I had 3 bitcoins. I used electrum wallet. It was a ubuntu system whether formatted in ext3 or ext4. I didnt see a value back then in bitcoin, so I just formatted my drive at some point without backing them up. The good thing is, that I did not use this computer a lot back then, so I hope I didnt write too much on the new install, and the data is maybe still intact.
The harddisk is at my parents house, who I am going to visit for the holidays now.
The first thing I am going to do is to "dd" the drive to my harddisk, so I have it backed up and can play around a bit.
I already found this file, regarding how electrum could have saved the file back then: https://github.com/spesmilo/electrum/blob/0.61b/lib/wallet.py#L618
I do not know, if my wallet had a password. If it had one, I can most probably guess it; though the main problem will be finding the file.
Do you have some advices how I should continue searching for the file? My guess was to maybe first use "strings" on the .img file that I will make and look for eg. "seed", "fee", "seed-version".
How would you approach this? Thanks for your help!
submitted by roxxor91 to BitcoinWallet [link] [comments]

Recover ancient bitcoins

Hi!
Back in around 2011, I THINK I had 3 bitcoins. I used electrum wallet. It was a ubuntu system whether formatted in ext3 or ext4. I didnt see a value back then in bitcoin, so I just formatted my drive at some point without backing them up.
The good thing is, that I did not use this computer a lot back then, so I hope I didnt write too much on the new install, and the data is maybe still intact.
The harddisk is at my parents house, who I am going to visit for the holidays now.
The first thing I am going to do is to "dd" the drive to my harddisk, so I have it backed up and can play around a bit.
I already found this file, regarding how electrum could have saved the file back then: https://github.com/spesmilo/electrum/blob/0.61b/lib/wallet.py#L618
I do not know, if my wallet had a password. If it had one, I can most probably guess it; though the main problem will be finding the file.
Do you have some advices how I should continue searching for the file? My guess was to maybe first use "strings" on the .img file that I will make and look for eg. "seed", "fee", "seed-version".
Also, photorec looks like a good tool, unfortunately it doesnt have electrum wallet in the supported files. Is there a possibility I can add this?
How would you approach this? Thanks for your help!
submitted by roxxor91 to datarecovery [link] [comments]

Subreddit Stats: Bitcoin top posts from 2013-03-11 to 2013-04-09 21:12 PDT

Submissions % Comments %
Total 998 56732
Unique Redditors 690 7237
Upvotes 141099 82% 303585 79%
Downvotes 29766 18% 77626 21%

Top Submitters' Top Submissions

  1. 4232 pts, 48 submissions: waspoza
    1. Bitcoin ATM Founder: We Already Have Orders From 30+ Countries (304 pts, 59 comments)
    2. Al Gore at PYMNTS Innovation Project 2013: "I'm a big fan of BitCoin." (298 pts, 194 comments)
    3. Bitcoin rises - Opinion - Al Jazeera English (252 pts, 55 comments)
    4. Bitcoin May Be the Global Economy's Last Safe Haven (211 pts, 65 comments)
    5. Digital 'bitcoin' currency surpasses 20 national currencies in value (184 pts, 43 comments)
    6. Bitcoin's Bottom Billion - Why the Developing World May Be Bitcoin's Biggest Customer (165 pts, 52 comments)
    7. Everything no one wants me to say about Bitcoin | Ben Milne (151 pts, 41 comments)
    8. Bitcoin on Bloomberg (138 pts, 21 comments)
    9. Bitcoins are About to Reinvent Banking in Africa | ICT Works (115 pts, 23 comments)
    10. WALL STREET CURRENCY ANALYST: One Hour Ago, I Had My First Client Ask About Bitcoin (113 pts, 49 comments)
  2. 1731 pts, 8 submissions: Julian702
    1. Cartoon: Control of Bitcoin (1143 pts, 164 comments)
    2. Time to renew Reddit Gold. So freakin easy to pay with Bitcoin. Thanks again Reddit! (114 pts, 7 comments)
    3. First Insurance Company to Accept Bitcoin (109 pts, 12 comments)
    4. Erik Voorhees and American Banker's Marc Hochstein discuss Bitcoin on Brian Lehrer. (91 pts, 19 comments)
    5. Electrum 1.7 released - New features include plugins, multisig transactions, console, and Armory style offline transactions. (82 pts, 44 comments)
    6. We finally have you in our sights! (75 pts, 39 comments)
    7. Bitcoin is near perfect money (60 pts, 34 comments)
    8. BitcoinWay.com - Accept Bitcoin Payments. No payment fees. No transaction fees. No middlemen fees. (57 pts, 13 comments)
  3. 1679 pts, 5 submissions: DanielTaylor
    1. For the love of Bitcoin, Stop mining at BTC Guild! - They'll control the network if they reach +50% (999 pts, 340 comments)
    2. Merchants are the real Bitcoin "stars" an of utmost importance (277 pts, 120 comments)
    3. Now that it's over: The blockchain FORK explained for regular users. ELI5 Style! (212 pts, 95 comments)
    4. Important: Bitcoin users must decide on a new Transaction Fee (145 pts, 200 comments)
    5. If you're selling during a LAG phase, you're falling right into the shark's trap. (46 pts, 22 comments)
  4. 1550 pts, 1 submissions: rbitcoin-bot
    1. I'm /Bitcoin's new AutoModerator bot (1550 pts, 123 comments)
  5. 1533 pts, 1 submissions: tuzki
    1. My wife said this to me today (1533 pts, 318 comments)

Top Commenters

  1. Anenome5 (1793 pts, 497 comments)
  2. bitcointip (1647 pts, 475 comments)
  3. GSpotAssassin (1579 pts, 237 comments)
  4. Amanojack (1532 pts, 299 comments)
  5. Julian702 (1198 pts, 158 comments)
  6. throwaway-o (1146 pts, 341 comments)
  7. hardleft121 (1097 pts, 158 comments)
  8. snakemcgraw (969 pts, 122 comments)
  9. ferroh (925 pts, 190 comments)
  10. w0ss4g3 (918 pts, 134 comments)

Top Submissions

  1. I'm /Bitcoin's new AutoModerator bot by rbitcoin-bot (1550 pts, 123 comments)
  2. My wife said this to me today by tuzki (1533 pts, 318 comments)
  3. Cartoon: Control of Bitcoin by Julian702 (1143 pts, 164 comments)
  4. For the love of Bitcoin, Stop mining at BTC Guild! - They'll control the network if they reach +50% by DanielTaylor (999 pts, 340 comments)
  5. Hey, /Bitcoin, you're Subreddit of the Day! Congrats! by XavierMendel (974 pts, 148 comments)

Top Comments

  1. 305 pts: love_eggs_and_bacon's comment in Today I'm a millionaire
  2. 292 pts: GSpotAssassin's comment in I just got robbed blind of bitcoins - in person. I'm feeling like I've lost trust in the usability of the currency and looking for advice.
  3. 260 pts: DanielTaylor's comment in For the love of Bitcoin, Stop mining at BTC Guild! - They'll control the network if they reach +50%
  4. 237 pts: Splep's comment in ONE HUNDRED DOLLARS! (1/4/13 @ 1506 GMT)
  5. 237 pts: zoechace's comment in Today I'm a millionaire
Generated with BBoe's Subreddit Stats SRS Marker: 1365567156.0
submitted by phloating_man to phloatingman [link] [comments]

OKLMofficial - YouTube 3rd Jan BTC Chart Update / Visual Map Of The Current Lightning Network / List Of Segwit Wallets Hardware Wallet vs Malware. Demo of Electrum Phishing & Clipboard Malware (Trezor, Ledger, Keepkey)

A Bitcoin ATM is a kiosk that allows a person to purchase Bitcoin by using cash or debit card. Some Bitcoin ATMs offer bi-directional functionality enabling both the purchase of Bitcoin as well as the sale of Bitcoin for cash. In some cases, Bitcoin ATM providers require user… Bitcoin ATM Map – Find Bitcoin ATM, Online Rates The value of your fork coins are currently worth just over $500k. I can't comment on the code quality of those Electrum forks but I had a quick look and they appear to be genuine. I'd say it's worth the risk considering the situation. Care to explain? I thought that Bitcoin SV was a fork from Bitcoin Cash. You can still claim the coins with ... The value of the first bitcoin transactions were negotiated by individuals on the bitcoin forum with one notable transaction of 10,000 BTC used to indirectly purchase two pizzas delivered by Papa John's. This was the only major security flaw found and exploited in bitcoin's history. Based on bitcoin's open source code, other cryptocurrencies started to emerge. On June 13th, 2011 the first ... Patches exist for Bitcoin Core to support TBC (for example, Luke Dashjr's TBC patch for Bitcoin Core master). Spesmilo, despite its name, could be configured to display TBC. However, it is no longer maintained and does not work with recent versions of Bitcoin Core. Guessing TBC or BTC. Given variable 'value' in base units (uBTCents/TBCᵇ), one can guess whether it is properly Decimal Bitcoin ... Do not store large amounts of value in single signature wallets. Make sure your heirs know how to recover your wallets without you! Note that it is NOT recommended that novices use the Bitcoin Core wallet. If you want to use a wallet backed by a fully validating node you run, read Securing Your Financial Sovereignty. Choose your wallet here - bitcoin.org Choose your wallet here ...

[index] [51405] [6833] [11499] [1476] [23685] [18428] [22301] [27071] [10970] [4615]

OKLMofficial - YouTube

If you are new to Crypto, my suggestion is that you start with buying ~$150 worth of Bitcoin, Ethereum, Litecoin @ Coinbase and get familiar with storing it, moving it around, etc. Coinbase: Brian Armstrong, Bitcoin, Cryptocurrency and More, BTC Price Prediction stay home BLABLATOYS - ΠΑΠΑΔΟΠΟΥΛΟΣ ΣΩΤΗΡΗΣ 3,133 watching Live now This video is unavailable. Watch Queue Queue. Watch Queue Queue For tutoring please call 856.777.0840 I am a registered nurse who helps nursing students pass their NCLEX. I have been a nurse since 1997. I have worked in a lot of nursing fields and I truly love ... Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

#