xpub | POSIX Shell script to get | Script Programming library
kandi X-RAY | xpub Summary
kandi X-RAY | xpub Summary
POSIX Shell script to get user's display environment variables of any TTY from anywhere.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xpub
xpub Key Features
xpub Examples and Code Snippets
Community Discussions
Trending Discussions on xpub
QUESTION
Trying to set up selenium 4 grid with the below docker-compose file but getting the "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure" error and need some help to fix the same.
docker-compose file:
...ANSWER
Answered 2021-Oct-19 at 07:56As per this issue, the support is not there for M1 architecture yet and until they provide it, the issue will occur.
QUESTION
I checked Swan's Address Derivation Library https://github.com/swan-bitcoin/xpub-tool.
I try to get m44
address, but I got m84
. Why? Do you know is it any parameter to force return m44
? I tried to pass path: "m/44'/0'/0'/0",
but it did not help.
Do you have any idea?
...ANSWER
Answered 2021-Feb-28 at 12:12From official docs
Address derivation will default to bech32 (native SegWit) unless a different purpose is specified. For example: to derive wrapped SegWit addresses (starting with 3...) specify the appropriate purpose with purpose: Purpose.P2SH.
So, to get m44
you need to set purpose:Purpose.P2PKH
Sample
QUESTION
My use case:
- The Subscriber will be a server(bind to a port) and it will wait messages from multiple publishers.
- The Publishers will be initialized inside different threads as clients(connect to the port).
- The data to publish in each thread will be a couple of messages.
- It is important when subscriber is connected, to get every message and as soon as possible.
- If subscriber is not connected then I don't want to keep the publisher thread blocked, ideally having a timeout around 1-2s it works.
The slow joiner problem:
Running more than 1000 threads(publishers) only 1 or 2 times I get all the data in Subscriber. Adding a sleep for some milliseconds solves the issue, so I'm 99.9% sure that I'm victim of the well-known slow joiner syndrome. However sleep solution in my case is not a good solution as connect time for publisher can be variable and I want the data to subscriber as soon as possible.
My thoughts and experiment code on solving this issue:
My solution is based on using XPUB recv method. Initialize publisher with XPUB and set RCVTIMEO to 1000ms. After publisher connection, I add a recv()
call for checking if there is a subscriber. When I get the subscribe message, I know that connection has been finalized and that I can send data without any of them being lost (except if something wrong happen to subscriber but I don't care).
In case that I don't get any subscribe message then in 1000ms recv()
times out and the thread is terminated.
Here is a sample code in python(pyzmq) to test this implementation (for publisher I don't use threads but a while loop and running multiple publishers at the same time) and it works as I wanted to:
publisher.py:
...ANSWER
Answered 2021-Jan-07 at 00:08Q : "Is the solution that simple?"
The very contrary. For what was posted above, the solution is over-complicated w.r.t. the so far posted use-case requirements.
a) Given the requirements above, it is possible to eliminate all the costs associated with the setup & maintenance of the ISO-OSI-L3 tcp://
Transport Class, when communicating among threads co-located on the same host belonging to the same process. Rather go in for the ultra-fast, stack-less, memory-mapped inproc://
Transport Class to avoid all of these inefficiencies. ZeroMQ API v4.0+ have also the comfort of no other conditions on setting up the inproc://
-TransportClass { .bind() | .connect() }
-order of appearance, so we may enjoy the utmost MEM-mapped ultra-low latency flagging of Zero-Copy "transported" messages (without moving a byte of in-RAM data) - cool, isn't it? ( unless you need a MITM protocol-sniffing to be injected, remove the tcp://
overkill )
b) Given the requirements above, a delivery of a couple of messages, where the "static" SUB
-side subscribes to all of them, is enormously inefficient use of the PUB/SUB
Scalable Formal Communications Pattern Archetype. Your code has to pay all costs to setup a new SUB
-instance, then it crawls to setup a valid connection (over the tcp://
-TransportClass' stack, hopefully removed under a) ), next wrangling to setup a new TOPIC-filter (be it operated on the SUB-side in earlier versions or on the PUB-side in the newer ZeroMQ releases -- all at remarkable costs of doing so just to receive all messages -- i.e. no filtering at all). The same formal service is achievable with a way more lightweight many-nodes-PUSH/PULL
-on-one-node. If there is no other need for any reverse / bi-directional / more complex formal communications, this just one PUSH/PULL
will be able to do the job requested.
c) Given the requirements above, your accent seems to have been put on not losing messages by prematurely sending them over the connection. There are tools for ascertaining that in ZeroMQ settings, yet you take no care to use them:
- using
zmq.IMMEDIATE
may use the blocking state of an AccessNode in cases no ready-made connection is working yet (or ever) - using return codes &
errno
( orzmq.errno()
for POSIX-incompatible operating systems / Win32 and likes ) handling may help your code to detect & to react to any and all specific situations that happen in "network-of-autonomous-agents" throughout the whole span of its lifecycle in the distributed-computing ( no matter if the agents are indeed actually "physically" distributed or co-located, as is the case here ). Not losing the control is the core responsibility here. What is a control-code, that self-locks in a lost-control state, where it cannot control even itself ;) ?
d) Never use a blocking form of the { .recv() | .send() | .poll() | ... }
-methods. Schoolbook examples are rather anti-patterns of how a professional signaling/messaging metaplane implementation ought look like. Indeed never - ref. item 5) above.
e) Better re-use a Context()
-instance, instead of making it a consumable/disposable as was sketched above. Threads can freely share a pre-instantiated Context()
-engine, avoiding next huge amounts of repetitive add-on overhead costs, if re-instantiating a consumable/disposable Context()
per each forked, just a short-lived, peer client thread.
f) If anybody knows a better solution, keep us posted :o)
Questions from commentsa)
Subscriber will be on another machine, so I thinktcp://
is the solution.*
Sure, NP here. { pgm:// | epgm:// | tipc:// }
-transports might be interesting here if going further into higher performance levels direction
b)
Subscriber is going to forward via anXPUB
socket the messages to other subscribers.PUSH/PULL
could work but if I want to pass those subscriptions and their filters to the initial publishers and filter some messages at the source, I have to usePUB/SUB
pattern.
Well, not mentioned in the O/P. Any layering of XPUB
s/XSUB
s may work well, the problems are on connection-management level
c)
Just to clarify, not losing messages is important only when there is a subscriber. Could you explain this part a little more?
Sure, having no subscriber available on an RTO-connected link, ready for an immediate delivery "across the wire", no messages could be ever delivered ( and could be silently dropped, which is what you try to fight against, don't you? ). That is what zmq.IMMEDIATE
can manage via a call to a .setsockopt()
-method.
QUESTION
I have an XPUB/XSUB device and a number of mock publishers running in one process. In a separate process, I want to connect a subscriber and print received message to the terminal. Below I will show two variants of a simple function to do just that. I have these functions wrapped as command-line utilities.
My problem is that the asyncio variant never receives messages.
On the other hand, the non-async variant works just fine. I have tested all cases for ipc and tcp transports. The publishing process never changes in my tests, except when I restart it to change transport. The messages are short strings and published roughly once per second, so we're not looking at performance problem.
The subscriber program sits indefinitely at the line msg = await sock.receive_multipart()
. In the XPUB/XSUB device I have instrumentation that shows the forwarding of the sock.setsockopt(zmq.SUBSCRIBE, channel.encode())
message, same as when the non-async variant connects.
The asyncio variant (not working, as described)
...ANSWER
Answered 2020-Oct-05 at 17:08A working async variant is
QUESTION
According to the ZMQ guide, when using a standard pub-sub pattern, if there are no connected clients the publisher does not publish any messages.
If a publisher has no connected subscribers, then it will simply drop all messages.
However, what happens if you are using an extended pub-sub pattern i.e. the publishers and subscribers are mediated by zmq_proxy with an xsub and xpub socket? It's difficult to infer what happens in this scenario if there are no subscribers. My assumption would be that the xsub socket acts as a subscriber and that all publishers would continue publishing irrespective of whether there were any actual subscribers connected to the proxy. But that is little more than an educated guess. Furthermore it's quite difficult to experimentally verify what happens in such a case - I imagine I'd have to use wireshark or something similar to monitor the network traffic. Thought I'd ask the question before I start down that road :)
Thanks in advance
...ANSWER
Answered 2020-Jul-27 at 22:13The Proxy routes published messages from upstream producer (PUB) to downstream consumer (SUB). It passes subscribe/unsubscribe messages from the consumer to the publisher. The publisher's PUB socket drops any messages for which there is no subscription.
So if there are no consumers downstream of the Proxy, and the Producer only publishes to the Proxy, all the producer's messages will be dropped by its PUB socket. Only after a consumer subscribes via the Proxy's XPUB (and the proxy, in turn, forwards the subscription to the producer via XSUB to PUB) will the messages actually be forwarded by the producer's PUB socket, through the proxy, to the consumer.
I'm not sure whether the proxy actively manages the passed-through subscriptions or simply passes them through and lets the producer's PUB socket handle it. I think it's the latter. The proxy does buffer the messages to allow for consumer (or producer) outage/reconnect.
QUESTION
I am using zeromq to create a generic dynamic graph setup. I already have a XPUB/XSUB setup but am wondering if there is a zmq way of adding a sequence number/timestamp to each message going through generated by the proxy in order to have a uniquely sequenced “tape” of events?
...ANSWER
Answered 2020-Mar-15 at 23:41Q : "... but am wondering if there is a zmq way of adding ... to each message ...?"
No, there is not. ZeroMQ way would be to have this done with Zero-Copy and (almost) Zero-Latency.
Such way does not exist for your wished use-case.
Solution ? Doable :Create a transforming-node, where each message will get transformed accordingly ( SEQ-number added and TimeSTAMP datum { pre | ap }-pended ). Such step requires one to implement such a node and handle all such steps altogether with any exceptions per incident.
The ready-made API-documented zmq_proxy()
simply does not and cannot and should not cover these specific requirements, as it was designed for other purposes ( and uses a Zero-Copy for the most efficient pass-through + ev. efficient MITM-logger mode(s) of service ).
QUESTION
Is it possible for a publisher to publish to multiple clients on the same machine using ZeroMQ? I'd like a set of clients, each of which can make standard Request/Response calls using SocketType.REQ and SocketType.REP, but which can also receive notifications using SocketType.SUB and SocketType.PUB.
I've tried to implement this topology, taken from here, although my version only has one publisher.
Here is my publisher:
...ANSWER
Answered 2020-Feb-06 at 17:28Q : Is it possible for a publisher to publish to multiple clients on the same machine using ZeroMQ?
Oh sure, it is. No doubts about that.
Check the code. The responsibility of the order-of-execution is there. In distributed-systems this always so.
Once the [Client]-No1
instance gets a plausible .readLine()
-ed input
it will jump-in:
QUESTION
I want to verify a message signed by my trezor hardware wallet. Basically I have these information.
...ANSWER
Answered 2020-Jan-11 at 03:47Public-key. Mathematically an elliptic curve public key is a point on the curve. For the elliptic curve used by Bitcoin, secp256k1, as well as other X9-style (Weierstrass form) curves, there are (in practice) two standard representations originally established by X9.62 and reused by many others:
uncompressed format: consists of one octet with value 0x04, followed by two blocks of size equal to the curve order size containing the (affine) X and Y coordinates. For secp256k1 this is 1+32x2 = 65 octets
compressed format: consists of one octet with value 0x02 or 0x03 indicating the parity of the Y coordinate, followed by a block of size equal tot he curve order containing the X coordinate. For secp256k1 this is 1+32 = 33 octets
The public key output by your trezor is the second form, 0x02 + 32 octets = 33 octets. Not 32.
I've never seen an X9EC library (ECDSA and/or ECDH) that doesn't accept at least the standard uncompressed form, and usually both. It is conceivable your python library expects only the uncompressed form without the leading 0x04, but if so this gratuitous and rather risky nonstandardness, unless a very good explanation is provided in the doc or code, would make me suspicious of its quality. If you do need to convert the compressed form to uncompressed you must implement the curve equation, which for secp256k1 can be found in standard references, not to mention many implementations. Compute x^3 + a*x + b
, take the square root in F_p, and choose either the positive or negative value that has the correct parity (agreeing with the leading byte here 0x02).
The 'xpub' is a base58check encoding of a hierarchical deterministic key, which is not just an EC(DSA) key but adds metadata for the key derivation process. If you base58 decode it and remove the check, you get (in hex):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xpub
Manually
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page