How to build private blockchain network using Hyperledger - hyperledger

I am new to Hyperledger, I have brief knowledge about Ethereum. I want to create private network using Hyperledger. So, how can we create private network in Hyperledger and deploy the smart contract or chain code to that network ?
And also same thing I want to build using R3 Corda, so is it possible to do inside Corda ?
Can anyone have any reference link or steps for that ?

As Kid101 mentions, you can set up a Corda network by following the instructions in https://docs.corda.net, and in particular https://docs.corda.net/setting-up-a-corda-network.html.

Hyperledger includes multiple blockchain technologies, including Hyperledger Sawtooth.
For Sawtooth, here's a brief summary of the package installation steps and initial setup. This will install the Hyperledger Sawtooth software and setup a blockchain with 1 block (the "genesis" block, block 0):
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD
$ sudo add-apt-repository 'deb http://repo.sawtooth.me/ubuntu/1.0/stable xenial universe'
$ sudo apt-get update
$ sudo apt-get install -y sawtooth
$ sawtooth keygen
$ sawset genesis
$ sudo -u sawtooth sawadm genesis config-genesis.batch
$ sudo sawadm keygen
Full details are at: https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide/installing_sawtooth.html
There are also admin guides and tutorials to follow. But this will get you started.

Related

Is it possible to nest docker/podman containers

I run Fedora 35, and need to run an app in docker in ubuntu.
I was able to get and run ubuntu via podman
podman pull ubuntu:20.04
and setup do docker there, but can't make it run as I probably didn't enter podman properly probably. I used:
podman run -it ubuntu:20.04
where I ran:
su -
apt update; apt upgrade
apt install inetutils-ping nano sudo npm
apt install apt-transport-https ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" |sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update
apt install docker-ce docker-ce-cli containerd.io
to start docker via systectl is not possible in the container, and dockerd command gives many error, mostly that it can't access overlay, and probably network (iptables)
ERRO[2022-05-07T23:14:18.803335993+02:00] failed to mount overlay: operation not permitted storage-driver=overlay2
ERRO[2022-05-07T23:14:18.803397023+02:00] exec: "fuse-overlayfs": executable file not found in $PATH storage-driver=fuse-overlayfs
ERRO[2022-05-07T23:14:18.803500924+02:00] AUFS wdas not found in /proc/filesystems storage-driver=aufs
ERRO[2022-05-07T23:14:18.803887884+02:00] failed to mount overlay: operation not permitted storage-driver=overlay
Is it possible at all to run and app with service to have open port to outside of docker, and podman as there are 2 layers of nested containers?
It is not possible to use the default storage driver of type overlay inside another container, you need to change the storage to vfs. Maybe https://docs.docker.com/storage/storagedriver/vfs-driver/ helps.
Disclaimer: This works definitely in case of running podman in docker, but the other way around I have not tested.

Can't connect to docker from WSL

I have checked the option Expose the daemon on tcp... in docker on windows, and am now trying to connect from WSL. I have run all those commands:
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Download and add Docker's official public PGP key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify the fingerprint.
sudo apt-key fingerprint 0EBFCD88
# Add the `stable` channel's Docker upstream repository.
#
# If you want to live on the edge, you can change "stable" below to "test" or
# "nightly". I highly recommend sticking with stable!
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update the apt package list (for the new apt repo).
sudo apt-get update -y
# Install the latest version of Docker CE.
sudo apt-get install -y docker-ce
# Allow your user to access the Docker CLI without needing root access.
sudo usermod -aG docker $USER
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
However, docker info only gives me:
Client:
Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
errors pretty printing info
What might be wrong? I have been trying this all day. I am running WSL and Ubuntu 18.04, not WSL 2, as the update that brings WSL 2 doesn't seem to be avaible yet without an insider build.
if you run env | sort do you see the DOCKER_HOST=tcp://localhost:2375 variable? if not you may need to run source ~/.bashrc to load the new environment variable into the current console.
Alternatively start a new terminal instance.
Also and this may seem like a daft question but i have to ask, is docker running correctly? from powershell if you run docker info does it return the status of the docker server?

Jenkins not connecting on AWS EC2 Ubuntu

I have launched an ubuntu EC2 instance and tried to install Jenkins on it.
Below are the commands i used
sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
sudo apt install jenkins
My jenkins installation was successful but when i go to browser and tried
http://172.31.38.179:8080/.I am not able to get the jenkins page
Please suggest what i am missing here ?
Go to the security group attached to your ec2 instance.
Edit and add TCP on port 8080 from all and you are good to go . Please let me know if there’s any issues.

How to install a service using Jenkins

I would like to install Google cloud SDK as a service with Jenkins through the plugin. But I didn't find the source on how it should be done. Can someone help me out on this?
For installing the Google Clous SDK in a Linux (Ubuntu) environment using Jenkins do the following:
Create a freestyle Jenkins job and in the build step add Execute shell and then add the following script into it:
#create an environment variable for the correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
#Add cloud SDK URI to the pacakage source
sudo echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
#Import Google Cloud public key
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
#Install the SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
Then run the job, it will install Google Cloud SDK in your machine.
The login to the machine and run sudo gcloud init to get started with the SDK.
For more info follow this documentation.

Why "https://get.docker.com/ubuntu" is a apt repository?

Today I upgraded docker successfully, following instructions from: https://askubuntu.com/questions/472412/how-do-i-upgrade-docker .
However, when I opened the repository url https://get.docker.com/ubuntu/ in my browser, it is just a text page, which contains a list of bash commands.
My question is :
How apt works with this text page url?
Does apt simply run the bash commands?
If so, why is there a same
command:
"echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
as that in
https://askubuntu.com/questions/472412/how-do-i-upgrade-docker
The page located at https://get.docker.com/ubuntu/ contains a script that can be used to install docker
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
apt-get update
apt-get install -y apt-transport-https
fi
# Add the repository to your APT sources
echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list
# Then import the repository key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Install docker
apt-get update
apt-get install -y lxc-docker
But this script is not used by apt-get, it must be run manually.
The script creates the config file /etc/apt/sources.list.d/docker.list with the following content:
deb https://get.docker.com/ubuntu docker main
When apt-get update is run, this config file will be used and apt-get update will take that line and build the following URL from it
https://get.docker.com/ubuntu/dists/docker/main/binary-amd64/Packages
The packages cache of the packages management system will be updated with the packages described in the Packages file.
Package: lxc-docker
Version: 1.5.0
License: Apache-2.0
Vendor: none
Architecture: amd64
Maintainer: support#docker.com
Installed-Size: 0
Depends: lxc-docker-1.5.0
Homepage: http://www.docker.com/
Priority: extra
Section: default
Filename: pool/main/l/lxc-docker/lxc-docker_1.5.0_amd64.deb
Size: 2092
SHA256: 2e8b061216cc45343197e52082175bc671af298d530652436dc16d0397f986f0
SHA1: 24a0314bd7f6fdf79b69720de60be77510d689af
MD5sum: 923cad1a2af2d6b0a3e8fa909ba26ca4
Description: Linux container runtime Docker complements LXC with a high-level API which operates at the process level. It runs unix processes with strong guarantees of isolation and repeatability across servers. Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
....
Finally apt-get upgrade will download and install the packages.
If I'm not mistaken(I am still new to Linux),
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
It copies the text file in http://get.docker.io/ubuntu then paste it to etc/apt/sources.list.d/docker.list. The shell file is then executed.

Resources