How to verify if a transaction is correctly signed?
Given an arbitrary signed raw transaction, how can we easily verify if all inputs are correctly signed (admiting all UTXOs are present and fee is higher than zero)? I know there is an RPC command in bitcoin core testmempoolaccept but this will also check if all inputs are available to be spent in the mempool/blockchain and I want to test a transaction that is a child to a parent transaction that has not yet been broadcasted. The signed transaction instance could have the scriptPubKey of the used utxos stored as metadata (since it needs to know these to sign each input) and use the stored utxos to perform this validation - alternatively, the verification method could ask for the scriptPubKeys of the utxos as input. I was looking for some nice way to do this in python but was surprised how neglected this task is:
Created a full node + Lightning node from scratch.
So i created a full node and a lightning node from scratch. Coming back to bitcoin after few years, i wanted to see what the lightning network was. So i changed my vps to a dedicated server (to add more storage) and started my journey. The first thing was to install the full node. there's some nice ressources to do that, but you have to find them. I started with https://bitcoin.org/en/full-node#other-linux-daemon but the cli instructions are almost non existent. I then found https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line which is great! Protip: you have to create a config file by yourself. I created a wallet and waited for the blockchain to finish downloading. Then i added a lightning node. I used lnd because i like the go language. The program is great but i found the user documentation lacking. https://gist.github.com/bretton/0b22a0503a9eba09df86a23f3d625c13 is a nice ressource, but you don't need to set an rpc user, lnd will use the cookie auth automagically if you're running as the same user as bitcoind (and provide bitcoind path probably..?). Protip: To create a qrcode with your lightning address you can use qrencode: lncli newaddress p2wkh qrencode -o address.png 'bitcoin:bc1youraddress...' Once everything looked to run smoothly i wanted to add funds to my lightning wallet. Protip: you can directly transfer fund to it. no need to transfer funds in your full node wallet (don't know why i did that..). I manually opened few channels with other nodes, but using the autopilot feature from lnd seems to work fine. Lastly, i wanted some sort of dashboard so i added https://github.com/djmelik/lndash because i'm fluent in python , the project is straightforward, read only, and good looking. You can check my node at https://ln.xec.sh/ If you have any questions or remark, don't hesitate. Hope it can help someone else.
Getting transaction based metrics from Bitcoin’s blockchain
I was wondering what software tools are used by people who get compile transaction and block data into metrics. For example, how does one go from running a node to being able to chart utxo dormancy? How is the data stored in a full node, and what are the best tools/setups for processing it from a data science perspective?
Monthly Nano News: December 2019 + Year Recap Special
This is what NANO has been up to lately. I don't think I lie if I say it has been quite an amazing year! See you soon and happy new year! Something nice is coming soon that I have been working on for a while, stay tuned..
The Factom protocol is a data-centric platform for Proof of Existence (PoE) and decentralized applications. Just as TCP / IP enables the WWW, the Factom Protocol enables countless applications to be built on top of it. Layer 2 Applications
FAT Protocol - A tokenization and smart contract platform on top of Factom that is cheaper and more flexible than any other such platform. Join the FAT Discord.
Token and Tokenomics Factom is a two token system. Only the Factoid (FCT) is transferable and able to be traded on exchanges. Entry Credits (EC) are obtained by burning FCT and are used to enter data into the Factom Protocol. Entry Credits are $.001 each and that price is fixed. Therefore, if FCT is worth $1.00 and you burn it, you receive 1,000 EC. If FCT is worth $10.00 each and you burn one, you receive 10,000 EC. The two token system allows for:
Companies and governments to effectively budget for entering data onto the Protocol based upon their estimated usage.
Subscription systems to be setup with 3rd parties where companies and governments don't have to hold cryptocurrency. FCT are still burned for EC by the 3rd party company and the subscriber is charged a small markup for the service.
[FOR HIRE] Python Software Engineer — 12 years of experience
[FOR HIRE] Python Software Engineer — 12 years of experience
[FOR HIRE] Python Software Engineer — 12 years of experience
Lastupdated2018-01-29 This post is a collaboration with the Bitcoin community to create a one-stop source for Lightning Network information. There are still questions in the FAQ that are unanswered, if you know the answer and can provide a source please do so!
Lightning Network White Paper - The protocol has changed since this original paper, but covers the mid-level mechanics of the Lightning Network with an emphasis on the smart contracts that make it trustless
If you can answer please PM me and include source if possible. Feel free to help keep these answers up to date and as brief but correct as possible
Is Lightning Bitcoin?
Yes. You pick a peer and after some setup, create a bitcoin transaction to fund the lightning channel; it’ll then take another transaction to close it and release your funds. You and your peer always hold a bitcoin transaction to get your funds whenever you want: just broadcast to the blockchain like normal. In other words, you and your peer create a shared account, and then use Lightning to securely negotiate who gets how much from that shared account, without waiting for the bitcoin blockchain.
Is the Lightning Network open source?
Yes, Lightning is open source. Anyone can review the code (in the same way as the bitcoin code)
Who owns and controls the Lightning Network?
Similar to the bitcoin network, no one will ever own or control the Lightning Network. The code is open source and free for anyone to download and review. Anyone can run a node and be part of the network.
I’ve heard that Lightning transactions are happening “off-chain”…Does that mean that my bitcoin will be removed from the blockchain?
No, your bitcoin will never leave the blockchain. Instead your bitcoin will be held in a multi-signature address as long as your channel stays open. When the channel is closed; the final transaction will be added to the blockchain. “Off-chain” is not a perfect term, but it is used due to the fact that the transfer of ownership is no longer reflected on the blockchain until the channel is closed.
Do I need a constant connection to run a lightning node?
Not necessarily, Example: A and B have a channel. 1 BTC each. A sends B 0.5 BTC. B sends back 0.25 BTC. Balance should be A = 0.75, B = 1.25. If A gets disconnected, B can publish the first Tx where the balance was A = 0.5 and B = 1.5. If the node B does in fact attempt to cheat by publishing an old state (such as the A=0.5 and B=1.5 state), this cheat can then be detected on-chain and used to steal the cheaters funds, i.e., A can see the closing transaction, notice it's an old one and grab all funds in the channel (A=2, B=0). The time that A has in order to react to the cheating counterparty is given by the CheckLockTimeVerify (CLTV) in the cheating transaction, which is adjustable. So if A foresees that it'll be able to check in about once every 24 hours it'll require that the CLTV is at least that large, if it's once a week then that's fine too. You definitely do not need to be online and watching the chain 24/7, just make sure to check in once in a while before the CLTV expires. Alternatively you can outsource the watch duties, in order to keep the CLTV timeouts low. This can be achieved both with trusted third parties or untrusted ones (watchtowers). In the case of a unilateral close, e.g., you just go offline and never come back, the other endpoint will have to wait for that timeout to expire to get its funds back. So peers might not accept channels with extremely high CLTV timeouts. -- Source
What Are Lightning’s Advantages?
Tiny payments are possible: since fees are proportional to the payment amount, you can pay a fraction of a cent; accounting is even done in thousandths of a satoshi. Payments are settled instantly: the money is sent in the time it takes to cross the network to your destination and back, typically a fraction of a second.
Does Lightning require Segregated Witness?
Yes, but not in theory. You could make a poorer lightning network without it, which has higher risks when establishing channels (you might have to wait a month if things go wrong!), has limited channel lifetime, longer minimum payment expiry times on each hop, is less efficient and has less robust outsourcing. The entire spec as written today assumes segregated witness, as it solves all these problems.
Can I Send Funds From Lightning to a Normal Bitcoin Address?
No, for now. For the first version of the protocol, if you wanted to send a normal bitcoin transaction using your channel, you have to close it, send the funds, then reopen the channel (3 transactions). In future versions, you and your peer would agree to spend out of your lightning channel funds just like a normal bitcoin payment, allowing you to use your lightning wallet like a normal bitcoin wallet.
Can I Make Money Running a Lightning Node?
Not really. Anyone can set up a node, and so it’s a race to the bottom on fees. In practice, we may see the network use a nominal fee and not change very much, which only provides an incremental incentive to route on a node you’re going to use yourself, and not enough to run one merely for fees. Having clients use criteria other than fees (e.g. randomness, diversity) in route selection will also help this.
What is the release date for Lightning on Mainnet?
Would there be any KYC/AML issues with certain nodes?
Nope, because there is no custody ever involved. It's just like forwarding packets. -- Source
What is the delay time for the recipient of a transaction receiving confirmation?
Furthermore, the Lightning Network scales not with the transaction throughput of the underlying blockchain, but with modern data processing and latency limits - payments can be made nearly as quickly as packets can be sent. -- Source
How does the lightning network prevent centralization?
How would the lightning network work between exchanges?
Each exchange will get to decide and need to implement the software into their system, but some ideas have been outlined here: Google Doc - Lightning Exchanges Note that by virtue of the usual benefits of cost-less, instantaneous transactions, lightning will make arbitrage between exchanges much more efficient and thus lead to consistent pricing across exchange that adopt it. -- Source
How do lightning nodes find other lightning nodes?
Does every user need to store the state of the complete Lightning Network?
According to Rusty's calculations we should be able to store 1 million nodes in about 100 MB, so that should work even for mobile phones. Beyond that we have some proposals ready to lighten the load on endpoints, but we'll cross that bridge when we get there. -- Source
Would I need to download the complete state every time I open the App and make a payment?
No you'd remember the information from the last time you started the app and only sync the differences. This is not yet implemented, but it shouldn't be too hard to get a preliminary protocol working if that turns out to be a problem. -- Source
What needs to happen for the Lightning Network to be deployed and what can I do as a user to help?
Lightning is based on participants in the network running lightning node software that enables them to interact with other nodes. This does not require being a full bitcoin node, but you will have to run "lnd", "eclair", or one of the other node softwares listed above. All lightning wallets have node software integrated into them, because that is necessary to create payment channels and conduct payments on the network, but you can also intentionally run lnd or similar for public benefit - e.g. you can hold open payment channels or channels with higher volume, than you need for your own transactions. You would be compensated in modest fees by those who transact across your node with multi-hop payments. -- Source
Is there anyway for someone who isn't a developer to meaningfully contribute?
Sure, you can help write up educational material. You can learn and read more about the tech at http://dev.lightning.community/resources. You can test the various desktop and mobile apps out there (Lightning Desktop, Zap, Eclair apps). -- Source
Do I need to be a miner to be a Lightning Network node?
Do I need to run a full Bitcoin node to run a lightning node?
lit doesn't depend on having your own full node -- it automatically connects to full nodes on the network. -- Source LND uses a light client mode, so it doesn't require a full node. The name of the light client it uses is called neutrino
How does the lightning network stop "Cheating" (Someone broadcasting an old transaction)?
Upon opening a channel, the two endpoints first agree on a reserve value, below which the channel balance may not drop. This is to make sure that both endpoints always have some skin in the game as rustyreddit puts it :-) For a cheat to become worth it, the opponent has to be absolutely sure that you cannot retaliate against him during the timeout. So he has to make sure you never ever get network connectivity during that time. Having someone else also watching for channel closures and notifying you, or releasing a canned retaliation, makes this even harder for the attacker. This is because if he misjudged you being truly offline you can retaliate by grabbing all of its funds. Spotty connections, DDoS, and similar will not provide the attacker the necessary guarantees to make cheating worthwhile. Any form of uncertainty about your online status acts as a deterrent to the other endpoint. -- Source
How many times would someone need to open and close their lightning channels?
You typically want to have more than one channel open at any given time for redundancy's sake. And we imagine open and close will probably be automated for the most part. In fact we already have a feature in LND called autopilot that can automatically open channels for a user. Frequency will depend whether the funds are needed on-chain or more useful on LN. -- Source
Will the lightning network reduce BTC Liquidity due to "locking-up" funds in channels?
When setting up a Lightning Network Node are fees set for the entire node, or each channel when opened?
You don't really set up a "node" in the sense that anyone with more than one channel can automatically be a node and route payments. Fees on LN can be set by the node, and can change dynamically on the network. -- Source
Can Lightning routing fees be changed dynamically, without closing channels?
Yes but it has to be implemented in the Lightning software being used. -- Source
How can you make sure that there will be routes with large enough balances to handle transactions?
You won't have to do anything. With autopilot enabled, it'll automatically open and close channels based on the availability of the network. -- Source
How does the Lightning Network stop flooding nodes (DDoS) with micro transactions? Is this even an issue?
Problems checking wallet, bitcoin core on another server
So my setup is that currently Bitcoin core is running on a Windows server, and joinmarket is a fresh install on debian. Bitcoin core is a full node, no pruning, fully synced. I had some problems opening up RPC but I think that part works now (no longer getting timeouts). But instead this happens:
[email protected]:/home/johan/joinmarket-0.2.3# python wallet-tool.py wallet.json 2019-08-22 12:12:57,613 [MainThread ] [INFO ] hello joinmarket 2019-08-22 12:12:57,613 [MainThread ] [INFO ] Joinmarket directory is: /home/johan/joinmarket-0.2.3 Enter wallet decryption passphrase: 2019-08-22 12:13:07,323 [MainThread ] [INFO ] requesting detailed wallet history from Bitcoin Core client Traceback (most recent call last): File "wallet-tool.py", line 126, in sync_wallet(wallet, fast=options.fastsync) File "/home/johan/joinmarket-0.2.3/joinmarket/blockchaininterface.py", line 79, in sync_wallet jm_single().bc_interface.sync_wallet(wallet) File "/home/johan/joinmarket-0.2.3/joinmarket/blockchaininterface.py", line 959, in sync_wallet super(BitcoinCoreInterface, self).sync_wallet(wallet) File "/home/johan/joinmarket-0.2.3/joinmarket/blockchaininterface.py", line 88, in sync_wallet self.sync_addresses(wallet) File "/home/johan/joinmarket-0.2.3/joinmarket/blockchaininterface.py", line 1065, in sync_addresses imported_addr_set = set(self.rpc('getaddressesbyaccount', [wallet_name])) File "/home/johan/joinmarket-0.2.3/joinmarket/blockchaininterface.py", line 935, in rpc res = self.jsonRpc.call(method, args) File "/home/johan/joinmarket-0.2.3/joinmarket/jsonrpc.py", line 117, in call raise JsonRpcError(response["error"]) joinmarket.jsonrpc.JsonRpcError [email protected]:/home/johan/joinmarket-0.2.3#
Disclaimer: Not my address. It's using the ["all"] x 12 BIP39 test-vector seed. So a while ago trezorctl used to have about a medium level of difficulty with installation on Windows due to ethash or rpc libraries. Long sense fixed. But I always wanted a self contained python trezor play-pen. Then I found the electrum console. Really NOT recommended even to the most advanced user, but I still thought it was amazingly cool since the whole Trezor API is up and running under the hoods. Here's a small example.
TaDa!!! As the warning suggests. Never plunk code someone gives you into the electrum console. Still thought it was pretty cool. Look at the Trezor test scripts for some good ideas of what to play around with.
A milestone, the current state, and the future of TipBit
A milesone It's officially been 72 hours without a single bug, which feels great but I have to keep reminding myself that it's mostly because of how small my test group is so far. The current state The insane rise of the value of Bitcoin over the last few days comes with a filling of the Bitcoin mempool which is really damaging to the bot in the sense that no one is going to want to do a deposit while fees are so high. Because of this, I don't expect a lot of new users for at least a week, and I won't be tipping around or talking too much about the bot until the mempool clears out. You can all feel free to keep tipping and introducing new people if you want, I'm certainly not going to stop that. On top of that, this would be a wonderful time for anyone with suggestions to offer them up, as I have some time to implement more features during this break from advertising the bot. The future of TipBit I lost my job in September. Had plenty of savings so I wasn't in a huge rush to find the first job I could, and so I had a lot of extra time on my hands. I had never developed in Python, had never written a reddit bot, and had never written any code that interacted with cryptocurrency, so this was an interesting project and I'm loving it so far. I plan to keep it running for the foreseeable future even though it nets me no profit and most likely never will. I like the idea of this just being a project I do to help the community grow and for everyone to be generous to each other. With that said, I've just accepted a job offer and will be starting in mid January most likely. Because of this, I'd like to ramp up feature work and bug testing as much as possible for the next month or so, so that when I start working the bot is in a good place to expand in use organically and not need a lot of my time to work on bugs or features. So please continue using the bot, test features if you have the time, suggest new ideas to me in here or PM me... etc. Thank you all for being a part of this.
Noobie Q: Falling over at Mastering Bitcoin’s first Python example...
I’ve seen others have had something similar but for the life of me I’m still stuck...at the first step in Mastering Bitcoin’s first Python example.. My setup - LND Raspberry PI connecting to it via Putty SSH (blockchain up to date and running fine, eg getblockchain info) I’ve installed python with: sudo apt-get install libssl-dev Process I followed - Once connected through SSH/Putty, I change to my “bitcoin” user Using nano, I create a “rpc_example.py” file following the code in the book Then back at the cli I run it with: “Python rpc_example.py” And I get this error below which shows its fallen over at the first line - import from bitcoin.rpc import RawProxy “No module named bitcoin.rpc” Confusion: I’m not sure if this is an access issue cos of the way I’m connecting or if I’m mixed up between JSON-RPC vs Cli or I’m not following/running things from the right location. Help please? or maybe I just need to first get a better grip on the fundamentals of Linux/python? Edit 6/1/18: Success. This group rocks. I wasn’t going to continue with Mastering Bitcoin if I didn’t get past that exercise - but thanks to you for all the timely advice and suggestions i now can. So much learning in the doing that’s for sure. You can see my finding-my-way-in-the-dark-experience (with the fantastic guidance by this group) in my comments below.
Here at RPC we often discuss "frame" and how to hold onto it in adverse situations. Throughout life your frame will be tested. Big time corporate job interview? More than likely the hiring manager will throw you fitness tests to see how you handle unexpected challenges. This is a test of frame. Approaching an attractive girl? She will almost assuredly begin testing your frame from the very start. Visiting the in-laws? Your overbearing mother-in-law might give you a bunch of crap in front of the family about your recent decision to buy a house in X neighborhood instead of Y with the "better" schools. You get the point. Fitness tests are a fact of life and passing these fitness tests is critical to your success as a man. But each of these examples pales in comparison to perhaps the most common fitness test of all: being unintentionally provoked by a stranger on the internet. As a mod I get to see things that get auto-moderated, which affords me a front row seat to some gems that the rest of you don't get to see. Sometimes a gem of such great value pops up and it just wouldn't be right for me to keep it to myself. Sharing is caring right? So here we see the turbo-masculine alpha-chad, u/FlyingBaratoplata's reinforced tissue-paper frame in action. Some key learnings can be taken from this: 1) When a stranger on the internet questions you, you need to fight back. The best way is to threaten physical violence. 2) Remind them that they and their ant-sized penis are out of reach of your python like guns. By asserting that if it weren't for a thin sheet of glass and anonymity you would perpetrate a felonious assault against them for daring to question you. 3) By informing them that they barely escaped your wrath, you remove 5 lbs from their 1 rep max on bench, 10 on deadlift. You aren't stronger for it, but you'll feel like you are and "feels is reals" for men who threaten strangers on the internet. 4) Call them something demeaning. Avoid racist or hateful language. You aren't a jerk after all and you want to seem magnanimous. Stick to things like, "champ" or "sport". The OP here missed by calling him "boy" because that implies he has testicles. You don't want to give any ground on that front because the only way to guarantee that yours are bigger is to ensure you don't admit that he has any. 5) Admit that you care. It's the only surefire way you can demonstrate that you don't. 6) Misdirect. Collateral damage is the name of the game (it worked in Dresden right?). If you can use your venting to take shots at another "passive aggressive disrespectful little cuck" poster, it's like killing two birds with one stone. Efficiency is important after all, you wouldn't want to wear out your keyboard. 7) Insult the precepts and jargon of the community you barged in on as "dumb buzzwords". It's the 49th law of power. 8) Point out that theoretical discussion is mere philosophical fart sniffing. You're above all that "thinking" and "considering" nonsense and it's important that you let everyone know it. 8.5) Fart jokes. 'nuff said. 9) Casually float your stellar credentials as a Biblical scholar by telling them to learn the Word. Don't bother to use any Word or verses in doing so, they might just learn some Word and if they did it would threaten your superiority. 10) Wrap up by making them appear childish. This always works. Even if you are posting like a 6 year old strung out on too many smarties after trick-or-treating, if you can make them out to be a 3 year old, you're still better than them. See? 10 easy steps to ensure that you don't lose frame when a stranger says something you don't like on the internet. You're welcome. I take tips in bitcoin.
Connection reset by peer while using python api to query local bitcoin node
I have a full bitcoin node running on my Mac. I am using python-bitcoinlib to run RPC calls to get familiar with data structures in bitcoin. I am able to run the commands successfully from python code but keep getting connection reset intermittently. I am wondering if it is because of some sort of limit on the inbound connections ?
The bot has been running for a year and a half now. In that time, the most important lesson I've learned is that although everyone said they wanted a tip bot, no one actually uses tip bots for Bitcoin anymore. Maybe it's because I couldn't eat the fee for the users... maybe it's because of the bear market... maybe it's because Bitcoin is losing steam against alt-coins. I don't really know what the reason is, but the truth is, no one is using my bot and it's difficult to find motivation to keep it going. The last true transaction was actually over a year ago, just after the bot was started. I learned a lot making this bot. I'm very proud that I learned Python and Bitcoin RPC interactions... I'll use the knowledge I gained in this project to make more things in the future, for sure. I probably could have advertised the bot's existence more, but to be honest I'm much more of a programmer than a businessman or marketer.
The bot is still around. I still have the code and of course the user data is backed up so there's no issue with balances, but I fubar'd up a config file today and I'd have to write some stuff up to fix it. It wouldn't take too long but since there's no real demand for the bot, I don't see the point and I'd like to work on other projects. I'm going to take the bot offline. It has a balance of about $160 on it from various user funds at the moment... not a lot, but still other people's money and I have no desire to keep it. In the coming days I'll send out a PM to all users with a balance, letting them know they can send me a withdrawal address and I'll send the funds to them. I'll even eat the fees for this withdrawal, so there's no loss to the user and they get their full balance. NOTE: If any user has not sent me their withdrawal address after 6 months, I'll send the remaining balance to the Bitcoin Developer fund. I will keep a note of the remaining user balances and if any user comes to me after that point, I'll pay them out of my own pocket. I'll probably put the bot back up when I get a new server, but that won't be for a few weeks. If you guys really want the bot back, obviously let me know and I'll consider bringing it back up, but it seems pretty clear that no one was using it. As always, I can answer any questions/comments/concerns below.
bitcoin-python-async-rpc. Lightweight Bitcoin async JSON-RPC Python client. Serves as a tiny layer between an application and a Bitcoin daemon, its primary usage is querying the current state of Bitcoin blockchain, network stats, transactions... The Bitcoin Wiki has a page with a detailed description of some ways to make a JSON-RPC call in various programming languages. For brevity, only two are listed. In Python: Running Bitcoin with the -server argument (or running bitcoind) tells it to function as a HTTP JSON-RPC server, but Basic access authentication must be used when communicating with it, and, for security, by default, the server only accepts connections from other processes on the same machine. If your HTTP or JSON library requires you to specify which 'realm' is authenticated, use 'jsonrpc'. Python interface to bitcoin's JSON-RPC API. Contribute to jgarzik/python-bitcoinrpc development by creating an account on GitHub. Bitcoin RPC from Python The reference bitcoin client includes a powerful API and RPC interface. In this post I show you how to call into this from Python (which is something that turns out to be almost trivially easy to set up).