Is there any way to fix hardhat Unable signature - blockchain

Any time I try to deploy the contract I get this error
image; https://ibb.co/SfzQ1MW
gitpod /workspace/luck $ npx hardhat run scripts/deploy.js --network testnet
Downloading compiler 0.8.4
Compiling 16 files with 0.8.4
Compilation finished successfully
FetchError: request to https://moeing.tech:9545/ failed, reason: unable to verify the first certificate
at ClientRequest.<anonymous> (/workspace/luck/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (node:events:390:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'system',
errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
I will really appreciate your help

The issue is not specifically from hardhat but an issue faced by node-fetch which hardhat uses in the background to send the request. The main cause of this is a problem with your certificates as discussed in this question Unable to verify leaf signature.
What worked for me was to use a VPN, I assume there was an issue with my router. Once I was connected to the VPN I managed to deploy the contract successfully.

Related

Error: self signed certificate in certificate chain for the tests in the Next.js page tests with next-page-tester

I'm looking for a way to overcome the Error: self signed certificate in certificate chain for the tests when I try to set up Next.js page tests with next-page-tester.
Network Error
at createError (node_modules/axios/lib/core/createError.js:16:15)
at XMLHttpRequest.handleError (node_modules/axios/lib/adapters/xhr.js:84:14)
at XMLHttpRequest.invokeTheCallbackFunction (node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js:18:28)
at XMLHttpRequest.<anonymous> (node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js:35:32)
at innerInvokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
at XMLHttpRequestImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
at fireAnEvent (node_modules/jsdom/lib/jsdom/living/helpers/events.js:18:36)
at requestErrorSteps (node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:130:3)
at Object.dispatchError (node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:59:3)
at Request.<anonymous> (node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:655:18)
at Request.onRequestError (node_modules/request/request.js:877:8)
console.error
Error: Error: self signed certificate in certificate chain
at Object.dispatchError (C:\Users\leoniecg\Projects\OneCustomerFrontend\frontend\node_modules\jsdom\lib\jsdom\living\xhr\xhr-utils.js:62:19)
at Request.<anonymous> (C:\Users\leoniecg\Projects\OneCustomerFrontend\frontend\node_modules\jsdom\lib\jsdom\living\xhr\XMLHttpRequest-impl.js:655:18)
at Request.emit (events.js:327:22)
at Request.onRequestError (C:\Users\leoniecg\Projects\OneCustomerFrontend\frontend\node_modules\request\request.js:877:8)
at ClientRequest.emit (events.js:315:20)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) undefined
I have dotenv installed, it works ok with the NODE_TLS_REJECT_UNAUTHORIZED=0 setting in the development environment, but even if I manage to read process.env settings into the test environment, i.e. I can see it with the console.log when I print it at the very top of a test file, I still get the error. Has anyone had this issue? I've been able to read .env.local file:
//.env.local
NODE_TLS_REJECT_UNAUTHORIZED=0
with the instructions given for example here: Using dotenv with Jest.
NODE_TLS_REJECT_UNAUTHORIZED=0 setting is a popular one to even start having Next.js on the localhost, so I guess someone has already stumbled upon this.
Or maybe I should forget about next-page-tester and use Cypress?

SSL Certificate error: [SSL: CERTIFICATE_VERIFY_FAILED] when using aws client in windows 10

Recently I am gettin an error when, for instance, listing data from Amazon S3:
aws s3 ls
SSL validation failed for https://s3.eu-west-1.amazonaws.com/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
I have noticed that the company I work for has added a ZScaler Client Connector. It seems that this client is causing the error. I wonder if someone could give a hint about how to solve this issue.
Upps It seems that I found the solution myself.
Check this site:
https://www.shellhacks.com/aws-cli-ssl-validation-failed-solved/
I downloaded ZScaler certificate and then pointed from config:
$ cat ~/aws/.config
[default]
ca_bundle = /data/ca-certs/whatevername.pem
I was getting crazy, I hope it helps someone else.
Solved it this way:
Locate certifi bundle (cacert.pem) location python -m certifi
export AWS_CA_BUNDLE="[full path to cacert.pem]" from step 1
verify

expo init <project> throwing unable to verify the first certificate

I'm using a work machine which is behind a corporate proxy. When I run expo init I get the below error
request to https://registry.npmjs.org/expo-template-blank failed, reason: unable to verify the first certificate
FetchError: request to https://registry.npmjs.org/expo-template-blank failed, reason: unable to verify the first certificate
at ClientRequest.<anonymous> (/Users/<username>/node_modules/minipass-fetch/lib/index.js:97:14)
at ClientRequest.emit (events.js:315:20)
at TLSSocket.socketErrorListener (_http_client.js:467:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I tried npm config set ssl-strict=false but no luck. If i'm missing the certs, then where do I add those? All solutions I see is asking to add some sort of code in the file. But in my case I haven't created a file yet. How do I fix this issue?
I just disabled the proxy and it worked.

Something wrong on deploy chaincode for hyperledger v1.0

I have tried to use docker toolbox to setup Hyperledger V1.0 in my local machines.
I according to this document:
http://hyperledger-fabric.readthedocs.io/en/latest/asset_setup.html
But when I tried to deploy chaincode.
$node deploy.js
I got an error message:
info: Returning a new winston logger with default configurations
info: [Chain.js]: Constructed Chain instance: name - fabric-client1, securityEnabled: true, TCert download batch size: 10, network mode: true
info: [Peer.js]: Peer.const - url: grpc://localhost:8051 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Peer.js]: Peer.const - url: grpc://localhost:8055 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Peer.js]: Peer.const - url: grpc://localhost:8056 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Client.js]: Failed to load user "admin" from local key value store
info: [FabricCAClientImpl.js]: Successfully constructed Fabric COP service client: endpoint - {"protocol":"http","hostname":"localhost","port":8054}
info: [crypto_ecdsa_aes]: This class requires a KeyValueStore to save keys, no store was passed in, using the default store C:\Users\daniel\.hfc-key-store
[2017-04-15 22:14:29.268] [ERROR] Helper - Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:8054]
at ClientRequest.<anonymous> (C:\Users\daniel\node_modules\fabric-ca-client\lib\FabricCAClientImpl.js:304:12)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1278:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[2017-04-15 22:14:29.273] [ERROR] DEPLOY - Error: Failed to obtain an enrolled user
at ca_client.enroll.then.then.then.catch (C:\Users\daniel\helper.js:59:12)
at process._tickCallback (internal/process/next_tick.js:103:7)
events.js:160
throw er; // Unhandled 'error' event
^
Error: Connect Failed
at ClientDuplexStream._emitStatusIfDone (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:201:19)
at ClientDuplexStream._readsDone (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:169:8)
at readCallback (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:229:12)
Is this an question about unable to connect to ca? Or other causes?
Edit:
Environment:
OS: Windows 10 Professional Edition
Docker Toolbox: 17.04.0-ce
Go: 1.7.5
Node.js: 6.10.0
My steps:
1.Open Docker Quickstart Terminal and key commands.
$curl -L https://raw.githubusercontent.com/hyperledger/fabric/master/examples/sfhackfest/sfhackfest.tar.gz -o sfhackfest.tar.gz 2> /dev/null; tar -xvf sfhackfest.tar.gz
$docker-compose -f docker-compose-gettingstarted.yml build
$docker-compose -f docker-compose-gettingstarted.yml up -d
$docker ps
It has been confirmed that six containers have been activated
2.Download examples and install modules.
$curl -OOOOOO https://raw.githubusercontent.com/hyperledger/fabric-sdk-node/v1.0-alpha/examples/balance-transfer/{config.json,deploy.js,helper.js,invoke.js,query.js,package.json}
//This link didn't work, so I downloaded the required files from GitHub of fabric-sdk-node
$npm install --global windows-build-tools
$npm install
3.Try to deploy chaincode.
$node deploy.js
There were several problems, not the least of which that documentation was outdated and was for a preview release of Hyperledger Fabric. The docs are actually in the process of being removed as we need to update our examples / samples.
You mentioned Docker Toolbox - so are you trying to run all of this on Windows or Mac?
UPDATE:
So one of the issue with Docker Toolbox or Docker for Windows is that you cannot use localhost / 127.0.0.1 as the address when trying to communicate from apps on the host (even in the QuickStart Terminal) to the endpoints of the Docker containers. When the QuickStart Terminal first launches Docker, you'll see that it will output the IP address of the endpoint you should use when communicating with exposed ports.
I was having the same issue while following the latest "Writing Your First Application" tutorial (http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html). I had installed all the pre-requisites and the fabric-samples and started the local network.
When I got to the step of enrolling the Admin user, $ node enrollAdmin.js, I was getting the same error message as above, Error: connect ECONNREFUSED, followed by the localhost domain.
As the first answer suggests, the root cause is that I'm running Docker Toolbox. I'm developing on an older Mac, OSX v10.9.5, so I couldn't use Docker for Mac.
To fix the issue, I replaced 'localhost' in the enrollAdmin.js code with the IP from Docker Toolbox.
Here are the steps I took:
Started Docker with Applications > Docker Quickstart Terminal
Copied the IP from this sentence: docker is configured to use the default machine with IP...
Opened the copy of enrollAdmin.js from fabric-samples/fabcar directory
Found this code:
// be sure to change the http to https when the CA is running TLS enabled
fabric_ca_client = new Fabric_CA_Client('http://localhost:7054', tlsOptions , 'ca.example.com', crypto_suite); // <-- This is the line to change
Replaced 'localhost' with the Docker IP, leaving the port :7054 as is.
Saved
Re-ran the command, $ node enrollAdmin.js
The script connected to the CA and successfully completed the Admin enrollment.
On to the next step!

Jenkins can't clone into a private repo

Please Don't close this thread as I could not find solution via similar questions
I'm trying to integrate Jenkins-CI (Hosted on AWS EC2, Ubuntu 14.04), with a private repo but getting the following error log on my test build:
Cloning the remote Git repository
Cloning repository https://github.ccs.neu.edu/CS5500-Spring2017/team7.git
> git init /var/lib/jenkins/workspace/team7_master-JFXDKNF7YKLHDWVSBPWARTJA2O7KU5KHSA5MKXYP6NWMMCP4ODLA # timeout=10
Fetching upstream changes from https://github.ccs.neu.edu/CS5500-Spring2017/team7.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Team 7
> git fetch --tags --progress https://github.ccs.neu.edu/CS5500-Spring2017/team7.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.ccs.neu.edu/CS5500-Spring2017/team7.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://github.ccs.neu.edu/CS5500-Spring2017/team7.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1793)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1519)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1061)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:221)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Under 'Manage Jenkins -> Configure System' I have Github Server added with API and Credentials I created on Github Personal Access Tokens. This token was added onto Jenkins to test the connection.
Enterprise GitHub server section also has the API and name added correctly.
Testing the connection to my private GitHub account is successful.
I created a test job for build but it fails as it cannot clone into the repo.
Any help would be appreciated.