An open API service indexing awesome lists of open source software.

https://github.com/roppa/convector-example

Looking at convector hyperledger chaincode
https://github.com/roppa/convector-example

Last synced: 9 months ago
JSON representation

Looking at convector hyperledger chaincode

Awesome Lists containing this project

README

          

# Smart contracts

Assets ({ name, price }) can be traded between participants ({ name }).

## Using Convector

```
conv new bcg -c participant
cd bcg
conv generate chaincode asset
npm install
npm run env:restart
npm run cc:start -- participant
npm run cc:start -- asset
npx lerna run start --scope server --stream
```

This awesome project was created automatically with Convector CLI.
By default new Convector projects locally include Hurley to manage your development environment seamlessly, so you don't have to worry about setting up the network and hard ways to install and upgrade your chaincodes.

## Start

```
# Install dependencies - From the root of your project
npm i
# Create a new development blockchain network - From the root of your project
npm run env:restart
# Install your smart contract
npm run cc:start -- participant
# Make a testing call to create a record in the ledger
# Beware that the first call may fail with a timeout! Just happens the first time
hurl invoke participant participant_create "{\"name\":\"my first request\",\"id\":\"0001\",\"created\":0,\"modified\":0}"
```

## About Hurley

You may as well install **Hurley** globally for easier and more flexible management.

`npm i -g @worldsibu/hurley`

Since with Hurley globally you have control over everything, some things that you can do, for example, is installing a Convector Smart Contract with a different name than the one you used for your project.

```
# Use the same package
# Install a new chaincode with the same source code but the name 'anothernameforyourcc'
hurl install anothernameforyourcc node
```

Other complex tasks you may need is installing to a different channel.

```
# Use the same package
# Be sure you started your environment with more than one channel running 'hurl new --channels 2'. Otherwise this will throw an error.
hurl install anothernameforyourcc node --channel ch2
```

---

If you don't want to, don't worries! This project works right away.

## Start - if you have Hurley globally

### Bring your project to life

```
# Install dependencies - From the root of your project
npm i
# Create a new development blockchain network - From the root of your project
hurl new
```

### Install and upgrade chaincodes

```
# Package your smart contract's code - From the root of your project
npm run cc:package -- participant org1
# Install to your blockchain - From the root of your project
hurl install participant node -P ./chaincode-participant
# Install in debug mode, this will run the chaincode server locally so you can debug
hurl install participant node -P ./chaincode-participant --debug

# Upgrade your existing chaincode - From the root of your project
hurl upgrade participant node 1.2 -P ./chaincode-participant
```

## Start - if you don't have Hurley globally

### Bring your project to life

```
# Install dependencies - From the root of your project
npm i
# Create a new development blockchain network - From the root of your project
npm run env:restart
```

### Install and upgrade chaincodes

```
# Install to your blockchain - From the root of your project
npm run cc:start -- participant

# Upgrade your existing chaincode - From the root of your project
npm run cc:upgrade -- participant 1.2
```

## Tests

```
npm run test
```

> Check all the information to work with Convector in the DOCS site.

## Collaborate to the Convector Suite projects

* Discord chat with the community
* Convector projects