Quorum nodes cannot connect to remote bootnode and nodes
System information
Hello, I have problems of remote connection in 7nodes examples
Geth version: geth version
I use docker container of quorum here to deploy 7 nodes examples in quorum. https://github.com/agriessel/quorum-docker
OS & Version: Windows/Linux/OSX Linux Ubuntu 16.04
Branch, Commit Hash or Release: git status
Expected behaviour
When I run 7nodes examples like your guide by putting all 7 nodes and bootnodes in the same container, all is good
Now,
-
I have run first 3 nodes and bootnodes in the first container, called container 1. Off course, I used docker option -p 33445:33445 when I run this container 1 so that the port 33445 of bootnode in container can be accessible from 33445 of host machine
-
I run 4 last nodes in the second container, called container 2 on another machine or same machine (I tested both) Of course, The bootnodes option in commands point to bootnode_Enode[host_machine_of_container_1]:33445
I hope that all 7 nodes that can connect
Actual behaviour
Only first 3 nodes in the container can connect each other. These 3 nodes connect to bootnode in the same container 1 (that mean bootnodes run in the same machine)
When I run bootnode in this container 1, I tried all cases below, but none of them work
nohup bootnode --nodekeyhex "$BOOTNODE_KEYHEX" --addr="0.0.0.0:33445" 2>>qdata/logs/bootnode.log &
nohup bootnode --nodekeyhex "$BOOTNODE_KEYHEX" --nat "any" --addr="0.0.0.0:33445" 2>>qdata/logs/bootnode.log &
nohup bootnode --nodekeyhex "$BOOTNODE_KEYHEX" --nat "extip:hostmachineIP" --addr="0.0.0.0:33445" 2>>qdata/logs/bootnode.log &
nohup bootnode --nodekeyhex "$BOOTNODE_KEYHEX" --nat "any" --addr="172.17.0.2:33445" 2>>qdata/logs/bootnode.log &
nohup bootnode --nodekeyhex "$BOOTNODE_KEYHEX" --nat "any" --addr="172.17.0.2:33445" 2>>qdata/logs/bootnode.log &
172.17.0.2 is IP of container 1
I have already used admin.addPeer in java script console to connect all of them, but I donot want to do it. More over, when I addPeer in this way, I cannot deploy script1.js in 7nodes examples any more When I type this command PRIVATE_CONFIG=tm1.conf geth --exec 'loadScript("script1.js")' attach ipc:qdata/dd1/geth.ipc
I receive the error:
err creating contract Error: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Date:[Thu, 11 May 2017 12:43:20 GMT] Server:[Warp/3.2.8]] Body:0xc427040300 ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc4246a43c0 TLS:
I must remove privateFor in this script script1.js to be successful
Steps to reproduce the behaviour
Thanks for your reponse how to connect to remote quorum nodes and solve the problem of deploying contract
Backtrace
[backtrace]
Do you get the same behaviour when you map the port as UDP. I believe the service discovery happens over UDP where as the manual addPeer creates a TCP connection with the peer directly.
Thanks for your answer. But I donot understand very well addPeer is executed by nodes, not bootnodes. For example, node1 add enode of node2 addPeer(enode2). The port in addPeer is the discovery port, in this case is 21000, 21001, not RPC Json port When I run bootnode, i only use 2 nat like above "any", "extip"
if you talk about the mapping between post of host machine and port of bootnode in the container I only use -p 33445:33445 in docker run You mean that I need to explicit like that? -p 33445:33445/udp or even -p IP_host:33445:33445/udp
I've tried all mapping types but it does not work between host machine and docker container in which boot node program runs has problems. But it doesnot work. I
I am running into the same issue. I was just checking if it still didn't work when you explicitly used -p 33445:33445/udp. If I use the argument --net=host then the multiple containers on the host can find the bootnode but if I try to do it with port mapping so I can use external nodes (not on the host) it doesn't seem to work.
I already solved this problem by:
- using a real bootnode in remote machine or
- perform bootnode in docker container by mapping port for both tcp and udp
However, i still see errors when I send script1.js in this example (This errors does not appears if I run all nodes in the same container) PRIVATE_CONFIG=tm1.conf geth --exec 'loadScript("script1.js")' attach ipc:qdata/dd1/geth.ipc
I receive the error: err creating contract Error: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Date:[Thu, 11 May 2017 12:43:20 GMT] Server:[Warp/3.2.8]] Body:0xc427040300 ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc4246a43c0 TLS:} true
I see true below. Why?
I remove privateFor in script1.js => It works Maybe transaction manager has problem? I tried to map using both tcp and udp for port of transaction manager. It doesnot work, either
It is porbably unrelated - but I got the same error when I didn't have all the build dependencies installed: build-essential unzip libdb-dev libsodium-dev zlib1g-dev libtinfo-dev solc sysvbanner wrk
I use docker here https://github.com/agriessel/quorum-docker/blob/master/Dockerfile You can see these lines below in the docker file
RUN apt-get update && apt-get install -y RUN apt-get install -y software-properties-common unzip wget git make gcc libsodium-dev build-essential libdb-dev zlib1g-dev libtinfo-dev sysvbanner wrk psmisc RUN add-apt-repository -y ppa:ethereum/ethereum && apt-get update && apt-get install -y solc
All dependencies are installed. This error doesnot appear when you run all nodes in the same container, and it doesnot appears either if you remove privateFor in script1.js, I guess therefore that this error involves transaction manager
It looks like node7's constellation node cannot connect to node1's constellation node. When the constellation node is started, it attempts to connect to the constellation node(s) defined in the otherNodeUrls array within the TransactionManager config file (e.g here ). What do you have specified there?
You can try include node7 in the first container to prove connectivity can be achieved intra-container at least.
Thanks for very much your answer. I also have just seen this file In the link you gave, all tms of nodes from 2 to 7 connect to tm of node 1 using ["http://127.0.0.1:9000/"] It works when all of them are put in the same container. But in the different container, it must be modified. I will test and update soon
I have just tested. The deploy is good, no error any more. I deploy smart contract on node1 with privateFor node 7 that is in another container, but I receive always value 0 at node 7
var address = "adress of smart contract of script1 deployed at node 1 with success"; var abi = [{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"initVal","type":"uint256"}],"type":"constructor"}]; var private = eth.contract(abi).at(address); private.get();
value is always 0 although node 1 has already set privateFor to tm of node7.
So you are saying that you no longer get the 400 error? Please send the node7 constellation logs.
Also, please let us know what you did to resolve the error you were seeing as we don't have any visibility into your setup.
I deploy 7 nodes in a 7 seperate docker containers (from container 1 to 7), boot node is also in seperate docker container with port mapping
All nodes are connected, the smart contract script1.js (containing privateFor) is deployed with success but the share between node 1 and node 7 is not performed
For the setup, as normal, the tm.conf of each node from 2 to 7, each of is
url = "http://127.0.0.1:9000/" port = 9000 socketPath = "qdata/tm.ipc" otherNodeUrls = ["http://ip_of_node1:tm_port_of_node1/"] publicKeyPath = "keys/tm.pub" privateKeyPath = "keys/tm.key" archivalPublicKeyPath = "keys/tma.pub" archivalPrivateKeyPath = "keys/tma.key" storagePath = "qdata/constellation"
I open constellation logs of the node 7 , and I found
Constellation initializing using config file tm.conf Log level is LevelWarn [WARN] Error performing API request: ApiReceive (Receive {rreqKey = "sCLbvWWTAnZc7XQZ0bQCAI2SSaTWAdB6ow2JjaX9KXxrN8VmcYirnz+q9Td/Sl4WMnG4aK3YshZeZr4l4BHYIQ==", rreqTo = "TvbGtdBihveyUe+TAHzQyOamcucx+823uRd/sklLvRc="}); Key not found in BerkeleyDb payload.db [WARN] Error performing API request: ApiReceive (Receive {rreqKey = "uOaYWlJr0uYxT+BMReUsv/19eY5ZOONTHkSDJNIoIz2ssjm2PVz2uSbPyXzJkxHO52Kmcb+zTDI1m1WIo1wJdQ==", rreqTo = "TvbGtdBihveyUe+TAHzQyOamcucx+823uRd/sklLvRc="}); Key not found in BerkeleyDb payload.db
TvbGtdBihveyUe+TAHzQyOamcucx+823uRd/sklLvRc= is public key of node7 used in privateFor of script1.js deployed in the node 1. I find that the hash of transaction is already sent from node1 to node7 with public key but it doesnot find the key, but the key file is in keys directory "keys/tm.key" whose content is {"data":{"bytes":"BLSWAByXj4xU/5wg+e/vx6CaantZA5/4R8MFuQ9S55o="},"type":"unlocked"}
Before The command constelation was already launched as normal with success in the constellation.log nohup constellation-node tm.conf 2>> qdata/logs/constellation.log &
I see the constellation.log of another node, for example, node2 (maker and voter) that doesnot involves node1 and node7, and the content is a litte different
Constellation initializing using config file tm.conf although public key of tm of node 7 is always the same (TYgaRG/in34zTs9SR73QSzYthqppq6DuV1CsXKd8C1Q=)
[INFO] Log level is LevelWarn [WARN] Error performing API request: ApiReceive (Receive {rreqKey = "sCLbvWWTAnZc7XQZ0bQCAI2SSaTWAdB6ow2JjaX9KXxrN8VmcYirnz+q9Td/Sl4WMnG4aK3YshZeZr4l4BHYIQ==", rreqTo = "TYgaRG/in34zTs9SR73QSzYthqppq6DuV1CsXKd8C1Q="}); Key not found in BerkeleyDb payload.db [WARN] Error performing API request: ApiReceive (Receive {rreqKey = "uOaYWlJr0uYxT+BMReUsv/19eY5ZOONTHkSDJNIoIz2ssjm2PVz2uSbPyXzJkxHO52Kmcb+zTDI1m1WIo1wJdQ==", rreqTo = "TYgaRG/in34zTs9SR73QSzYthqppq6DuV1CsXKd8C1Q="}); Key not found in BerkeleyDb payload.db
here is structure of the directories: ls -lah qdata/constellation/ total 272K drwxr-xr-x 2 root root 4.0K May 15 13:34 . drwxr-xr-x 5 root root 4.0K May 15 13:34 .. -rw-r----- 1 root root 10M May 15 13:34 log.0000000001 -rw-r----- 1 root root 192K May 15 13:34 payload.db
cat qdata/constellation/payload.db ▒gL݈UPэh^root@4c94b0d192b4
ls -lah qdata/constellation/payload.db -rw-r----- 1 root root 192K May 15 13:34 qdata/constellation/payload.db
The payload.db is 192K size, but I cannot show its content, of course. I donot know whether the key of tm is stored in it
@dungtctin4 Please make sure you generate a new keypair for the node for which you pasted tm.key above, since that's the private key.
Is it possible that you have multiple nodes using the same key pair? If node 4 uses the same key pair, but comes up and synchronizes with other nodes before node 7, transactions for that public key would go to node 4.
If that's not the source of the issue, please produce Dockerfiles that can be used to reproduce the issue.
Thanks @patrickmn for your answer. I have used constellation-enclave-keygen to generate tm.pub and tm.key in each container and their content are completely different Please tell me how to store the content of tm.key in the payload.db??? When I run the command nohup constellation-node tm.conf 2>> qdata/logs/constellation.log & the key must be stored in payload.db?
The permissions file is a problem or not? I see tm.key is only for root, it is normal in docker container I believe.
I believe that I donot have to specify the absolute path for publicKeyPath, privateKeyPath, archivalPublicKeyPath, archivalPrivateKeyPath ?
The content of script1.js is var simple = simpleContract.new(42, {from:web3.eth.accounts[0], data: simpleCompiled[simpleRoot].code, gas: 300000, privateFor: ["zZGTo7Q6X50KNUyo+5cVXsIkLcH2/q8FpR$ if (e) { console.log("err creating contract", e); } else { if (!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } } });
When I deploy it I donot receive address immediately (like local deploy) but only transaction hast, and then I must use eth.getTransactionReceipt to gain smart contract address
Why does the tm of the node 1 send transaction payload hash to all tm of other nodes
I have replaced url = "http://127.0.0.1:9000/" in the tm.file of node1 with url = "http://0.0.0.0:9000/" but nothing changed. The problem is still there
Hi @dungtctin4, the first Constellation node will send the payload to each node which advertises a public key listed in privateFor, but not to other nodes on the network. The hash digest of the encrypted payload is sent to the entire blockchain network inside the private transaction.
It's hard to know what the source of your issue is without being able to reproduce it. If the privateFor transaction succeeds, that means the payload was synchronized between Constellation nodes successfully, so the most likely issue is that multiple Constellation nodes are hosting the same key pair.
If you can provide a complete example that exhibits the problem, e.g. via https://gist.github.com/, we can figure out the cause.