Comments (4)
Notes on bitcoind RPC.
To lookup UTXOs on an address, you indeed need to importprivkey them and then listunspent.
This can take a long time, of course. However since we only need to do it once at the beginning before the bot connects to IRC, it not too much of a problem to have a long lookup sequence. I imagine the watch-only addresses feature of the new bitcoind is just a way of doing this without having to know the private key.
Using -txindex you can look up any txid and get a transaction back, using gettransaction or getrawtransaction. Very useful, for privacy too since the status quo involves leaking which addresses you're interested in to blockr.
Apparently getrawtransaction queries the mempool (unconfirmed tx) and the txindex.
You can use -blocknotify to be notified when a new block arrives, you get given the blockhash as an argument, which you can pass to getblock, that will give you a list of TXIDs which you can pass to gettransaction. In this way you can learn when a transaction has been confirmed.
A way to learn when a transaction is unconfirmed could be to importprivkey with rescan=false and then check with -walletnotify. According to this bitcointalk post we could use walletnotify for both unconfirmed and confirmed.
The gettxout call might be useful for finding unconfirmed transactions too, there is an option includemempool=true. Worth investigating.
from joinmarket.
Thanks for that.
Yes, watchonly means you don't need to import the privkey. Maybe that doesn't really matter.
As I was mentioning on IRC, we also need to check spent txos as well as utxos, at least at startup to check for used status. To do this I used the listtransactions RPC call applied to a separate 'watchonly' account, and then filtered the output by address. I don't think the indexes can help with that (?) - getting all transactions (not just utxos) on a per-address basis, if you don't have the txids?
You can use -blocknotify to be notified when a new block arrives, you get given the blockhash as an argument, which you can pass to getblock, that will give you a list of TXIDs which you can pass to gettransaction. In this way you can learn when a transaction has been confirmed.
Ah, this is cool, will read up on it. You can easily get unconfirmed utxos with listunspent, but for mainnet (rather than regtest), this blocknotify feature could be very important.
from joinmarket.
The watchonly thing will be useful so a copy of the private key isnt also floating around in someone's wallet.dat file ready to be stolen.
I think -walletnotify might end up being all we need. Since it notifies us for both unconfirmed and confirmed.
from joinmarket.
Done with d4fa387
from joinmarket.
Related Issues (20)
- Setup Docker
- Doublespending a sendpayment sweep, possible? HOT 7
- Install the script for me
- #joinmarket IRC tor relay HOT 1
- PGP pubkey key thread HOT 19
- No JSON object could be decoded HOT 5
- Failed to load wallet, error message: NameError("global name 'SegwitWallet' is not defined",) HOT 1
- twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running. HOT 3
- Off-chain joinmarket fees
- Darkscience IRC network connection info HOT 1
- Agora throttling due to "Flooding" HOT 2
- wallet-tool.py "Method not found" HOT 1
- Support cookie authentication for local node HOT 2
- Problems and payment in cryptrocurrency
- Metal coin
- sendpayment.py -N 1 -m 4 wallet.jmdat 55555 bc1_address always fails. HOT 4
- pastebin Telegram bot
- Create landing page and documentation website HOT 2
- GUI does not start after installation
- Recover not scanning enough internal addresses? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joinmarket.