Skip to content

Instantly share code, notes, and snippets.

@kctam
kctam / emarket.t.sol
Created May 19, 2019 02:34
marketplace with no token
pragma solidity ^0.5.6;
import "ds-test/test.sol";
import "./Emarket.sol";
contract EmarketTest is DSTest {
Emarket emarket;
function setUp() public {
@kctam
kctam / emarketwithcoin.sol
Created May 19, 2019 02:45
marketplace with token
pragma solidity ^0.5.6;
import "ds-token/token.sol";
contract Emarketwithcoin {
struct Item {
string description;
address seller;
address buyer;
uint price;
@kctam
kctam / docker-compose.yaml
Last active August 14, 2019 08:38
Hyperledger Fabric Multi-Channel Setup
version: '2'
networks:
byfn:
services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
@kctam
kctam / apiserver.js
Created September 4, 2019 14:05
API Server for Fabric Network
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
// Setting for Hyperledger Fabric
const { FileSystemWallet, Gateway } = require('fabric-network');
const path = require('path');
const ccpPath = path.resolve(__dirname, '.', 'connection-org1.json');
@kctam
kctam / connection-org1.json
Created September 4, 2019 14:07
Connection profile for API Server interacting with First Network in Hyperledger Fabric
{
"name": "first-network-org1",
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
}
@kctam
kctam / regUser.js
Created September 18, 2019 03:59
Fabric-CA: Register User in Fabric CA and Secret is returned
/*
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const { FileSystemWallet, Gateway, X509WalletMixin } = require('fabric-network');
const path = require('path');
const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json');
@kctam
kctam / enrollUser.js
Created September 18, 2019 04:00
Fabric-CA: Enroll User in Fabric CA with Secret. The result is stored in wallet directoryof that user.
/*
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const FabricCAServices = require('fabric-ca-client');
const { FileSystemWallet, X509WalletMixin } = require('fabric-network');
const fs = require('fs');
const path = require('path');
@kctam
kctam / crypto-config.yaml
Created April 7, 2019 05:55
3node2channel setup
OrdererOrgs:
- Name: Orderer
Domain: example.com
Specs:
- Hostname: orderer
PeerOrgs:
- Name: Org1
Domain: org1.example.com
Template:
Count: 1
@kctam
kctam / configtx.yaml
Created April 7, 2019 05:57
3node2channel setup
---
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: ./crypto-config/ordererOrganizations/example.com/msp
- &Org1
Name: Org1MSP
@kctam
kctam / docker-compose-base.yml
Created April 7, 2019 06:01
3node2channel setup
version: '2'
services:
orderer:
image: hyperledger/fabric-orderer
environment:
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=deployment_fabric
- ORDERER_HOME=/var/hyperledger/orderer
- ORDERER_GENERAL_LOGLEVEL=debug