We need to install bun.sh to run the project.
curl -fsSL https://bun.sh/install | bashbun installFIrst, we need to install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bashThen, we need to install Node.JS using NVM:
nvm install v22
nvm use default v22To start the chaincode, we need to pull the network configuration and start the chaincode.
export CHANNEL_NAME=mynet
export MSP_ID=Org1MSP
export URL="http://localhost:8100/api/v1"
export CHAINLAUNCH_USERNAME=admin
export CHAINLAUNCH_PASSWORD="admin123"
chainlaunch fabric network-config pull --network=$CHANNEL_NAME --msp-id=$MSP_ID --url=$URL --username="$CHAINLAUNCH_USERNAME" --password="$CHAINLAUNCH_PASSWORD" --output=network-config.yaml
export CHANNEL_NAME=mynet
export CHAINCODE_NAME=basic
export CHAINCODE_ADDRESS="192.168.0.18:9999" # this is the address where the chaincode will be listening
export USER_NAME=admin
export MSP_ID=Org1MSP
chainlaunch fabric install --local --config=$PWD/network-config.yaml \
--channel=$CHANNEL_NAME --chaincode=$CHAINCODE_NAME \
-o $MSP_ID -u $USER_NAME \
--policy="OR('${MSP_ID}.member')" \
--chaincodeAddress="${CHAINCODE_ADDRESS}" --envFile=$PWD/.env
bun run build
bun start:dev
export CHANNEL_NAME=mynet
export CHAINCODE_NAME=basic
export MSP_ID=Org1MSP
chainlaunch fabric invoke --chaincode=$CHAINCODE_NAME --config=network-config.yaml \
--channel $CHANNEL_NAME --fcn InitLedger --user=admin --mspID=$MSP_ID
chainlaunch fabric query --chaincode=$CHAINCODE_NAME --config=network-config.yaml \
--channel $CHANNEL_NAME --fcn GetAllAssets --user=admin --mspID=$MSP_ID