Is there any way to get data from blockchain of tendermint API?
tendermint
Of course. What data are you looking for? If you run the node with default settings and go to localhost:46657/ you see a list of end points.
If you want a block, try localhost:46657/block?height=42
The port number 46657 did not work for me, then I tried printing tendermint port and tried hitting http://localhost:57943/block?height=99.
Where 99 was the height of my 1st block in the blockchain
57943 is my tendermint port.
So may be it is taking port number dynamically.
The best way to access blockchain data from tendermint is using rpc endpoint.The rpc endpoint port can be configured in config.toml file.When you access the endpoint you can see various endpoints few which require arguments and few which don't.The default port was changed from 46657 to 266657 in later versions.
Related
I am new to Ethereum and generally to blockchain. I learned that Ethereum blockchain works on Kademlia. The distributed hash table and its working was beautiful and nicely explained by Eleuth P2P.
Now I used geth to connect to the Ethereum Mainnet and it discovered 2 to 3 maximum peers in 5 to 6 minutes.
Now I know the algorithm but my concern is how the first peer is discovered? Because internet is just a big set of routers and different type of computers (server, computer, etc ) and if you broadcast the discovery like in ARP. The internet will be flooded with these peer discovery broadcast messages and this doesn't seems right. So how initially the connections are made? Also we cannot trust a single network for first time connection because this will make the system server and client based and not decentralised so how the initial connections and peer discovery happens?
Are the broadcast message like have TTL like to prevent the circular loop like in TCP I guess? But this also seems a horrible idea to me.
Please explain.
In order to get going initially, geth uses a set of bootstrap nodes whose endpoints are recorded in the source code.
Source: Geth docs
Here's the list of the bootstrap nodes hardcoded in the Geth source code: https://github.com/ethereum/go-ethereum/blob/v1.10.11/params/bootnodes.go#L23
The --bootnodes option allows you to overwrite this list with your own. Example from the above linked docs:
geth --bootnodes enode://pubkey1#ip1:port1,enode://pubkey2#ip2:port2,enode://pubkey3#ip3:port3
I am writing a program that needs to create an ad-hoc network. Once it's created and other nodes connect, i need a way to determine the ip of every node on the network (or some other way of forming a connection. I would prefer to use tcp and/or udp, but I don't have to). Once I have a way to connect to other nodes, I need to determine the number of hops between this machine and the node I'm wishing to connect to.
I have looked around a lot for this information, but to no avail.... Does anyone know if there is an already in place API for this? And if not, how I would be able to create my own....
I know this question is pretty old, but I have extensive experience in this field.
What you need is an ad hoc routing protocol, often called MANET (Mobile Adhoc NETwork) protocol. I would suggest that you take a look at OLSR, which is standardized by the IETF as RFC 7181 and RFC 3636.
You can obtain source code and binaries for OLSR at http://www.olsr.org/?q=download.
By using this, OLSR will create routes between all nodes in the network, and by looking at the routing table you will be able to determine the IP address of every node in the network, and can then easily open a socket connection (UDP/TCP) to any of them. You will also get information about the quality of each link, if needed.
this might be a dumb question...
I wrote a C++ client program that communicates with a web service over HTTPS with the help of the cURL library.
I am wondering if the person using the client can see clearly the traffic originating from his computer using some sniffing program?
Or would he see encrypted data?
Thanks!
Using a utility like netcat to sniff data on the wire, the user would only see encrypted data. The only way to see the raw data is to log it inside the app, before it's passed to cURL, OR to find it in the machine's active RAM (much more difficult since it's likely to be fragmented).
Not if your app checks for valid certificates.
If your users have the ability to use a proxy server with your app, they could use fiddler's decrypt https sessions function to do this, but it results in an invalid certificate which could be made to stop it from working when detected.
He would see the encrypted data. Sniffers only see the packets, so if HTTPS is working as it should, the packets should be encrypted, and that's all the program could see.
If you would like to try it yourself, learn about ettercap-ng.
I doubt that an average user would be able to do that...
BUT there are ways to do this like:
replacing the cURL library with a proxy (if you link dynamically)
running your program under a debugger and placing breakpoints on the cURL functions
replacing the cURL program with a proxy (if you use it as a commandline utility)
digging deep and diessecting the memory at runtime
From my POV it is improbable (since you need some skill + knowledge + some control over the client environment to pull that off) but possible...
The SSL/TLS protocol is typically implemented at the application layer, so the data is encrypted before it is sent.
If the user has access to the certificate key(s) used to encrypt/decrypt the data, then he/she can plug them into WireShark and it can then decode sniffed HTTPS packets off the wire.
I'm running a server an a client on the same machine(linux).
How do I force the packets to go through the network(switch) and not through the loopback?
Thanks,
Michael
Since you're asking this on a programming site, I'll assume you have source code.
When you create the client-side socket, you can limit it to a specific interface. Usually you don't (you just call connect() without bind()ing it first) , and let the OS figure out the best outgoing interface, but this is not mandatory.
You can try setting the SO_BINDTODEVICE socket option on both the client and the server sockets and give it the external NIC interface as parameter.
See: http://codingrelic.geekhold.com/2009/10/code-snippet-sobindtodevice.html for an example
I am not sure this is enough - there might be a sanity check in the kernel IP stack to drop packets whose Ethernet destination and source are both you. There might be a sysctl to disable this check or you can compile your own kernel without the check for this specific test.
Maybe you should try connecting via a proxy server?
You can't, unless you have some device out there on a network whose job it is to send the data back to you. Normally, there is nothing that would do that. If you send the data out onto the network, you won't get it back.
If you have set something up to return the data to you, send the data to that, following whatever mechanism it supports.
Is it possible to create an HTTP tunnel in Delphi or C++?
My application connects to several HTTP servers that do not belong to the company I work for. Because of that, our users need to open their firewall ports to allow those connections. I thought about creating a tunnel at my company and redirecting HTTP requests made by my application through this tunnel. This way, my clients will only need to open one port and the tunnel will handle all requests. All requests are made with POST or GET using indy components.
EDIT: I can't use an HTTP proxy. Some of my users have already got their own HTTP proxy and it is going to be impossible to connect to two different proxy servers at the same time.
Here is a free component is kind of old but it works you can get yourself inspired from there
TGpHTTPProxy
Or you can try this samples
https://sites.google.com/site/delphibasics/home/delphibasicssnippets/examplesocks4proxybyaphex
https://sites.google.com/site/delphibasics/home/delphibasicssnippets/multi-threadedhttpproxyserver
As Warren P. and Rob Kennedy suggest, you really just need a proxy server. Don't write a tunnel yourself, it's a huge overkill and it's far from easy (writing a robust socket application is more time consuming than it first appears to be).
If you want something dead simple look for datapipe.c or netcat (nc) unix command. SSH can create tunnels too (look in OpenSSH and PuTTy docs).
Here is a free open source HTTP-Tunnel and UDP-Tunnel: http://barbatunnel.codeplex.com/