GithubHelp home page GithubHelp logo

Comments (26)

mastersingh24 avatar mastersingh24 commented on July 29, 2024

@kamraanki - if you want to run cp-web locally and deploy chaincode to your own local network, then you don't need to worry about these. If you are trying to run cp-web locally but still point to your peers on Bluemix, then you can simply copy the service credentials from the Bluemix dashboard for your service instance

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@mastersingh24 can you please tell me how to configure mycreds.json using ibc.load()

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

I think this goes the other way. You use the credentials in mycreds.json to call ibc.load(). If you look in app.js, you will see how we build the configuration object that we pass into ibc.load().

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 sorry for my wrong question. actually i want to ask following things:-

We have to give following parameters in mycreds.json. i want to configure blockchain network on my local

"discovery_host": This is my network validator1 peer address,
"discovery_port": This is my network validator1 peer port,
"api_host": "what to give here ?",
"api_port_tls": what to give here ?,
"api_port": what to give here ?,
"type": "peer",
"id": "what to give here ?",
"api_url": "what to give here ?"

I found haproxy.cfg in cp-web-master that is listening on 80 and 443 port. is there we need to start haproxy and is api_host and api_port will point to haproxy ?

Similar in case of CA:-

"ca": {
"ef02d58a-dcc8-41e6-a323-5f4569d94508_ca": {
"url": "what to give here ?",
"discovery_host": "what to give here ?",
"discovery_port": what to give here ?,
"api_host": "what to give here ?",
"api_port_tls": what to give here ?,
"api_port": what to give here ?,
"type": "ca",
}

I think network_id and container_id relate to ibm bluemix so we dont need to provide that

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

You shouldn't need to do anything with the haproxy configuration; it isn't used when you run the demo locally.

{ "discovery_host": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_vp1-discovery.blockchain.ibm.com", "discovery_port": 30303, "api_host": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_vp1-api.blockchain.ibm.com", "api_port_tls": 443, "api_port": 80, "type": "peer", "id": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_vp1", "api_url": "http://cda0c386-604c-4b6c-95ae-4d2fb261e17e_vp1-api.blockchain.ibm.com:80" }

The discovery and api hosts should be the same; it's just the url for that peer/ca. The rest API for the peer is listening on ports 80 and 443. 80 for for non-TLS requests, while 443 is for TLS requests. We plan to phase out non-TLS support, but have left it in for backwards compatibility. The api url is just api host with whichever api port that you want to use. ID is used to generate a friendly name for the peer in the logs. Setting it to a string of the form '[string]-vp1' should be just fine.

The CA object is similar, but the url will be the discovery host and the API TLS port.
{ "url": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_ca-api.blockchain.ibm.com:30303", "discovery_host": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_ca-discovery.blockchain.ibm.com", "discovery_port": 30303, "api_host": "cda0c386-604c-4b6c-95ae-4d2fb261e17e_ca-api.blockchain.ibm.com", "api_port_tls": 30303, "api_port": 80, "type": "ca", "network_id": "cda0c386-604c-4b6c-95ae-4d2fb261e17e", "container_id": "5356ffed74a93751d90911778a634a4eba69e74767dac273b34898b194f11539" }

from cp-web.

nitesh7sid avatar nitesh7sid commented on July 29, 2024

i am trying to configure my CA with the ibm-js-sdk. i am running my peers and CA using this URL:
https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md

My CA configs are this:
"ca": {

    "url": "grpc://172.17.0.1:50051",
    "discovery_host": "172.17.0.1",
    "discovery_port": 50051,
    "api_host": "172.17.0.1",
    "api_port_tls": 443,
    "api_port": 5000,
    "type": "ca"

},

when i run my application it gives me output: [ibc-js] No membership users found after filtering, assuming this is a network w
/o membership

am i missing something?

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

You are seeing this error because you have not specified a list of client users for the SDK to register with on the network.

An example list of users:
"users": [ { "username": "user_type1_a5d71701bf", "secret": "39d3b65ab5", "enrollId": "user_type1_a5d71701bf", "enrollSecret": "39d3b65ab5" }, { "username": "user_type1_24cf0e8cfc", "secret": "378b76f737", "enrollId": "user_type1_24cf0e8cfc", "enrollSecret": "378b76f737" }]

The code from the SDK that filters for client users:

You can see that client users are identified by the prefix 'user_type1'. If you are trying to run this demo using your own network, then you will need to add these users to the list of users in the membership services yaml file that you use to configure your CA.

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

@kamraanki are you still having any issues?

from cp-web.

nitesh7sid avatar nitesh7sid commented on July 29, 2024

Yes it got resolved.. Thanks...I am trying to run loopback CA lib to register new users by specifying the identity,role,etc..it worked for the Frst time but wen I try to specify different identity it doesn't registers.it fails...should I change the affiliation code as well for different users?

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

hi @masterDev1985 I am still facing issue. While starting local network i got following error:-

[ibc-js] Registering vp1-7c405ae6-1ab...:443 w/enrollID - user_type1_lukas
[ibc-js] Registering vp2-7c405ae6-1ab...:443 w/enrollID - user_type1_diego
[ibc-js] Register - failure x1 : user_type1_lukas 500
[ibc-js] going to try to register again in 30 secs
[ibc-js] Register - failure x1 : user_type1_diego 500
[ibc-js] going to try to register again in 30 secs
[ibc-js] Registering vp1-7c405ae6-1ab...:443 w/enrollID - user_type1_lukas
[ibc-js] Registering vp2-7c405ae6-1ab...:443 w/enrollID - user_type1_diego
[ibc-js] Register - failure x2 : user_type1_lukas 500
[ibc-js] going to try to register again in 30 secs
[ibc-js] Register - failure x2 : user_type1_diego 500
[ibc-js] going to try to register again in 30 secs
[ibc-js] Registering vp1-7c405ae6-1ab...:443 w/enrollID - user_type1_lukas
[ibc-js] Registering vp2-7c405ae6-1ab...:443 w/enrollID - user_type1_diego
[ibc-js] Register - failure x3 : user_type1_lukas 500
! looks like an error loading the chaincode, app will fail
{ name: 'register() error',
code: 500,
details:
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' } }
[ibc-js] Register - failure x3 : user_type1_diego 500

Following is the contents of mycreds.json:-
{
"credentials": {
"peers": [
{
"discovery_host": "172.17.0.2",
"discovery_port": 30303,
"api_host": "172.17.0.2",
"api_port_tls": 443,
"api_port": 80,
"type": "peer",
"id": "7c405ae6-1abb-45b0-8a82-65dda55ffaef_vp1",
"api_url": "http://172.17.0.2:80"
},
{
"discovery_host": "172.17.0.3",
"discovery_port": 30303,
"api_host": "172.17.0.3",
"api_port_tls": 443,
"api_port": 80,
"type": "peer",
"id": "7c405ae6-1abb-45b0-8a82-65dda55ffaef_vp2",
"api_url": "http://172.17.0.3:80"
}
],
"ca": {
"7c405ae6-1abb-45b0-8a82-65dda55ffaef_ca": {
"url": "grpc://172.17.0.1:50051",
"discovery_host": "172.17.0.1",
"discovery_port": 50051,
"api_host": "172.17.0.1",
"api_port_tls": 443,
"api_port": 5000,
"type": "ca"
}
},
"users": [
{
"username": "user_type1_lukas",
"secret": "NPKYL39uKbkj",
"enrollId": "user_type1_lukas",
"enrollSecret": "NPKYL39uKbkj"
},
{
"username": "user_type1_diego",
"secret": "DRJ23pEQl16a",
"enrollId": "user_type1_diego",
"enrollSecret": "DRJ23pEQl16a"
}
]
}
}

I have registered two users from membersrvc.yaml

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 can you please help me to resolve this problem ?

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

@nitesh7sid If you have an error message for the failure you are seeing, I might be able to provide more info, but I don't think you should need to change the affiliation code.

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

@kamraanki Sure thing! I take it you are running your peers inside of a vagrant vm, with your app running outside of the vm. Are you exposing the right ports on the vagrant vm? A connection refused error makes me think the routing for your network is wrong. Could you post your vagrant file?

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 following is my Vagrantfile.

SRCMOUNT = "/hyperledger"
LOCALDEV = "/local-dev"

$script = <<SCRIPT
set -x

export DOCKER_STORAGE_BACKEND="#{ENV['DOCKER_STORAGE_BACKEND']}"

cd #{SRCMOUNT}/devenv
./setup.sh

SCRIPT

Vagrant.require_version ">= 1.7.4"
Vagrant.configure('2') do |config|
config.vm.box = "hyperledger/fabric-baseimage"
config.vm.box_version = ENV['USE_LOCAL_BASEIMAGE'] ? "0":"0.0.9" # Vagrant does not support versioning local images, the local version is always implicitly version 0

config.vm.network :forwarded_port, guest: 5000, host: 3000 # Openchain REST services
config.vm.network :forwarded_port, guest: 30303, host: 30303 # Openchain gRPC services
config.vm.network :forwarded_port, guest: 3000, host: 5000
config.vm.network :forwarded_port, guest: 3000, host: 80
config.vm.network :forwarded_port, guest: 3030, host: 8080
config.vm.network :forwarded_port, guest: 22, host: 1022
config.vm.synced_folder "..", "#{SRCMOUNT}"
config.vm.synced_folder "..", "/opt/gopath/src/github.com/hyperledger/fabric"
config.vm.synced_folder ENV.fetch('LOCALDEVDIR', ".."), "#{LOCALDEV}"
config.vm.provider :virtualbox do |vb|
vb.name = "hyperledger"
vb.customize ['modifyvm', :id, '--memory', '4096']
vb.cpus = 2
storage_backend = ENV['DOCKER_STORAGE_BACKEND']
case storage_backend
when nil,"","aufs","AUFS"
# No extra work to be done
when "btrfs","BTRFS"
# Add a second disk for the btrfs volume
IO.popen("VBoxManage list systemproperties") { |f|
success = false
while line = f.gets do
# Find the directory where the machine images are stored
machine_folder = line.sub(/^Default machine folder:\s*/,"")
if line != machine_folder
btrfs_disk = File.join(machine_folder, vb.name, 'btrfs.vdi')
unless File.exist?(btrfs_disk)
# Create the disk if it doesn't already exist
vb.customize ['createhd', '--filename', btrfs_disk, '--format', 'VDI', '--size', 20 * 1024]
end
# Add the disk to the VM
vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', btrfs_disk]
success = true
break
end
end
raise Vagrant::Errors::VagrantError.new, "Could not provision btrfs disk" if !success
}
else
raise Vagrant::Errors::VagrantError.new, "Unknown storage backend type: #{storage_backend}"
end
end
config.vm.provision :shell, inline: $script
end

I have one question that is no service is listening for port 80 or 443 on 172.17.0.2 and 172.17.0.3 then how it can connect to the same.
I am running both peers and app in vagrant vm.

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

When docker runs containers, they are running on a virtual network that assigns them each an ip address in the 172.17.x.x range. These aren't the ip's that you use to connect to your peers, as you are trying to access them from a client or app that is running on your local machine, where this network is not visible. We need to setup your vagrant machine that is running your peers to properly forward ports to on the peer and ca containers. I can see that you have already set up a few 'forwarded_port' lines in your vagrant file.

Assuming these ports are correctly routed to your peers, then all you need to do is change your connection information for your peers on the app side. Basically, all of your peers will have the same IP address, the IP address of the vagrant vm on your local machine. The ports will be depend on which vagrant machine ports you are forwarding to each peer.

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 As mentioned above that i am running pears and app both in vagrant machine. So that containers IP address is accessible from app machine i think. because i am able to telnet from app machine to 172.17.0.1:50051, 172.17.0.2:30303 and 172.17.0.3:30303. except for ports 80 and 443, I am not able to telnet these ports. I think problem is somewhere else by the way i will also try as you said above by forwarding ports to particular peers.

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 I have deployed chaincode_example02 with same configuration that is running fine. That means network is okay. I have just only one doubt that is again about ports 80 and 443. because chaincode_example02 does not use these ports but CP-WEB use these ports.

Please help me to resolve this problem.

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

I missed that both the app and the network were running inside the vagrant environment. My mistake. By default, vp1 exposes its REST API on port 5000. Could you run "docker ps" in the vagrant machine and post the output here, please? That will list your running containers and will provide information on what ports they are exposing/listening on.

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

Hi @masterDev1985 I have checked that peers are listening on port 5000. But it serving http request and app is using https that's why its return 500 status code. I tried to disable tls in app by modifying "./node_modules/ibm-blockchain-js/index.js" file. Application starts but vp0 gets crash. After then i tried enabling tls in CA server "membersrvc.yaml" and in peer "core.yaml" Now i am facing issue in connectivity of CA server and peers.

Please find error description below:-

22:38:41.760 [crypto] callECAReadCACertificate -> ERRO 00e [validator.test_vp43] Failed requesting read certificate [rpc error: code = 2 desc = "grpc: the client connection is closing"].
22:38:41.760 [crypto] getECACertificate -> ERRO 00f [validator.test_vp43] Failed requesting ECA certificate [rpc error: code = 2 desc = "grpc: the client connection is closing"].
22:38:41.760 [crypto] retrieveECACertsChain -> ERRO 010 [validator.test_vp43] Failed getting ECA certificate [rpc error: code = 2 desc = "grpc: the client connection is closing"].
22:38:41.760 [crypto] registerCryptoEngine -> ERRO 011 [validator.test_vp43] Failed retrieveing ECA certs chain [rpc error: code = 2 desc = "grpc: the client connection is closing"].
22:38:41.760 [crypto] register -> ERRO 012 [validator.test_vp43] Failed registering node crypto engine [rpc error: code = 2 desc = "grpc: the client connection is closing"].
22:38:41.760 [crypto] register -> ERRO 013 Failed registering [test_vp43]: [rpc error: code = 2 desc = "grpc: the client connection is closing"]
22:38:41.760 [crypto] RegisterValidator -> ERRO 014 Failed registering [test_vp43]: [rpc error: code = 2 desc = "grpc: the client connection is closing"]
22:38:41.760 [crypto] func1 -> ERRO 015 Failed registering validator [test_vp43] with name [test_vp43] [rpc error: code = 2 desc = "grpc: the client connection is closing"].

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

That's unfortunate. Could you please post the result of running:

docker ps

We need to see how your peers and ca are being exposed on the docker network.

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

Hi @masterDev1985 Please find result of "docker ps" below:-

image

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 Please help me to resolve this problem.

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

I'm a little confused as to what the state of your network is. You error messages from before would indicate a connectivity issue between the peers and the CA. If security is enabled, vp0 will attempt to connect to the CA and register itself. If the CA cannot be reached, then vp0 will crash. I don't see a CA container in your list of running containers. Are you sure your CA is running? If it is, then I suspect that the wrong connection information has been handed to your peers. Follow this link to see the command for configuring your first validating peer:
https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md#start-up-the-first-validating-peer

The values to pay attention to are -e CORE_PEER_PKI_ECA_PADDR=172.17.0.1:50051 -e CORE_PEER_PKI_TCA_PADDR=172.17.0.1:50051 -e CORE_PEER_PKI_TLSCA_PADDR=172.17.0.1:50051. These should be the address and port for your CA.

from cp-web.

himanshutyagi36 avatar himanshutyagi36 commented on July 29, 2024

is there any way to edit the IBM Bluemix Blockchain network to add new users to the CA server ?

from cp-web.

masterDev1985 avatar masterDev1985 commented on July 29, 2024

@tortuga90 The fabric SDK has functionality to add new users, yes. See here. @kamraanki any updates?

from cp-web.

kamraanki avatar kamraanki commented on July 29, 2024

@masterDev1985 sorry for replying late. I was working on use case yesterday i started work on same. But still i am having same issue. :(

from cp-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.