As far as I know -walletnotify option runs user script when the daemon sees new transaction with one confirmation.
What is right way to receive InstantX transactions?
Please do! Really looking forward to it.I'll be open sourcing a python library I developed for the soda machine InstantX demo in Miami soon.
Today, it takes watching the p2p traffic and keeping track of the received messages.
There are plans to make this easier to use, but I'm hoping the library will act as a roadmap for developers and fill in the gap.
I'll post the technical details if anybody's interested, but the libraries readme will spell it out, once I've written it.
Awesome, thanks for all your help. It's been very useful in trying to understand how it all works together.nmarley there are no rpc commands to interrogate all mempool message types, which is why I built dashvend as a pseudo-node instead of extending dashd. I wanted dashvend to work with a vanilla installation.
The jsonrpc interface is for sending refunds (and determining the refund address) using the local wallet.
Let me know if you have any other questions, I'm happy to help.
dashp2p.forward(vend.get_listeners())
get_listeners maps handlers for these message types:
return ('tx', self.ix.recv_tx,
'ix', self.ix.recv_ix,
'txlvote', self.ix.recv_votes,
'block', self.recv_block)
self.ix.set_watch_address(self.current_address)
if self._find_payment(msg, txid, 'ix'):
self._check_ix_threshold(txid)
(in two places: ix and lock handlers, they can come out of order)
here's bit of code added to the processing overview, HTH.
During initialization, vend.py:
- configures dash_p2p.py to forward these message types (and 'tx's) to dash_ix.py
- configures dash_ix.py with the current payment address to monitorCode:dashp2p.forward(vend.get_listeners()) get_listeners maps handlers for these message types: return ('tx', self.ix.recv_tx, 'ix', self.ix.recv_ix, 'txlvote', self.ix.recv_votes, 'block', self.recv_block)
Code:self.ix.set_watch_address(self.current_address)
Messages forwarded to dash_ix.py:
- are checked against the current payment address
- are stored in a temporary mempoolCode:if self._find_payment(msg, txid, 'ix'):
- are counted until a configurable threshold of locks is met
Code:self._check_ix_threshold(txid) (in two places: ix and lock handlers, they can come out of order)
dashp2p = DashP2P(mainnet=MAINNET)
self.sock.connect((self.host, self.port))
self.sock.send(msg_version().to_bytes())
from bitcoin.messages import msg_version, msg_getdata, msg_pong, MsgSerializable
import dash
if msg.command == 'ping':
pong = msg_pong(nonce=msg.nonce)
self.sock.send(pong.to_bytes())
elif msg.command == 'inv':
for i in msg.inv:
# transaction/block/txlrequest/txlvote
if i.type in (1, 2, 4, 5):
gd = msg_getdata()
gd.inv.append(i)
self.sock.send(gd.to_bytes())
if msg.command in self.route:
self.route[msg.command](msg)
Here's the soda machine demo code, should be a good roadmap for developers to follow.
https://github.com/moocowmoo/dashvend
Let me know if you have any questions!
[
{
"account" : "",
"address" : "y16F4wy4fL9psQdCVNSZScfRXFC8DCXG29",
"category" : "receive",
"amount" : 1.00000000,
"vout" : 0,
"confirmations" : 5,
"bcconfirmations" : 0,
"txid" : "7557c69ccd21ba3e3d441efebe8e80e720658ccf936dd2b091157d2626327405",
"walletconflicts" : [
],
"time" : 1460143493,
"timereceived" : 1460143493
}
]
Thanks for sharing! I'm having trouble understanding the reason for checking the mempool in the Python code. It is my understanding that dashd will do this for you, and the result will show up in the 'confirmations' area of the transaction details.