sudo chmod +x preinstall.sh
./preinstall.sh
cd artifacts/channel/
./create-artifacts.sh
docker-compose up -d
./createChannel.sh
./deployChaincode.sh
./interact.sh
cd api/
./pre_API.sh
nodemon start
* Criar usuário para interagir com a rede
curl -X POST http://localhost:4000/users -H "Content-Type: application/json" -d '{
"username": "Jeffson",
"orgName": "Org1"
}' | jq
* Interação
curl -X POST http://localhost:4000/channels/mychannel/chaincodes/fabcar \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzI5NTI5MzAsInVzZXJuYW1lIjoiSmVmZnNvbiIsIm9yZ05hbWUiOiJPcmcxIiwiaWF0IjoxNzMyOTE2OTMwfQ.1zAx7wuljY7qmGn3KPTKG3JwFDV6SNWeNtY3QT7Djrk" \
-d '{
"fcn": "createCar",
"peers": ["peer0.org1.example.com","peer0.org2.example.com"],
"ChaincodeName": "fabcar",
"args": ["CAR556","SUBARU","IMPREZA","RED","Marco"]
}' | jq
Arquivo do pre-install não coloca no bashrc as variaveis do PATH
echo '# Hyperledger Fabric binaries' >> ~/.bashrc
echo 'export PATH=/fabric-samples/bin:$PATH' >> ~/.bashrc
echo '# Nodejs' >> ~/.bashrc
echo 'VERSION=v12.19.0' >> ~/.bashrc
echo 'DISTRO=linux-x64' >> ~/.bashrc
echo 'export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH' >> ~/.bashrc
echo '# Go' >> ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc